From ddb6e1b9546864fb463913828104e5e8e944917f Mon Sep 17 00:00:00 2001 From: Vamsi Avula Date: Thu, 7 Sep 2023 10:18:04 +0530 Subject: [PATCH] cli: label working copies when writing commit summaries --- cli/src/cli_util.rs | 4 +++- cli/src/commands/mod.rs | 9 ++++++--- 2 files changed, 9 insertions(+), 4 deletions(-) diff --git a/cli/src/cli_util.rs b/cli/src/cli_util.rs index 30602e5d13..c73ac8e141 100644 --- a/cli/src/cli_util.rs +++ b/cli/src/cli_util.rs @@ -1369,7 +1369,9 @@ See https://github.com/martinvonz/jj/blob/main/docs/working-copy.md#stale-workin )?; if Some(&new_commit) != maybe_old_commit { ui.write("Working copy now at: ")?; - self.write_commit_summary(ui.stdout_formatter().as_mut(), &new_commit)?; + ui.stdout_formatter().with_label("working_copy", |fmt| { + self.write_commit_summary(fmt, &new_commit) + })?; ui.write("\n")?; for parent in new_commit.parents() { // "Working copy now at: " diff --git a/cli/src/commands/mod.rs b/cli/src/commands/mod.rs index cc2073f95c..349a9aafef 100644 --- a/cli/src/commands/mod.rs +++ b/cli/src/commands/mod.rs @@ -1598,7 +1598,9 @@ fn cmd_status( } formatter.write_str("Working copy : ")?; - workspace_command.write_commit_summary(formatter, wc_commit)?; + formatter.with_label("working_copy", |fmt| { + workspace_command.write_commit_summary(fmt, wc_commit) + })?; formatter.write_str("\n")?; for parent in wc_commit.parents() { formatter.write_str("Parent commit: ")?; @@ -3822,8 +3824,9 @@ fn cmd_workspace_update_stale( })?; locked_wc.finish(repo.op_id().clone())?; ui.write("Working copy now at: ")?; - workspace_command - .write_commit_summary(ui.stdout_formatter().as_mut(), &desired_wc_commit)?; + ui.stdout_formatter().with_label("working_copy", |fmt| { + workspace_command.write_commit_summary(fmt, &desired_wc_commit) + })?; ui.write("\n")?; print_checkout_stats(ui, stats)?; }