-
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
worktree add: preserve version metadata for unmodified files on dvc add
#8595
Conversation
old_out = old_outs.get(out.def_path, None) | ||
if old_out is not None: | ||
out.restore_fields(old_out) |
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.
Continually adding fields to these tuples was not ideal as far as maintaining it goes, is clearer/easier to update in the future by just keeping these assignments in Output
Codecov ReportBase: 94.28% // Head: 94.28% // No change to project coverage π
Additional details and impacted files@@ Coverage Diff @@
## main #8595 +/- ##
=======================================
Coverage 94.28% 94.28%
=======================================
Files 431 431
Lines 32931 32931
Branches 4607 4607
=======================================
Hits 31048 31048
Misses 1461 1461
Partials 422 422 Help us with your feedback. Take ten seconds to tell us how you rate us. Have a feature suggestion? Share it here. β View full report at Codecov. |
if merge_versioned: | ||
try: | ||
old = self.reload() |
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.
This extra reload
on save might be expensive, so it's tied to the merge_versioned
flag for now.
The problem is that we can't do this in the same place we are doing restore_fields
. restore_fields
is done on repo.stage.create
and is intended to set fields that may be replaced/updated afterwards (i.e. we load original annotations from a dvcfile in restore_fields
and then use out.annot.update()
later to replace the loaded values with any new/updated ones from the command line.
But for the version metadata merge, we cannot do it until after the new outs have been save()
'd, since we need the new out md5's to be computed before we can compare them to the old ones.
dvc add
dvc add
β 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. π
Fixes #8293