-
Notifications
You must be signed in to change notification settings - Fork 349
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
This also does two cosmetic changes, changing `jobs` from a plain usize to a Option<usize> and making execute a no-op boolean, like `-r` in describe. It also contains a minor documentation update to match newer `jj` features and a fix to the `pre-submit` invocation. While we're at it, teach it to resolve the passed Revsets.
- Loading branch information
1 parent
02f7282
commit 6e1977e
Showing
2 changed files
with
68 additions
and
23 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,42 @@ | ||
//! This file contains the internals of the `run` command. | ||
use crate::cli_util::{ | ||
resolve_multiple_nonempty_revsets, user_error, CommandError, CommandHelper, RevisionArg, | ||
}; | ||
use crate::ui::Ui; | ||
|
||
/// Run a command across a set of revisions. | ||
/// | ||
/// | ||
/// All recorded state will be persisted in the `.jj` directory, so occasionally | ||
/// a `jj run --clean` is needed to clean up disk space. | ||
/// | ||
/// # Example | ||
/// | ||
/// # Run pre-commit on your local work | ||
/// $ jj run 'pre-commit run .github/pre-commit.yaml' -r (trunk()..@) -j 4 | ||
/// | ||
/// This allows pre-commit integration and other funny stuff. | ||
#[derive(clap::Args, Clone, Debug)] | ||
#[command(verbatim_doc_comment)] | ||
pub struct RunArgs { | ||
/// The command to run across all selected revisions. | ||
shell_command: String, | ||
/// A no-op option to match the interface of `git bisect -x`. | ||
#[arg(long, short, alias = "x")] | ||
command: bool, | ||
/// The revisions to change. | ||
/// Multiple revsets are accepted and the work will be done on a | ||
/// intersection of them. | ||
#[arg(long, short, default_value = "@")] | ||
revisions: Vec<RevisionArg>, | ||
/// How many processes should run in parallel, uses by default all cores. | ||
#[arg(long, short)] | ||
jobs: Option<usize>, | ||
} | ||
|
||
pub fn cmd_run(ui: &mut Ui, command: &CommandHelper, args: &RunArgs) -> Result<(), CommandError> { | ||
let workspace_command = command.workspace_helper(ui)?; | ||
let _resolved_commits = | ||
resolve_multiple_nonempty_revsets(&args.revisions, &workspace_command, ui)?; | ||
Err(user_error("This is a stub, do not use")) | ||
} |