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

copy-tracking: plumb copy tracking through diff detection #4118

Merged
merged 8 commits into from
Aug 11, 2024

Conversation

fowles
Copy link
Contributor

@fowles fowles commented Jul 18, 2024

Re-approach copy tracking with a simpler signature. Push through end-to-end copy for diff -s.

This is not ready to submit, but is complete enough that I would like feedback on the direction. Remaining things to do:

  • update design doc
  • update CHANGELOG.md
  • plumb through all other diff commands
  • update the documentation?
  • update the config schema? (cli/src/config-schema.json)

@fowles fowles requested review from martinvonz and ilyagr July 18, 2024 16:34
@fowles fowles force-pushed the simplify branch 2 times, most recently from 9b49da6 to 6734640 Compare July 18, 2024 16:53
Copy link
Contributor

@yuja yuja left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I can't comment on copy-tracing API changes, so just about diff_util part.

I think it's good to use Commit or [Commit] in place of MergedTree. I'm trying to implement commit description templates, and show_diff() callers in description_util.rs will be switched to be using a Commit object. It may be either a temporary Commit physically written to the store, or in-memory Commit with fake commit id and physically-stored tree and parents.

cli/src/diff_util.rs Outdated Show resolved Hide resolved
@fowles
Copy link
Contributor Author

fowles commented Jul 19, 2024

I can't comment on copy-tracing API changes, so just about diff_util part.

I think it's good to use Commit or [Commit] in place of MergedTree. I'm trying to implement commit description templates, and show_diff() callers in description_util.rs will be switched to be using a Commit object. It may be either a temporary Commit physically written to the store, or in-memory Commit with fake commit id and physically-stored tree and parents.

This is great! That will fit together much better.

@fowles fowles force-pushed the simplify branch 6 times, most recently from b7e16c4 to 3e59437 Compare August 7, 2024 01:43
@PhilipMetzger PhilipMetzger marked this pull request as ready for review August 7, 2024 15:33
Copy link
Member

@martinvonz martinvonz left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Just one little comment for now. I'll have to review it in detail later

cli/examples/custom-backend/main.rs Outdated Show resolved Hide resolved
@fowles fowles force-pushed the simplify branch 3 times, most recently from 76bac8e to 2f7fbd7 Compare August 7, 2024 17:58
Copy link
Contributor

@PhilipMetzger PhilipMetzger left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The things I mentioned in Discord.

cli/src/diff_util.rs Show resolved Hide resolved
lib/src/merged_tree.rs Outdated Show resolved Hide resolved
lib/src/merged_tree.rs Show resolved Hide resolved
cli/src/merge_tools/diff_working_copies.rs Show resolved Hide resolved
cli/src/diff_util.rs Outdated Show resolved Hide resolved
docs/design/copy-tracking.md Outdated Show resolved Hide resolved
lib/src/backend.rs Outdated Show resolved Hide resolved
CHANGELOG.md Show resolved Hide resolved
cli/src/commands/diff.rs Show resolved Hide resolved
cli/examples/custom-backend/main.rs Show resolved Hide resolved
@fowles fowles force-pushed the simplify branch 6 times, most recently from 7390d9a to f298f37 Compare August 9, 2024 02:13
cli/src/commands/diff.rs Show resolved Hide resolved
lib/src/backend.rs Show resolved Hide resolved
lib/src/backend.rs Show resolved Hide resolved
lib/src/backend.rs Show resolved Hide resolved
lib/tests/test_merged_tree.rs Outdated Show resolved Hide resolved
lib/src/merged_tree.rs Outdated Show resolved Hide resolved
lib/src/merged_tree.rs Outdated Show resolved Hide resolved
cli/src/diff_util.rs Outdated Show resolved Hide resolved
cli/src/diff_util.rs Outdated Show resolved Hide resolved
lib/src/merged_tree.rs Show resolved Hide resolved
lib/src/backend.rs Outdated Show resolved Hide resolved
cli/src/commands/diff.rs Outdated Show resolved Hide resolved
@fowles fowles force-pushed the simplify branch 3 times, most recently from d988f3f to c855ac8 Compare August 9, 2024 17:48
cli/src/merge_tools/diff_working_copies.rs Show resolved Hide resolved
cli/src/diff_util.rs Show resolved Hide resolved
lib/src/conflicts.rs Show resolved Hide resolved
cli/src/diff_util.rs Outdated Show resolved Hide resolved
lib/src/merged_tree.rs Outdated Show resolved Hide resolved
cli/src/diff_util.rs Outdated Show resolved Hide resolved
@fowles fowles force-pushed the simplify branch 2 times, most recently from d31bfee to 2baa663 Compare August 9, 2024 21:55
lib/src/merged_tree.rs Outdated Show resolved Hide resolved
lib/src/merged_tree.rs Outdated Show resolved Hide resolved
@fowles fowles force-pushed the simplify branch 4 times, most recently from a087d90 to 64aec51 Compare August 10, 2024 02:18
cli/src/commands/diff.rs Outdated Show resolved Hide resolved
cli/src/commands/diff.rs Outdated Show resolved Hide resolved
Copy link
Member

@martinvonz martinvonz 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 to me, minus the few remaining nits.

But please give @yuja another chance to comment too.

@yuja: As I said elsewhere on this PR, I don't think the API changes in the first commit are quite right. However, I think the rest of the series looks correct, and it provides practical improvements for Git users. I therefore think it makes sense to get this in in its current form, even if we know we're going to have change the API later. I don't think this PR makes it significantly harder to make those changes later, whatever they are - the changes to the diff iterator/stream and the commands using them see like they probably won't change significantly. Let us know if you disagree, of course.

cli/src/diff_util.rs Outdated Show resolved Hide resolved
cli/src/diff_util.rs Outdated Show resolved Hide resolved
@martinvonz
Copy link
Member

And thanks a lot for your hard work and patience with this PR, @fowles!

cli/src/commands/debug/copy_detection.rs Outdated Show resolved Hide resolved
cli/src/commands/diff.rs Outdated Show resolved Hide resolved
lib/src/merged_tree.rs Outdated Show resolved Hide resolved
cli/src/diff_util.rs Outdated Show resolved Hide resolved
cli/src/commit_templater.rs Show resolved Hide resolved
lib/src/backend.rs Show resolved Hide resolved
cli/src/commands/diff.rs Outdated Show resolved Hide resolved
Copy link
Contributor

@PhilipMetzger PhilipMetzger left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

cli/src/commands/fix.rs Show resolved Hide resolved
cli/src/diff_util.rs Show resolved Hide resolved
lib/src/merged_tree.rs Show resolved Hide resolved
CHANGELOG.md Outdated Show resolved Hide resolved
lib/src/backend.rs Outdated Show resolved Hide resolved
fowles added 8 commits August 11, 2024 16:47
- use a single commit instead of an array of them.  This simplifies the
  implementation.  A higher level api can wrap this when an array of
  commits is desired and those semantics are figured out.
- since this API is directly 1-1 on parents, there are no conflicts
- if we introduce a higher level API that handles lists of commits, we
  may need to restore the conflict/resolved distinction, but for now
  simplify
- add the field and make it compile, but don't use it yet
- force each diff command to explicitly enable copy tracking
- enable copy tracking in diff_summary
- post-process for diff iterator
- post-process for diff stream
- update changelog
@fowles fowles enabled auto-merge (rebase) August 11, 2024 20:53
@fowles fowles merged commit 5911e5c into jj-vcs:main Aug 11, 2024
17 checks passed
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.

4 participants