Skip to content

Commit

Permalink
cli: show stats if multiple branches are tracked/untracked
Browse files Browse the repository at this point in the history
Just like the other branch commands.
  • Loading branch information
yuja committed Oct 21, 2023
1 parent d405c26 commit c011ce8
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 1 deletion.
14 changes: 14 additions & 0 deletions cli/src/commands/branch.rs
Original file line number Diff line number Diff line change
Expand Up @@ -496,6 +496,13 @@ fn cmd_branch_track(
.track_remote_branch(&name.branch, &name.remote);
}
tx.finish(ui)?;
if names.len() > 1 {
writeln!(
ui.stderr(),
"Started tracking {} remote branches.",
names.len()
)?;
}
Ok(())
}

Expand Down Expand Up @@ -527,6 +534,13 @@ fn cmd_branch_untrack(
.untrack_remote_branch(&name.branch, &name.remote);
}
tx.finish(ui)?;
if names.len() > 1 {
writeln!(
ui.stderr(),
"Stopped tracking {} remote branches.",
names.len()
)?;
}
Ok(())
}

Expand Down
4 changes: 3 additions & 1 deletion cli/tests/test_branch_command.rs
Original file line number Diff line number Diff line change
Expand Up @@ -778,7 +778,9 @@ fn test_branch_track_untrack_patterns() {

// Track by pattern
let (_, stderr) = test_env.jj_cmd_ok(&repo_path, &["branch", "track", "glob:feature?@origin"]);
insta::assert_snapshot!(stderr, @"");
insta::assert_snapshot!(stderr, @r###"
Started tracking 2 remote branches.
"###);
insta::assert_snapshot!(get_branch_output(&test_env, &repo_path), @r###"
feature1: omvolwpu 1336caed commit
@git: omvolwpu 1336caed commit
Expand Down

0 comments on commit c011ce8

Please sign in to comment.