From c36b720dd47caf09d68a6ab6ea65933183b06d81 Mon Sep 17 00:00:00 2001 From: Martin von Zweigbergk Date: Sun, 18 Sep 2022 14:46:12 -0700 Subject: [PATCH] cli: rename `checkout` to `working_copy` in template --- CHANGELOG.md | 3 +++ src/commands.rs | 4 ++-- src/formatter.rs | 32 ++++++++++++++++---------------- src/template_parser.rs | 4 ++-- 4 files changed, 23 insertions(+), 20 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 43d424bf5..bb08255c8 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -54,6 +54,9 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 * `jj git push` now pushes only branches pointing to the `@` by default. Use `--all` to push all branches. +* The `checkouts` template keyword is now called `working_copies`, and + `current_checkout` is called `current_working_copy`. + ### New features * The new `jj interdiff` command compares the changes in commits, ignoring diff --git a/src/commands.rs b/src/commands.rs index b66dbdb39..d058abeeb 100644 --- a/src/commands.rs +++ b/src/commands.rs @@ -3102,7 +3102,7 @@ fn log_template(settings: &UserSettings) -> String { " " label("timestamp", author.timestamp()) " " branches " " tags - " " checkouts + " " working_copies if(is_git_head, label("git_head", " HEAD@git")) if(divergent, label("divergent", " divergent")) if(conflict, label("conflict", " conflict")) @@ -3193,7 +3193,7 @@ fn cmd_log(ui: &mut Ui, command: &CommandHelper, args: &LogArgs) -> Result<(), C let writer = Box::new(&mut buffer); let mut formatter = ui.new_formatter(writer); if is_checkout { - formatter.add_label("checkout".to_string())?; + formatter.add_label("working_copy".to_string())?; } template.format(&commit, formatter.as_mut())?; if is_checkout { diff --git a/src/formatter.rs b/src/formatter.rs index 1b644ea39..8ed155f49 100644 --- a/src/formatter.rs +++ b/src/formatter.rs @@ -90,7 +90,7 @@ fn config_colors(user_settings: &UserSettings) -> HashMap { result.insert(String::from("author timestamp"), String::from("cyan")); result.insert(String::from("committer"), String::from("yellow")); result.insert(String::from("committer timestamp"), String::from("cyan")); - result.insert(String::from("checkouts"), String::from("magenta")); + result.insert(String::from("working_copies"), String::from("magenta")); result.insert(String::from("branch"), String::from("magenta")); result.insert(String::from("branches"), String::from("magenta")); result.insert(String::from("tags"), String::from("magenta")); @@ -104,63 +104,63 @@ fn config_colors(user_settings: &UserSettings) -> HashMap { // use a different background color? (We don't have support for background // colors yet.) result.insert( - String::from("checkout commit_id"), + String::from("working_copy commit_id"), String::from("bright blue"), ); result.insert( - String::from("checkout commit_id open"), + String::from("working_copy commit_id open"), String::from("bright green"), ); result.insert( - String::from("checkout change_id"), + String::from("working_copy change_id"), String::from("bright magenta"), ); result.insert( - String::from("checkout author"), + String::from("working_copy author"), String::from("bright yellow"), ); result.insert( - String::from("checkout author timestamp"), + String::from("working_copy author timestamp"), String::from("bright cyan"), ); result.insert( - String::from("checkout committer"), + String::from("working_copy committer"), String::from("bright yellow"), ); result.insert( - String::from("checkout committer timestamp"), + String::from("working_copy committer timestamp"), String::from("bright cyan"), ); result.insert( - String::from("checkout checkouts"), + String::from("working_copy working_copies"), String::from("bright magenta"), ); result.insert( - String::from("checkout branch"), + String::from("working_copy branch"), String::from("bright magenta"), ); result.insert( - String::from("checkout branches"), + String::from("working_copy branches"), String::from("bright magenta"), ); result.insert( - String::from("checkout tags"), + String::from("working_copy tags"), String::from("bright magenta"), ); result.insert( - String::from("checkout git_refs"), + String::from("working_copy git_refs"), String::from("bright magenta"), ); result.insert( - String::from("checkout divergent"), + String::from("working_copy divergent"), String::from("bright red"), ); result.insert( - String::from("checkout conflict"), + String::from("working_copy conflict"), String::from("bright red"), ); result.insert( - String::from("checkout description"), + String::from("working_copy description"), String::from("bright white"), ); diff --git a/src/template_parser.rs b/src/template_parser.rs index 6a9f87e5d..c532179b5 100644 --- a/src/template_parser.rs +++ b/src/template_parser.rs @@ -243,8 +243,8 @@ fn parse_commit_keyword<'a>( "author" => Property::Signature(Box::new(AuthorProperty)), "committer" => Property::Signature(Box::new(CommitterProperty)), "open" => Property::Boolean(Box::new(OpenProperty)), - "checkouts" => Property::String(Box::new(CheckoutsProperty { repo })), - "current_checkout" => Property::Boolean(Box::new(CurrentCheckoutProperty { + "working_copies" => Property::String(Box::new(CheckoutsProperty { repo })), + "current_working_copy" => Property::Boolean(Box::new(CurrentCheckoutProperty { repo, workspace_id: workspace_id.clone(), })),