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

diffedit: add --restore-descendants flag #4489

Merged

Conversation

samueltardieu
Copy link
Contributor

@samueltardieu samueltardieu commented Sep 17, 2024

This adds to diffedit something that unsquash could do and squash could not. This would ease the deprecation of unsquash (see #4479).

Checklist

If applicable:

  • I have updated CHANGELOG.md
  • I have updated the documentation (README.md, docs/, demos/)
  • I have updated the config schema (cli/src/config-schema.json)
  • I have added tests to cover my changes

@samueltardieu samueltardieu force-pushed the diffedit-preserve-descendants branch from 6636f2e to 31510c4 Compare September 17, 2024 09:28
@martinvonz
Copy link
Member

See #1027 for some discussion about how we may want to make this more generic. I don't think we should have to duplicate implementation in each command where it's useful.

@samueltardieu samueltardieu force-pushed the diffedit-preserve-descendants branch from 31510c4 to 8cca2f3 Compare September 17, 2024 17:21
@samueltardieu
Copy link
Contributor Author

I don't think we should have to duplicate implementation in each command where it's useful.

I have moved the reparenting code into jj_lib::repo, and simplified it a lot, thanks to Repo::transform_descendants(). Now, the part that is specific to diffedit is reduced to calling either rebase_children or reparent_children.

cli/src/commands/diffedit.rs Outdated Show resolved Hide resolved
cli/src/commands/diffedit.rs Show resolved Hide resolved
cli/src/commands/diffedit.rs Outdated Show resolved Hide resolved
@samueltardieu samueltardieu force-pushed the diffedit-preserve-descendants branch 3 times, most recently from 31ace6d to 7b62d47 Compare September 22, 2024 19:19
@samueltardieu samueltardieu changed the title diffedit: add --preserve-descendants flag diffedit: add --restore-descendants flag Sep 22, 2024
@samueltardieu samueltardieu force-pushed the diffedit-preserve-descendants branch from 7b62d47 to 884e5f4 Compare September 22, 2024 19:20
lib/src/repo.rs Show resolved Hide resolved
cli/src/commands/diffedit.rs Outdated Show resolved Hide resolved
cli/src/commands/diffedit.rs Outdated Show resolved Hide resolved
cli/tests/test_diffedit_command.rs Outdated Show resolved Hide resolved
@samueltardieu samueltardieu force-pushed the diffedit-preserve-descendants branch 2 times, most recently from c18c8b1 to 477808a Compare September 22, 2024 20:36
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.

LGTM, but let's give Yuya a chance to comment on the option name (and the code too).

cli/tests/test_diffedit_command.rs Outdated Show resolved Hide resolved
@samueltardieu samueltardieu force-pushed the diffedit-preserve-descendants branch 2 times, most recently from 5f249d0 to b8c2702 Compare September 23, 2024 17:36
lib/tests/test_mut_repo.rs Show resolved Hide resolved
cli/tests/test_diffedit_command.rs Outdated Show resolved Hide resolved
@samueltardieu samueltardieu force-pushed the diffedit-preserve-descendants branch from b8c2702 to 8c81d9f Compare September 23, 2024 18:07
@samueltardieu samueltardieu requested a review from yuja September 23, 2024 18:11
@samueltardieu samueltardieu force-pushed the diffedit-preserve-descendants branch from 8c81d9f to caa224c Compare September 23, 2024 21:25
lib/src/repo.rs Outdated Show resolved Hide resolved
lib/tests/test_mut_repo.rs Outdated Show resolved Hide resolved
@samueltardieu samueltardieu force-pushed the diffedit-preserve-descendants branch from caa224c to 84b7353 Compare September 24, 2024 07:19
@samueltardieu samueltardieu merged commit f76ee18 into jj-vcs:main Sep 24, 2024
18 checks passed
@samueltardieu samueltardieu deleted the diffedit-preserve-descendants branch September 24, 2024 07:30
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