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

Add --empty-parent and --empty-child to jj split #1167

Closed
wants to merge 2 commits into from

Conversation

samueltardieu
Copy link
Contributor

@samueltardieu samueltardieu commented Jan 31, 2023

Following the discussion in #1155, I tried an implementation of --empty-parent (-P) and --empty-child (-C) with jj split. They do not prompt for a description: the non-empty change keeps the original description and change id. The empty change gets an empty description and a new change id.

The fact that the non-empty commit keeps the change id when using --empty-parent differs from what is done with jj split nonexistent, but it seems more logical to me. I've done this in a separate commit as to be able to revert it easily if needed.

Checklist

If applicable:

  • I have updated CHANGELOG.md
  • I have updated the documentation (README.md, docs/, demos/)
  • I have added tests to cover my changes

@samueltardieu samueltardieu marked this pull request as draft January 31, 2023 19:01
@samueltardieu samueltardieu marked this pull request as ready for review January 31, 2023 21:21
Copy link
Contributor

@ilyagr ilyagr left a comment

Choose a reason for hiding this comment

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

This approach (adding options to jj split) looks fine to me, but we should wait for @martinvonz and/or @yuja to comment.

I think there's an annoying change needed to which commit gets which change id. There's no reason to fix that unless we officially settle on this approach. Other than that, this looks good to me; I just have some minor take-it-or-leave-it comments.

CHANGELOG.md Outdated Show resolved Hide resolved
src/commands/mod.rs Outdated Show resolved Hide resolved
src/commands/mod.rs Outdated Show resolved Hide resolved
src/commands/mod.rs Show resolved Hide resolved
tests/test_split_command.rs Outdated Show resolved Hide resolved
src/commands/mod.rs Outdated Show resolved Hide resolved
tests/test_split_command.rs Outdated Show resolved Hide resolved
tests/test_split_command.rs Show resolved Hide resolved
@martinvonz
Copy link
Member

My main concern with --empty-parent and --empty-child is that split is probably not the command I would reach for to insert a new commit in a stack. OTOH, if the user actually did look at jj help split and wanted to create an empty child or parent, it does seem better to have flags for that than to have them figure out the jj split . and jj split nonexistent tricks. So I'm not sure what's best. I also left a comment on #1155.

lib/src/commit_builder.rs Outdated Show resolved Hide resolved
@yuja
Copy link
Contributor

yuja commented Feb 1, 2023

My main concern with --empty-parent and --empty-child is that split is probably not the command I would reach for to insert a new commit in a stack.

I feel the same. Functionality wise, these jj split options work for me. But maybe successors/predecessors chain would be different from what I expect for "new" commit insertion?

@samueltardieu samueltardieu force-pushed the split-empty branch 2 times, most recently from 7fdf901 to 9c7eb43 Compare February 1, 2023 08:03
@samueltardieu samueltardieu marked this pull request as draft February 1, 2023 13:16
Copy link
Contributor

@ilyagr ilyagr left a comment

Choose a reason for hiding this comment

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

I'm approving this to get rid of the annoying red "changes requested" marker. Please don't merge it without an OK from others.

CHANGELOG.md Outdated
@@ -104,6 +104,10 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
and `jj split any-non-existent-path` inserts an empty commit between the
target commit and its parents.

* jj split gained new `--empty-parent` and `--empty-child` options. They
allow inserting an empty parent before or after an empty child after the
Copy link
Contributor

Choose a reason for hiding this comment

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

This needs a comma and has too many "after"s. "an empty parent before, or an empty child after..."

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Done

@samueltardieu
Copy link
Contributor Author

This PR is suspended at the moment as it is less powerful than #1172 although less intimidating. Let's wait until #1172 is settled.

@samueltardieu
Copy link
Contributor Author

I'll close this one, for the time being jj new -B and jj new -A do a perfect job for me.

@samueltardieu samueltardieu deleted the split-empty branch September 12, 2024 18:34
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