New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
DM-42773: Save value for version when uncommitted changes. #119
Conversation
Codecov ReportAll modified and coverable lines are covered by tests ✅
Additional details and impacted files@@ Coverage Diff @@
## main #119 +/- ##
=======================================
Coverage 85.71% 85.71%
=======================================
Files 5 5
Lines 42 42
Branches 3 3
=======================================
Hits 36 36
Misses 3 3
Partials 3 3 ☔ View full report in Codecov by Sentry. |
a14d94d
to
6d7b391
Compare
python/lsst/sconsUtils/vcs/git.py
Outdated
raise RuntimeError("Error with git version: uncommitted changes") | ||
desc = utils.runExternal("git describe --tags --always", fatal=True) | ||
return desc.strip() | ||
desc += " *" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Not sure if this is important but python versions shouldn't have spaces or end in non-digit or non-number. We likely don't care because these version strings will fail validation anyhow. In some sense *
is a bit ambivalent as to what it means and -dirty
is more explicit (and I don't think it matters if that turns up in fingerprint).
@ktlim do you have an opinion on this?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We use git describe --always --dirty
in a number of other places; I think that's definitely better than inventing a ' *'-based convention.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
ok changing the code for version but not for fingerprint.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I can't think of a reason why we wouldn't use -dirty
for fingerprint as well. Surely people aren't parsing that for the *
?
python/lsst/sconsUtils/vcs/git.py
Outdated
@@ -23,11 +23,13 @@ def guessVersionName(): | |||
if not os.path.exists(".git"): | |||
state.log.warn("Cannot guess version without .git directory; version will be set to 'unknown'.") | |||
return "unknown" | |||
desc = utils.runExternal("git describe --tags --always", fatal=True) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Now that I think about it further, I think that changing this to:
desc = utils.runExternal("git describe --tags --always", fatal=True) | |
desc = utils.runExternal("git describe --tags --always --dirty", fatal=True) |
will fix this for us automatically.
6d7b391
to
1667c9a
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks good. I like how it's now much simpler and uses git APIs directly.
No description provided.