ok/jj
1
0
Fork 0
forked from mirrors/jj

cli branch track, branch untrack: document remote branches in jj help

This tries to clarify the fact that the branches must be remote and the syntax
for specifying them as globs.

Cc @yuja, https://github.com/martinvonz/jj/pull/2625#discussion_r1423379351

Here is the result (excerpt):

```
$ jj branch track --help
Start tracking given remote branches

A tracking remote branch will be imported as a local branch of the same name. Changes to it
will propagate to the existing local branch on future pulls.

Usage: jj branch track [OPTIONS] <BRANCH@REMOTE>...

Arguments:
  <BRANCH@REMOTE>...
          Remote branches to track

          By default, the specified name matches exactly. Use `glob:` prefix to select
          branches by wildcard pattern. For details, see
          https://github.com/martinvonz/jj/blob/main/docs/revsets.md#string-patterns.

          Examples: branch@remote, glob:main@*, glob:jjfan-*@upstream
```
This commit is contained in:
Ilya Grigoriev 2023-12-11 22:00:03 -08:00
parent ab2742f2c9
commit 872a94d1c5
2 changed files with 7 additions and 3 deletions

View file

@ -150,7 +150,9 @@ pub struct BranchTrackArgs {
/// By default, the specified name matches exactly. Use `glob:` prefix to
/// select branches by wildcard pattern. For details, see
/// https://github.com/martinvonz/jj/blob/main/docs/revsets.md#string-patterns.
#[arg(required = true)]
///
/// Examples: branch@remote, glob:main@*, glob:jjfan-*@upstream
#[arg(required = true, value_name = "BRANCH@REMOTE")]
pub names: Vec<RemoteBranchNamePattern>,
}
@ -165,7 +167,9 @@ pub struct BranchUntrackArgs {
/// By default, the specified name matches exactly. Use `glob:` prefix to
/// select branches by wildcard pattern. For details, see
/// https://github.com/martinvonz/jj/blob/main/docs/revsets.md#string-patterns.
#[arg(required = true)]
///
/// Examples: branch@remote, glob:main@*, glob:jjfan-*@upstream
#[arg(required = true, value_name = "BRANCH@REMOTE")]
pub names: Vec<RemoteBranchNamePattern>,
}

View file

@ -812,7 +812,7 @@ fn test_branch_track_untrack_patterns() {
test_env.jj_cmd_ok(&repo_path, &["branch", "create", "main"]);
insta::assert_snapshot!(
test_env.jj_cmd_cli_error(&repo_path, &["branch", "track", "main"]), @r###"
error: invalid value 'main' for '<NAMES>...': remote branch must be specified in branch@remote form
error: invalid value 'main' for '<BRANCH@REMOTE>...': remote branch must be specified in branch@remote form
For more information, try '--help'.
"###);