forked from mirrors/jj
cli: Suggest jj backout
or jj restore
in place of jj revert
This commit is contained in:
parent
78cdc0843a
commit
2526620f82
1 changed files with 14 additions and 1 deletions
|
@ -62,7 +62,7 @@ use clap::{Command, CommandFactory, FromArgMatches, Subcommand};
|
|||
use itertools::Itertools;
|
||||
use tracing::instrument;
|
||||
|
||||
use crate::cli_util::{Args, CommandError, CommandHelper};
|
||||
use crate::cli_util::{user_error_with_hint, Args, CommandError, CommandHelper};
|
||||
use crate::ui::Ui;
|
||||
|
||||
#[derive(clap::Parser, Clone, Debug)]
|
||||
|
@ -115,6 +115,11 @@ enum Commands {
|
|||
Rebase(rebase::RebaseArgs),
|
||||
Resolve(resolve::ResolveArgs),
|
||||
Restore(restore::RestoreArgs),
|
||||
#[command(
|
||||
hide = true,
|
||||
help_template = "Not a real subcommand; consider `jj backout` or `jj restore`"
|
||||
)]
|
||||
Revert,
|
||||
#[command(hide = true)]
|
||||
// TODO: Flesh out.
|
||||
Run(run::RunArgs),
|
||||
|
@ -176,6 +181,7 @@ pub fn run_command(ui: &mut Ui, command_helper: &CommandHelper) -> Result<(), Co
|
|||
Commands::Squash(sub_args) => squash::cmd_squash(ui, command_helper, sub_args),
|
||||
Commands::Unsquash(sub_args) => unsquash::cmd_unsquash(ui, command_helper, sub_args),
|
||||
Commands::Restore(sub_args) => restore::cmd_restore(ui, command_helper, sub_args),
|
||||
Commands::Revert => revert(),
|
||||
Commands::Run(sub_args) => run::cmd_run(ui, command_helper, sub_args),
|
||||
Commands::Diffedit(sub_args) => diffedit::cmd_diffedit(ui, command_helper, sub_args),
|
||||
Commands::Split(sub_args) => split::cmd_split(ui, command_helper, sub_args),
|
||||
|
@ -197,6 +203,13 @@ pub fn run_command(ui: &mut Ui, command_helper: &CommandHelper) -> Result<(), Co
|
|||
}
|
||||
}
|
||||
|
||||
fn revert() -> Result<(), CommandError> {
|
||||
Err(user_error_with_hint(
|
||||
"No such subcommand",
|
||||
"Consider `jj backout` or `jj restore`",
|
||||
))
|
||||
}
|
||||
|
||||
#[cfg(test)]
|
||||
mod tests {
|
||||
use super::*;
|
||||
|
|
Loading…
Reference in a new issue