Skip to content

cli split: Add a config option controlling how bookmarks move during splits #5618

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

Merged
merged 1 commit into from
Feb 13, 2025

Conversation

emesterhazy
Copy link
Member

@emesterhazy emesterhazy commented Feb 7, 2025

Currently, jj split moves bookmarks from the target revision to the second
revision created by the split. Since the first revision inherits the change id
of the target revision, moving the bookmarks to the first revision is less
surprising (i.e. the bookmarks stay with the change id). This no-implicit-move
behavior also aligns with how jj abandon drops bookmarks instead of moving
them to the parent revision.

Two releases from now, jj split will no longer move bookmarks to the second
revision created by the split. Instead, local bookmarks associated with the
target revision will move to the first revision created by the split (which
inherits the target revision's change id). You can opt out of this change by
setting split.legacy-bookmark-behavior = true, but this will likely be
removed in a future release. You can also try the new behavior now by setting
split.legacy-bookmark-behavior = false.

Users who have not set the new config option will see a warning when they run
jj split informing them about the change.

The jj split tests for bookmarks are updated to run in all three configurations:

  • Config setting enabled
  • Config setting disabled
  • Config setting unset

Checklist

If applicable:

  • I have updated CHANGELOG.md
  • I have updated the documentation (README.md, docs/, demos/)
    • N/A: I didn't see any docs describing the bookmark semantics.
  • I have updated the config schema (cli/src/config-schema.json)
  • I have added tests to cover my changes

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.

Thanks for doing this, lgtm. I will leave the last call to Martin.

@emesterhazy
Copy link
Member Author

emesterhazy commented Feb 7, 2025

it would also be nice if you spelled out "the working copy commit (@)" in the comment

Makes sense; done. Thanks for taking a look :)

@martinvonz martinvonz changed the title cli split: Leave bookarks associated with the original change id cli split: Leave bookmarks associated with the original change id Feb 8, 2025
@emesterhazy emesterhazy force-pushed the push-sksyopkrnqrs branch 2 times, most recently from b4ee730 to 603208b Compare February 9, 2025 02:35
@emesterhazy emesterhazy force-pushed the push-sksyopkrnqrs branch 2 times, most recently from dce749f to 7936539 Compare February 9, 2025 15:00
@emesterhazy emesterhazy force-pushed the push-sksyopkrnqrs branch 2 times, most recently from 68280b0 to a32eeba Compare February 9, 2025 18:38
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 I'll leave it for a non-googler to approve (EDIT: ah, you already have approval)

emesterhazy added a commit that referenced this pull request Feb 12, 2025
We are planning to add a config option that controls how bookmarks and change
ids move based on feedback in #5618. I think
the tests will be more readable after the config option is added if we move the
bookmark testing to its own test.
emesterhazy added a commit that referenced this pull request Feb 12, 2025
We are planning to add a config option that controls how bookmarks and change
ids move during `jj split` based on feedback in
#5618. I think the tests will be more readable
after the config option is added if we move the bookmark testing to its own
test.

#3419
emesterhazy added a commit that referenced this pull request Feb 12, 2025
We are planning to add a config option that controls how bookmarks and change
ids move during `jj split` based on feedback in #5618.
I think the tests will be more readable after the config option is added if we
move the bookmark testing to its own test.

#3419
github-merge-queue bot pushed a commit that referenced this pull request Feb 12, 2025
We are planning to add a config option that controls how bookmarks and change
ids move during `jj split` based on feedback in #5618.
I think the tests will be more readable after the config option is added if we
move the bookmark testing to its own test.

#3419
@emesterhazy emesterhazy force-pushed the push-sksyopkrnqrs branch 2 times, most recently from 648b696 to 62f2caf Compare February 13, 2025 01:29
@emesterhazy emesterhazy changed the title cli split: Leave bookmarks associated with the original change id cli split: Add a config option controlling how bookmarks move during splits Feb 13, 2025
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.

still looks great.

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.

I had these two draft comments that I meant to send. (But don't let that change your decision about the warning.)

…splits

Currently, `jj split` moves bookmarks from the target revision to the second
revision created by the split. Since the first revision inherits the change id
of the target revision, moving the bookmarks to the first revision is less
surprising (i.e. the bookmarks stay with the change id). This no-implicit-move
behavior also aligns with how `jj abandon` drops bookmarks instead of moving
them to the parent revision.

Two releases from now, `jj split` will no longer move bookmarks to the second
revision created by the split. Instead, local bookmarks associated with the
target revision will move to the first revision created by the split (which
inherits the target revision's change id). You can opt out of this change by
setting `split.legacy-bookmark-behavior = true`, but this will likely be
removed in a future release. You can also try the new behavior now by setting
`split.legacy-bookmark-behavior = false`.

Users who have not opted into the new behavior via the config setting will see
a warning when they run `jj split` informing them about the change. The default
behavior be changed in the future.

The `jj split` tests for bookmarks are updated to run in all three configurations:

- Config setting enabled
- Config setting disabled
- Config setting unset


#3419
@emesterhazy
Copy link
Member Author

I am going to submit this since at this point we are just going back and forth on how and when the warning should be printed, and there's still time to adjust that.

For what it's worth, I agree with @emilazy that it's not great to force users that want the new behavior to adjust their config to silence the warning. However, I thought the reason we added the warning in the first place was to avoid confusing users by changing the behavior silently (not everyone reads the patch notes).

I think the current plan is:

  1. In the next release n, users will get a warning every time they jj split unless they opt into the new behavior.
  2. In release n+1 the behavior will be enabled by default, and users will only get a warning if they opt out of the new behavior.
  3. In some future release, the opt-out will be removed and users will get an error during jj split, or it will just silently do nothing.

Please open a new PR if anyone thinks we should change the plan.

@emesterhazy emesterhazy added this pull request to the merge queue Feb 13, 2025
Merged via the queue into main with commit d5d2164 Feb 13, 2025
42 checks passed
@emesterhazy emesterhazy deleted the push-sksyopkrnqrs branch February 13, 2025 22:02
emesterhazy added a commit that referenced this pull request Feb 13, 2025
`jj split --parallel` now sets the working copy revision (`@`) to the first
revision created by the split instead of the second. As a result, `@` remains
on the same change id before and after the split.

There is no good reason to choose the second commit as the working copy commit
after a --parallel split. The only reason it works that way today is because
doing that didn't require any code changes compared to the non parallel split.

Martin proposed this change in the review for #5618.
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.

7 participants