forked from mirrors/jj
commands: add --interactive
flag to jj split
`jj split` with no arguments operates interactively, but I am nonetheless constantly running `jj split -i` because I expect an `--interactive` flag to exist for consistency. However, `jj split <paths>` before this commit always operates non-interactively, so this commit has the nice practical effect that you can restrict your interactive splitting to a certain set of paths.
This commit is contained in:
parent
f0f1d72cf3
commit
d91dcc0c78
2 changed files with 9 additions and 2 deletions
|
@ -38,6 +38,9 @@ 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. (This is already the default if
|
||||
no paths are provided.)
|
||||
|
||||
### Fixed bugs
|
||||
|
||||
## [0.9.0] - 2023-09-06
|
||||
|
|
|
@ -877,10 +877,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<String>,
|
||||
}
|
||||
|
@ -3255,7 +3259,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: {}
|
||||
|
|
Loading…
Reference in a new issue