mirror of
https://github.com/jj-vcs/jj.git
synced 2025-12-23 06:01:01 +00:00
cli: bookmark: add --remote argument to track/untrack, deprecate name@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
This commit is contained in:
parent
410bb2a69f
commit
e921791574
18 changed files with 398 additions and 174 deletions
|
|
@ -41,7 +41,7 @@ $ jj commit -m 'feat(bar): add support for bar'
|
|||
# on the working-copy commit's *parent* because the working copy itself is empty.
|
||||
$ jj bookmark create bar -r @- # `bar` now contains the previous two commits.
|
||||
# Set the bookmark to be tracked on the remote.
|
||||
$ jj bookmark track bar@origin
|
||||
$ jj bookmark track bar
|
||||
# Push the bookmark to GitHub (pushes only `bar`)
|
||||
$ jj git push
|
||||
```
|
||||
|
|
@ -76,7 +76,7 @@ $ # Do some more work.
|
|||
$ jj commit -m "Update tutorial"
|
||||
# Create a bookmark on the working-copy commit's parent
|
||||
$ jj bookmark create doc-update -r @-
|
||||
$ jj bookmark track doc-update@origin
|
||||
$ jj bookmark track doc-update
|
||||
$ jj git push
|
||||
```
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue