Skip to content
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

Merged
merged 1 commit into from Feb 27, 2024

Conversation

MichelleGower
Copy link
Contributor

No description provided.

Copy link

codecov bot commented Feb 25, 2024

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 85.71%. Comparing base (30fe544) to head (1667c9a).

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.
📢 Have feedback on the report? Share it here.

raise RuntimeError("Error with git version: uncommitted changes")
desc = utils.runExternal("git describe --tags --always", fatal=True)
return desc.strip()
desc += " *"
Copy link
Member

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?

Copy link
Contributor

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.

Copy link
Contributor Author

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.

Copy link
Member

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 *?

@@ -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)
Copy link
Member

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:

Suggested change
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.

Copy link
Member

@timj timj left a 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.

@MichelleGower MichelleGower merged commit 9c2b618 into main Feb 27, 2024
9 checks passed
@MichelleGower MichelleGower deleted the tickets/DM-42773 branch February 27, 2024 01:56
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants