mirror of
https://github.com/martinvonz/jj.git
synced 2024-12-03 21:08:27 +00:00
jj debug operation
: Create a debug view
alias, arguments that determine what to show
This commit is contained in:
parent
d654a9e163
commit
7c24e7bfe7
1 changed files with 19 additions and 2 deletions
|
@ -944,6 +944,7 @@ enum DebugCommands {
|
||||||
Index(DebugIndexArgs),
|
Index(DebugIndexArgs),
|
||||||
#[command(name = "reindex")]
|
#[command(name = "reindex")]
|
||||||
ReIndex(DebugReIndexArgs),
|
ReIndex(DebugReIndexArgs),
|
||||||
|
#[command(visible_alias = "view")]
|
||||||
Operation(DebugOperationArgs),
|
Operation(DebugOperationArgs),
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -976,6 +977,18 @@ struct DebugReIndexArgs {}
|
||||||
struct DebugOperationArgs {
|
struct DebugOperationArgs {
|
||||||
#[arg(default_value = "@")]
|
#[arg(default_value = "@")]
|
||||||
operation: String,
|
operation: String,
|
||||||
|
#[arg(long, value_enum, default_value = "all")]
|
||||||
|
display: DebugOperationDisplay,
|
||||||
|
}
|
||||||
|
|
||||||
|
#[derive(Copy, Clone, Debug, PartialEq, Eq, PartialOrd, Ord, clap::ValueEnum)]
|
||||||
|
enum DebugOperationDisplay {
|
||||||
|
/// Show only the operation details.
|
||||||
|
Operation,
|
||||||
|
/// Show only the view details
|
||||||
|
View,
|
||||||
|
/// Show both the view and the operation
|
||||||
|
All,
|
||||||
}
|
}
|
||||||
|
|
||||||
fn add_to_git_exclude(ui: &mut Ui, git_repo: &git2::Repository) -> Result<(), CommandError> {
|
fn add_to_git_exclude(ui: &mut Ui, git_repo: &git2::Repository) -> Result<(), CommandError> {
|
||||||
|
@ -3200,10 +3213,14 @@ fn cmd_debug(
|
||||||
DebugCommands::Operation(operation_args) => {
|
DebugCommands::Operation(operation_args) => {
|
||||||
let workspace_command = command.workspace_helper(ui)?;
|
let workspace_command = command.workspace_helper(ui)?;
|
||||||
let op = workspace_command.resolve_single_op(&operation_args.operation)?;
|
let op = workspace_command.resolve_single_op(&operation_args.operation)?;
|
||||||
|
if operation_args.display != DebugOperationDisplay::View {
|
||||||
writeln!(ui, "{:#?}", op.store_operation())?;
|
writeln!(ui, "{:#?}", op.store_operation())?;
|
||||||
|
}
|
||||||
|
if operation_args.display != DebugOperationDisplay::Operation {
|
||||||
writeln!(ui, "{:#?}", op.view().store_view())?;
|
writeln!(ui, "{:#?}", op.view().store_view())?;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
Ok(())
|
Ok(())
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue