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

cli: accept remote bookmark patterns in bookmark forget #5733

Draft
wants to merge 4 commits into
base: main
Choose a base branch
from

Conversation

scott2000
Copy link
Contributor

Follow-up to #5621. Allows BOOKMARK@REMOTE patterns in bookmark forget. Another alternative might be --remote REMOTE.

TODO: add tests for forgetting BOOKMARK@REMOTE without forgetting BOOKMARK.

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

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I think allowing BOOKMARK@REMOTE is a better option than --remote REMOTE, since the meaning of jj bookmark forget BOOKMARK --remote REMOTE seems less clear to me:

  • If the local bookmark BOOKMARK exists, it's unclear whether this command would delete both BOOKMARK and BOOKMARK@REMOTE, or only BOOKMARK@REMOTE.
  • Since the default is to untrack all remote bookmarks, a user might expect --remote REMOTE to mean "only untrack the remote bookmark from REMOTE" (i.e. they might expect it to be the same as jj bookmark delete BOOKMARK followed by jj bookmark untrack BOOKMARK@REMOTE, when really it's an entirely different meaning).

I also think being able to jj bookmark forget BOOKMARK@REMOTE would be convenient in cases where a remote bookmark was deleted, and you want to skip fetching the deletion since it would cause some commits to be abandoned, so it seems useful to support this feature.

We could also decide that this feature isn't important to implement for now, since it seems like it would mainly be useful for advanced users and it could confuse regular users.

Copy link
Contributor

Choose a reason for hiding this comment

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

  • If the local bookmark BOOKMARK exists, it's unclear whether this command would delete both BOOKMARK and BOOKMARK@REMOTE, or only BOOKMARK@REMOTE.
  • Since the default is to untrack all remote bookmarks, a user might expect --remote REMOTE to mean "only untrack the remote bookmark from REMOTE" (i.e. they might expect it to be the same as jj bookmark delete BOOKMARK followed by jj bookmark untrack BOOKMARK@REMOTE, when really it's an entirely different meaning).

I agree about these, and I'm not against adding forget BOOKMARK@REMOTE.

What I'm not certain about is how the pattern syntax will be evolved. Suppose we add compound string expression something like bookmarks("foo" & ~glob:"bar/*"), it makes sense to parse CLI name patterns in the same way. If the pattern argument accepts both local and remote symbols, they can be combined as "foo | bar@baz ..". That's technically doable, but seems weird.

@scott2000 scott2000 force-pushed the bookmark-forget-remote branch from 65cbafb to 7bda57d Compare February 22, 2025 18:13
I'm going to change `jj bookmark forget` to accept both local and remote
bookmark patterns, and this allows them to both be passed as arguments.
This makes it more clear that it only completes the "name" part of the
bookmark, not the "remote" part.
This completion will be used for `jj bookmark forget`.
Being able to pass a specific remote bookmark to forget is a useful
feature to have, and it makes the `--include-remotes` flag be less of a
special case, since now it's basically sugar for explicitly passing all
of the remote bookmarks as arguments.
@scott2000 scott2000 force-pushed the bookmark-forget-remote branch from 7bda57d to c68b3ed Compare March 1, 2025 15:56
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.

2 participants