-
Notifications
You must be signed in to change notification settings - Fork 1.2k
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
scm: implement pygit2 resolve rev and native checkout #5270
Conversation
Investigating why checkpoint resume breaks with the pygit2 checkout, everything else in DVC appears to work properly with it. |
if branch == "-": | ||
branch = "@{-1}" |
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.
For whatever reason, libgit2's resolve_refish
doesn't handle -
shorthand, probably because it's specific to git checkout/switch
and not a general git ref shorthand symbol
d83f61f
to
9affacc
Compare
@@ -50,7 +50,7 @@ def test_post_checkout(self, tmp_dir, scm, dvc): | |||
os.unlink("file") | |||
scm.install() | |||
|
|||
scm.checkout("new_branch", create_new=True) | |||
scm.gitpython.git.checkout("-b", "new_branch") |
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.
libgit2 does not run git hooks on any command/function call, and internally we don't need to run this hook.
For this test we want to make sure that the installed DVC post-checkout hook is run when a user does command-line git checkout
, not that it is run on DVC scm.checkout
.
|
143165d
to
2b7d94d
Compare
else: | ||
return f"refs/heads/{self.repo.active_branch}" |
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.
A bit offtopic and not important in such a small else
statement, but what do you guys think about enabling no-else-after-return check in our linters? I seem to stumble upon it regularly.
else: | |
return f"refs/heads/{self.repo.active_branch}" | |
return f"refs/heads/{self.repo.active_branch}" |
EDIT: add to our retro to discuss π
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.
Great stuff π
β I have followed the Contributing to DVC checklist.
π If this PR requires documentation updates, I have created a separate PR (or issue, at least) in dvc.org and linked it here.
Thank you for the contribution - we'll try to review it as soon as possible. π
Implements required functionality for workspace
git checkout
andgit checkout -b
(get_ref/set_ref/iter_refs
,resolve_rev
,reset
) in pygit2 backend.Related to #2215