From 78f57d68d55b16c122b9dbcee513e63f174476de Mon Sep 17 00:00:00 2001 From: Yuya Nishihara Date: Tue, 2 Apr 2024 15:53:20 +0900 Subject: [PATCH] cli: unblock "branch list --all-remotes" with name patterns Like -r/--revisions, it should be okay to filter synced/non-tracking remote branches by name. conflicts_with_all = "tracked" is redundant, so removed as well. The tracked field declares that it conflicts with --all-remotes. --- CHANGELOG.md | 2 +- cli/src/commands/branch.rs | 2 +- cli/tests/test_branch_command.rs | 5 +++++ 3 files changed, 7 insertions(+), 2 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index f64bce337b..98d7f2bd60 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -54,7 +54,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 * `jj duplicate` and `jj abandon` can now take more than a single `-r` argument, for consistency with other commands. -* `jj branch list` now allows combining `-r` and `-a` options. +* `jj branch list` now allows combining `-r REVISIONS`/`NAMES` and `-a` options. * `--all` is now named `--all-remotes` for `jj branch list` diff --git a/cli/src/commands/branch.rs b/cli/src/commands/branch.rs index 48cb3464ed..7892fbc96b 100644 --- a/cli/src/commands/branch.rs +++ b/cli/src/commands/branch.rs @@ -97,7 +97,7 @@ pub struct BranchDeleteArgs { pub struct BranchListArgs { /// Show all tracking and non-tracking remote branches including the ones /// whose targets are synchronized with the local branches. - #[arg(long, short, alias = "all", conflicts_with_all = ["names", "tracked"])] + #[arg(long, short, alias = "all")] all_remotes: bool, /// Show remote tracked branches only. Omits local Git-tracking branches by diff --git a/cli/tests/test_branch_command.rs b/cli/tests/test_branch_command.rs index aaf734c6bb..eae3312b5d 100644 --- a/cli/tests/test_branch_command.rs +++ b/cli/tests/test_branch_command.rs @@ -1130,6 +1130,11 @@ fn test_branch_list_filtered() { // Select branches by name, combined with --all-remotes test_env.jj_cmd_ok(&local_path, &["git", "export"]); + insta::assert_snapshot!(query(&["--all-remotes", "remote-rewrite"]), @r###" + remote-rewrite: xyxluytn e31634b6 (empty) rewritten + @git: xyxluytn e31634b6 (empty) rewritten + @origin (ahead by 1 commits, behind by 1 commits): xyxluytn hidden 3e9a5af6 (empty) remote-rewrite + "###); insta::assert_snapshot!(query(&["--all-remotes", "-rbranches(remote-rewrite)"]), @r###" remote-rewrite: xyxluytn e31634b6 (empty) rewritten @git: xyxluytn e31634b6 (empty) rewritten