Skip to content

Conversation

senekor
Copy link
Contributor

@senekor senekor commented Oct 16, 2025

This is split off from #7330. There, my suggestion was to make the target revision of jj bookmark move a positional argument. We decided against that. But as part of the proposal, having multiple positional bookmark arguments would have to be deprecated. My thoughts kept coming back to that even after closing the original proposal.

I think that moving multiple bookmarks to the same revision is fundamentally a weird thing to do. Having that be the central way the CLI function makes the documentation confusing to me. E.g. reading this:

Move existing bookmarks to target revision

If bookmark names are given, the specified bookmarks will be updated to
point to the target revision.

My brain immediately goes "Why would I want to move multiple bookmarks to the same revision?" So I confuses me about how bookmarks are supposed to be used. So, I propose to deprecate that purely as a documentation improvement. When the functionality is actually needed in rare cases, a string pattern or shell loop can do the job just fine.

I realize this is a breaking change taking away functionality for relatively little gain (slightly better documentation). The conclusion here may well be "No, let's not do that." I'd be okay with that and close the PR. I just wanted to get the proposal out there, because it keeps coming up in my mind.

  • 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/updated tests to cover my changes

@senekor senekor requested a review from a team as a code owner October 16, 2025 08:39
@senekor senekor force-pushed the senekor/oxvqosoutouz branch from 7ddbdf2 to 5bf997c Compare October 16, 2025 09:01
@joyously
Copy link

Quick question: the intent is to limit setting multiple bookmarks to the same change, and nothing regarding having multiple bookmarks on the same change as a result of normal operations?

I'm also wondering if this matters in terms of jj as a whole system, where bookmarks are more than local data (jj is on the remote), or they interact with Topics.

@senekor
Copy link
Contributor Author

senekor commented Oct 16, 2025

It only affects moving multiple bookmarks at the same time. It's still possible, just more tedious (in exchange for a simpler, more intuitive CLI, in my opinion):

# status quo
jj bookmark move foo bar

# with this PR
jj bookmark move "regex:foo|bar"

I'm also wondering if this matters in terms of jj as a whole system

Not at all, it's just a superficial change to the CLI.

@PhilipMetzger
Copy link
Contributor

I don't think this is should be done, since a bunch of people rely on it working.

@senekor
Copy link
Contributor Author

senekor commented Oct 16, 2025

To what extent are people relying on it? What kind of workflow requires moving multiple bookmarks to the same revision?

@senekor senekor force-pushed the senekor/oxvqosoutouz branch from 5bf997c to 38ea31e Compare October 16, 2025 16:41
@higgsd
Copy link
Contributor

higgsd commented Oct 17, 2025

I use this in a hackneyed foreign VCS overlay. I set two bookmarks at once - one representing the branch tip (human-readable) and one representing the foreign VCS commit (machine-readable).

This seems like an unnecessary reduction in the tool’s flexibility, only because it doesn’t make sense for most common workflows.

@PhilipMetzger
Copy link
Contributor

To what extent are people relying on it?

This is hard to say but since noone ever complained about it to an extent it should be used and liked.

What kind of workflow requires moving multiple bookmarks to the same revision?

It may be useful if you have a bookmark representing the upstream PR and one for your private work on something, so a thing similar to Ilya's one where only the polished one appears as a PR.

I think that moving multiple bookmarks to the same revision is fundamentally a weird thing to do.

Only because you disagree or not understand it doesn't mean that such a change is necessary. Since it has been supported for a long time now (roughly 1.5 years) with no complaints it rather leaves your thinking as "weird" to not support it.

I don't think the project should do such ideologically motivated changes because it is a wrinkle from one perspective.

@senekor
Copy link
Contributor Author

senekor commented Oct 17, 2025

I use this in a hackneyed foreign VCS overlay. I set two bookmarks at once - one representing the branch tip (human-readable) and one representing the foreign VCS commit (machine-readable).

Can you explain this workflow a little more? What is a foreign VCS overlay? What tool is interacting with the machine-readable bookmark?

To what extent are people relying on it?

