From 5f7d406ffc5269c2ce57c19921340d798a4c3842 Mon Sep 17 00:00:00 2001 From: Waleed Khan Date: Tue, 29 Aug 2023 23:13:37 +0200 Subject: [PATCH] commands: add `--interactive` flag to `jj split` I am constantly explicitly running `jj split -i` because I expect the interactive flag to be there for consistency. --- CHANGELOG.md | 2 ++ cli/src/commands/mod.rs | 8 ++++++-- 2 files changed, 8 insertions(+), 2 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index a9168107d2..b564dbc163 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -33,6 +33,8 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 * jj now bundles a TUI tool to use as the default diff and merge editors. (The previous default was `meld`.) +* `jj split` supports the `--interactive` flag. + ### Fixed bugs ## [0.9.0] - 2023-09-06 diff --git a/cli/src/commands/mod.rs b/cli/src/commands/mod.rs index 201b46668a..5c7c365295 100644 --- a/cli/src/commands/mod.rs +++ b/cli/src/commands/mod.rs @@ -876,10 +876,14 @@ struct DiffeditArgs { /// asked for a description only for the first part. #[derive(clap::Args, Clone, Debug)] struct SplitArgs { + /// Interactively choose which parts to split. This is the default if no + /// paths are provided. + #[arg(long, short)] + interactive: bool, /// The revision to split #[arg(long, short, default_value = "@")] revision: RevisionArg, - /// Put these paths in the first commit and don't run the diff editor + /// Put these paths in the first commit #[arg(value_hint = clap::ValueHint::AnyPath)] paths: Vec, } @@ -3257,7 +3261,7 @@ fn cmd_split(ui: &mut Ui, command: &CommandHelper, args: &SplitArgs) -> Result<( workspace_command.start_transaction(&format!("split commit {}", commit.id().hex())); let end_tree = commit.tree()?; let base_tree = merge_commit_trees(tx.repo(), &commit.parents())?; - let interactive = args.paths.is_empty(); + let interactive = args.interactive || args.paths.is_empty(); let instructions = format!( "\ You are splitting a commit in two: {}