add gitinfo class#106
Conversation
Sam Clarke-Green (t00sa)
left a comment
There was a problem hiding this comment.
See suggestion about testing.
| for line in self.run_git(["branch"]): | ||
| if "HEAD detached" in line: | ||
| result = self.detached_head_reference | ||
| break | ||
| else: | ||
| raise GitBDiffError("unable to get branch name") |
There was a problem hiding this comment.
This chunk of code isn't currently being tested. I think it should be easy to check out a detached head in the test repo?
There was a problem hiding this comment.
Done. Have also added a couple of init.py files and a relative import, so now the unit tests can be run by just pytest from the bdiff directory
Pierre Siddall (Pierre-siddall)
left a comment
There was a problem hiding this comment.
The code for this looks great, I have one small suggestion regarding documenting the use of a walrus operator as this is something I had to look up otherwise I'm happy to hit approve on this.
Sam Clarke-Green (t00sa)
left a comment
There was a problem hiding this comment.
Looks good!
Pierre Siddall (Pierre-siddall)
left a comment
There was a problem hiding this comment.
This walrus is now very happy. Approved.
efc37b4
into
MetOffice:main
Description
Add a new class to bdiff as somewhere to get other info about a branch. For now include a function testing whether the branch provided is "main-like". This is useful for some UM tests, where we want to decide whether to run over a branch diff or the full trunk.
Checklist