This is hard to say but since noone ever complained about it to an extent it should be used and liked.

A feature must be used and liked because noone complained about it? I don't think that logic is sound. Also, I'm complaining about it now :) The design of the bookmark move command has been bugging me for a while. It takes a little time to figure out what exactly I don't like about it (and as you know, I've come around to your opinion on some things as well).

It may be useful if you have a bookmark representing the upstream PR and one for your private work on something, so a thing similar to Ilya's one where only the polished one appears as a PR.

Can you explain a little more? (Or maybe post a link to Ilya's explanation of their workflow?) If both bookmarks point to the same commit, then the "private" and "polished" state are the same anyway, so I don't see the distinction?

ideologically motivated changes

There's no need for that language. An intuitive CLI is an obviously valuable goal, there's nothing "ideological" about it. We can discuss the trade-off here without calling my motivation into question.

@higgsd
Copy link
Contributor

higgsd commented Oct 18, 2025

I use this in a hackneyed foreign VCS overlay. I set two bookmarks at once - one representing the branch tip (human-readable) and one representing the foreign VCS commit (machine-readable).

Can you explain this workflow a little more? What is a foreign VCS overlay? What tool is interacting with the machine-readable bookmark?

I initialize a jj repo on top of a checkout of another (centralized, slow) VCS. I then do typical non-colocated development with jj until my code is ready, after which I commit it to the other VCS. Sometimes I pull updates from the other VCS and use jj to rebase my WIP code on top. None of the conveniences of jj's git integration, but with care it's possible to keep jj and the other VCS from stepping on each others' toes.

Eventually I broke down and wrote a script to avoid common pitfalls, automate common tasks, and import individual VCS commits individually. Each imported commit gets a specific bookmark (think: git commit hash) so my script can get its bearings, and so I don't need to consult the VCS as much to correlate jj changes. I also maintain floating bookmarks so I can easily find the tip of each named branch for rebasing purposes. Thus, as my script imports new commits from the VCS, it calls jj bookmark set vcs.$BRANCH vcs.$BRANCH.$VCS_COMMIT.

With regard to the proposal, IMHO bookmark set should continue to take multiple arguments, because it may be creating new bookmarks from scratch that cannot be regexed or globbed. There is a stronger case for bookmark move since it can only select existing bookmarks, but I still think that it removes flexibility and makes the tool (slightly) less accessible.

@senekor
Copy link
Contributor Author

senekor commented Oct 18, 2025

Thank you for the explanation. That's an interesting workflow and IMO worthy to support. If jj can bring value to people coming from another VCS than git, that's fantastic.

If the use is in a script already, I think it would be no problem to split that into two separate commands. But I also agree that the case for bookmark set is weaker. bookmark create can create multiple bookmarks, and set is a hybrid between create and move.

Generally speaking, I think it's better to push the complexity of niche workflows onto users of those workflows (and their scripts). Otherwise, jj itself would accumulate a lot of complexity from various different workflows. More precisely, non-users of niche workflows should not have to stumble over that complexity during normal use. (It's fine to have "hidden" support for niche workflows, config options etc.)

So, I'm still leaning to deprecate multiple name arguments for the move command.

One thing that would definitely change my mind is if there is an interactive workflow that often involves moving multiple bookmrks to the same commit. I would not want to impose the tedious "regex:foo|bar" syntax for regular, interactive use.

There is nothing inherently wrong with moving multiple bookmarks at
once to the same revision. However, it rarely makes sense in a normal
workflow. Therefore, it is confusing to have that as a central feature
of the CLI. By only allowing a single string pattern for the bookmark to
move, the command help becomes less confusing. It is still possible to
move multiple bookmarks at once to the same revision with an appropriate
glob or regex pattern.
@senekor senekor force-pushed the senekor/oxvqosoutouz branch from 38ea31e to 5855033 Compare October 18, 2025 07:31
@senekor senekor changed the title cli bookmark: deprecate moving and setting multiple bookmarks cli bookmark move: deprecate multiple name arguments Oct 18, 2025
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