Skip to content

Conversation

@yuja
Copy link
Contributor

@yuja yuja commented Dec 6, 2025

Closes #4260

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

yuja added 4 commits December 6, 2025 23:04
…@remote

These two are the last commands which don't support logical operators in string
patterns. The old <kind>:<name>@<remote> syntax had various problems including:

 1. substring patterns look weird (e.g. `substring:x@y` means `*x*@*y*`)
 2. cannot express "all but <name> for all remotes" (e.g. `(~gh-pages)@(*)`)

In addition to that, the revset parser doesn't support `<name>@<remote>`
prefixed by `<kind>:`.

This patch introduces separate --remote argument to address these problems. The
default is `glob:*` (or `~git`), so we wouldn't have to specify the remote in
many cases. One caveat is that `jj bookmark track` is not idempotent if there
are multiple remotes:

    # there are two remotes: origin and upstream,
    # and only foo@origin exists
    $ jj bookmark track foo
    # tracks foo@origin and creates new local bookmark foo
    $ jj bookmark track foo
    # tracks absent foo@upstream as we now have a local bookmark

This is wild. We might want to add a flag or a new command to track absent
remote bookmarks to push.

"Unmatched names" warnings are now emitted for bookmark and remote names
separately. To keep the implementation simple, the search space isn't restricted
by the other parameter. For example, "jj bookmark track foo --remote=bar" won't
show a warning if "foo" exists locally or in any remote.

Closes #4260
@yuja yuja requested a review from a team as a code owner December 6, 2025 14:24
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.

LG with minor nit

let ignored_remote = default_ignored_remote_name(repo.store())
// suppress unmatched remotes warning for default-ignored remote
.filter(|name| view.get_remote_view(name).is_some());
let matched_refs = if args.remotes.is_none() && args.names.iter().all(|s| s.contains('@')) {
Copy link
Contributor

Choose a reason for hiding this comment

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

nit: can the args.iter().all(...) part moved into a shared helper for both track and untrack?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

You mean the let matched_refs = if ... ; block? They could be extracted to a helper function, but I think the logic will diverge later. untrack doesn't need to search "locally exists but remotely absent" bookmarks, for example.

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.

FR: jj bookmark track without needing to specify remote

2 participants