cli: make split more explicit that it uses filesets
Some checks are pending
binaries / Build binary artifacts (push) Waiting to run
nix / flake check (push) Waiting to run
build / build (, macos-13) (push) Waiting to run
build / build (, macos-14) (push) Waiting to run
build / build (, ubuntu-latest) (push) Waiting to run
build / build (, windows-latest) (push) Waiting to run
build / build (--all-features, ubuntu-latest) (push) Waiting to run
build / Build jj-lib without Git support (push) Waiting to run
build / Check protos (push) Waiting to run
build / Check formatting (push) Waiting to run
build / Check that MkDocs can build the docs (push) Waiting to run
build / Check that MkDocs can build the docs with latest Python and uv (push) Waiting to run
build / cargo-deny (advisories) (push) Waiting to run
build / cargo-deny (bans licenses sources) (push) Waiting to run
build / Clippy check (push) Waiting to run
Codespell / Codespell (push) Waiting to run
website / prerelease-docs-build-deploy (ubuntu-latest) (push) Waiting to run
Scorecards supply-chain security / Scorecards analysis (push) Waiting to run

This commit is contained in:
Matt Kulukundis 2024-12-13 18:40:58 -05:00 committed by Matt Fowles Kulukundis
parent dc16830151
commit c82483b088
2 changed files with 13 additions and 10 deletions

View file

@ -47,8 +47,9 @@ use crate::ui::Ui;
/// achieved with `jj new`.
#[derive(clap::Args, Clone, Debug)]
pub(crate) struct SplitArgs {
/// Interactively choose which parts to split. This is the default if no
/// paths are provided.
/// Interactively choose which parts to split
///
/// This is the default if no filesets are provided.
#[arg(long, short)]
interactive: bool,
/// Specify diff editor to be used (implies --interactive)
@ -62,16 +63,16 @@ pub(crate) struct SplitArgs {
)]
revision: RevisionArg,
/// Split the revision into two parallel revisions instead of a parent and
/// child.
/// child
// TODO: Delete `--siblings` alias in jj 0.25+
#[arg(long, short, alias = "siblings")]
parallel: bool,
/// Put these paths in the first commit
/// Files matching any of these filesets are put in the first commit
#[arg(
value_hint = clap::ValueHint::AnyPath,
add = ArgValueCompleter::new(complete::modified_revision_files),
)]
paths: Vec<String>,
filesets: Vec<String>,
}
#[instrument(skip_all)]
@ -91,12 +92,12 @@ pub(crate) fn cmd_split(
workspace_command.check_rewritable([commit.id()])?;
let matcher = workspace_command
.parse_file_patterns(ui, &args.paths)?
.parse_file_patterns(ui, &args.filesets)?
.to_matcher();
let diff_selector = workspace_command.diff_selector(
ui,
args.tool.as_deref(),
args.interactive || args.paths.is_empty(),
args.interactive || args.filesets.is_empty(),
)?;
let mut tx = workspace_command.start_transaction();
let end_tree = commit.tree()?;

View file

@ -2054,15 +2054,17 @@ If the change you split had a description, you will be asked to enter a change d
Splitting an empty commit is not supported because the same effect can be achieved with `jj new`.
**Usage:** `jj split [OPTIONS] [PATHS]...`
**Usage:** `jj split [OPTIONS] [FILESETS]...`
###### **Arguments:**
* `<PATHS>` — Put these paths in the first commit
* `<FILESETS>` — Files matching any of these filesets are put in the first commit
###### **Options:**
* `-i`, `--interactive` — Interactively choose which parts to split. This is the default if no paths are provided
* `-i`, `--interactive` — Interactively choose which parts to split
This is the default if no filesets are provided.
* `--tool <NAME>` — Specify diff editor to be used (implies --interactive)
* `-r`, `--revision <REVISION>` — The revision to split