mirror of
https://github.com/martinvonz/jj.git
synced 2025-02-06 20:42:10 +00:00
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
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:
parent
dc16830151
commit
c82483b088
2 changed files with 13 additions and 10 deletions
|
@ -47,8 +47,9 @@ use crate::ui::Ui;
|
||||||
/// achieved with `jj new`.
|
/// achieved with `jj new`.
|
||||||
#[derive(clap::Args, Clone, Debug)]
|
#[derive(clap::Args, Clone, Debug)]
|
||||||
pub(crate) struct SplitArgs {
|
pub(crate) struct SplitArgs {
|
||||||
/// Interactively choose which parts to split. This is the default if no
|
/// Interactively choose which parts to split
|
||||||
/// paths are provided.
|
///
|
||||||
|
/// This is the default if no filesets are provided.
|
||||||
#[arg(long, short)]
|
#[arg(long, short)]
|
||||||
interactive: bool,
|
interactive: bool,
|
||||||
/// Specify diff editor to be used (implies --interactive)
|
/// Specify diff editor to be used (implies --interactive)
|
||||||
|
@ -62,16 +63,16 @@ pub(crate) struct SplitArgs {
|
||||||
)]
|
)]
|
||||||
revision: RevisionArg,
|
revision: RevisionArg,
|
||||||
/// Split the revision into two parallel revisions instead of a parent and
|
/// Split the revision into two parallel revisions instead of a parent and
|
||||||
/// child.
|
/// child
|
||||||
// TODO: Delete `--siblings` alias in jj 0.25+
|
// TODO: Delete `--siblings` alias in jj 0.25+
|
||||||
#[arg(long, short, alias = "siblings")]
|
#[arg(long, short, alias = "siblings")]
|
||||||
parallel: bool,
|
parallel: bool,
|
||||||
/// Put these paths in the first commit
|
/// Files matching any of these filesets are put in the first commit
|
||||||
#[arg(
|
#[arg(
|
||||||
value_hint = clap::ValueHint::AnyPath,
|
value_hint = clap::ValueHint::AnyPath,
|
||||||
add = ArgValueCompleter::new(complete::modified_revision_files),
|
add = ArgValueCompleter::new(complete::modified_revision_files),
|
||||||
)]
|
)]
|
||||||
paths: Vec<String>,
|
filesets: Vec<String>,
|
||||||
}
|
}
|
||||||
|
|
||||||
#[instrument(skip_all)]
|
#[instrument(skip_all)]
|
||||||
|
@ -91,12 +92,12 @@ pub(crate) fn cmd_split(
|
||||||
|
|
||||||
workspace_command.check_rewritable([commit.id()])?;
|
workspace_command.check_rewritable([commit.id()])?;
|
||||||
let matcher = workspace_command
|
let matcher = workspace_command
|
||||||
.parse_file_patterns(ui, &args.paths)?
|
.parse_file_patterns(ui, &args.filesets)?
|
||||||
.to_matcher();
|
.to_matcher();
|
||||||
let diff_selector = workspace_command.diff_selector(
|
let diff_selector = workspace_command.diff_selector(
|
||||||
ui,
|
ui,
|
||||||
args.tool.as_deref(),
|
args.tool.as_deref(),
|
||||||
args.interactive || args.paths.is_empty(),
|
args.interactive || args.filesets.is_empty(),
|
||||||
)?;
|
)?;
|
||||||
let mut tx = workspace_command.start_transaction();
|
let mut tx = workspace_command.start_transaction();
|
||||||
let end_tree = commit.tree()?;
|
let end_tree = commit.tree()?;
|
||||||
|
|
|
@ -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`.
|
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:**
|
###### **Arguments:**
|
||||||
|
|
||||||
* `<PATHS>` — Put these paths in the first commit
|
* `<FILESETS>` — Files matching any of these filesets are put in the first commit
|
||||||
|
|
||||||
###### **Options:**
|
###### **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)
|
* `--tool <NAME>` — Specify diff editor to be used (implies --interactive)
|
||||||
* `-r`, `--revision <REVISION>` — The revision to split
|
* `-r`, `--revision <REVISION>` — The revision to split
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue