Skip to content

Commit

Permalink
cli: rename jj debug working-copy to jj debug local-working-copy
Browse files Browse the repository at this point in the history
I'd like to add a more generic `jj debug working-copy` command that
prints the information that's shared across implementations.
  • Loading branch information
martinvonz committed Jun 28, 2024
1 parent 5abc87f commit ea5a6f0
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 12 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -22,14 +22,14 @@ use crate::cli_util::CommandHelper;
use crate::command_error::CommandError;
use crate::ui::Ui;

/// Show information about the working copy state
/// Show information about the local working copy state
#[derive(clap::Args, Clone, Debug)]
pub struct WorkingCopyArgs {}
pub struct LocalWorkingCopyArgs {}

pub fn cmd_debug_working_copy(
pub fn cmd_debug_local_working_copy(
ui: &mut Ui,
command: &CommandHelper,
_args: &WorkingCopyArgs,
_args: &LocalWorkingCopyArgs,
) -> Result<(), CommandError> {
let workspace_command = command.workspace_helper(ui)?;
let wc = check_local_disk_wc(workspace_command.working_copy().as_any())?;
Expand Down
8 changes: 4 additions & 4 deletions cli/src/commands/debug/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ pub mod snapshot;
pub mod template;
pub mod tree;
pub mod watchman;
pub mod working_copy;
pub mod local_working_copy;

use std::any::Any;
use std::fmt::Debug;
Expand All @@ -38,7 +38,7 @@ use self::snapshot::{cmd_debug_snapshot, SnapshotArgs};
use self::template::{cmd_debug_template, TemplateArgs};
use self::tree::{cmd_debug_tree, TreeArgs};
use self::watchman::{cmd_debug_watchman, WatchmanCommand};
use self::working_copy::{cmd_debug_working_copy, WorkingCopyArgs};
use self::local_working_copy::{cmd_debug_local_working_copy, LocalWorkingCopyArgs};
use crate::cli_util::CommandHelper;
use crate::command_error::{user_error, CommandError};
use crate::ui::Ui;
Expand All @@ -49,6 +49,7 @@ use crate::ui::Ui;
pub enum DebugCommand {
Fileset(FilesetArgs),
Index(IndexArgs),
LocalWorkingCopy(LocalWorkingCopyArgs),
#[command(visible_alias = "view")]
Operation(OperationArgs),
Reindex(ReindexArgs),
Expand All @@ -58,7 +59,6 @@ pub enum DebugCommand {
Tree(TreeArgs),
#[command(subcommand)]
Watchman(WatchmanCommand),
WorkingCopy(WorkingCopyArgs),
}

pub fn cmd_debug(
Expand All @@ -69,14 +69,14 @@ pub fn cmd_debug(
match subcommand {
DebugCommand::Fileset(args) => cmd_debug_fileset(ui, command, args),
DebugCommand::Index(args) => cmd_debug_index(ui, command, args),
DebugCommand::LocalWorkingCopy(args) => cmd_debug_local_working_copy(ui, command, args),
DebugCommand::Operation(args) => cmd_debug_operation(ui, command, args),
DebugCommand::Reindex(args) => cmd_debug_reindex(ui, command, args),
DebugCommand::Revset(args) => cmd_debug_revset(ui, command, args),
DebugCommand::Snapshot(args) => cmd_debug_snapshot(ui, command, args),
DebugCommand::Template(args) => cmd_debug_template(ui, command, args),
DebugCommand::Tree(args) => cmd_debug_tree(ui, command, args),
DebugCommand::Watchman(args) => cmd_debug_watchman(ui, command, args),
DebugCommand::WorkingCopy(args) => cmd_debug_working_copy(ui, command, args),
}
}

Expand Down
8 changes: 4 additions & 4 deletions cli/tests/test_operations.rs
Original file line number Diff line number Diff line change
Expand Up @@ -381,7 +381,7 @@ fn test_op_abandon_ancestors() {
Abandoned 3 operations and reparented 1 descendant operations.
"###);
insta::assert_snapshot!(
test_env.jj_cmd_success(&repo_path, &["debug", "working-copy", "--ignore-working-copy"]), @r###"
test_env.jj_cmd_success(&repo_path, &["debug", "local-working-copy", "--ignore-working-copy"]), @r###"
Current operation: OperationId("10e856d0579c4aca88972ffea0a515f47f8c09dceaa2b1a5d531c83b04350f7aa64a3eff422def01eebd65df26089ef5e0f925f247a8f929c8cc858d16306e53")
Current tree: Merge(Resolved(TreeId("4b825dc642cb6eb9a060e54bf8d69288fbee4904")))
"###);
Expand Down Expand Up @@ -430,7 +430,7 @@ fn test_op_abandon_ancestors() {
Abandoned 1 operations and reparented 1 descendant operations.
"###);
insta::assert_snapshot!(
test_env.jj_cmd_success(&repo_path, &["debug", "working-copy", "--ignore-working-copy"]), @r###"
test_env.jj_cmd_success(&repo_path, &["debug", "local-working-copy", "--ignore-working-copy"]), @r###"
Current operation: OperationId("445e93662d714f53fb97e450eb3793a8e1a9a4cca1e329d5a9096e65085fb96d5bb51659531145c8abf0db5da803cd11c4cecdcf9025391bc97fc6a42204a0fe")
Current tree: Merge(Resolved(TreeId("4b825dc642cb6eb9a060e54bf8d69288fbee4904")))
"###);
Expand Down Expand Up @@ -475,7 +475,7 @@ fn test_op_abandon_without_updating_working_copy() {
Abandoned 1 operations and reparented 1 descendant operations.
"###);
insta::assert_snapshot!(
test_env.jj_cmd_success(&repo_path, &["debug", "working-copy", "--ignore-working-copy"]), @r###"
test_env.jj_cmd_success(&repo_path, &["debug", "local-working-copy", "--ignore-working-copy"]), @r###"
Current operation: OperationId("61aeade2493b190412c61b9b0711025c2cccf95966870a5f7dc2e34ab313fbef64da70d00cab2cd69ad39816faeb80a6bc866927549b84dce6cb5a437e0e515b")
Current tree: Merge(Resolved(TreeId("4b825dc642cb6eb9a060e54bf8d69288fbee4904")))
"###);
Expand All @@ -495,7 +495,7 @@ fn test_op_abandon_without_updating_working_copy() {
Warning: The working copy operation 61aeade2493b is not updated because it differs from the repo ae6364994418.
"###);
insta::assert_snapshot!(
test_env.jj_cmd_success(&repo_path, &["debug", "working-copy", "--ignore-working-copy"]), @r###"
test_env.jj_cmd_success(&repo_path, &["debug", "local-working-copy", "--ignore-working-copy"]), @r###"
Current operation: OperationId("61aeade2493b190412c61b9b0711025c2cccf95966870a5f7dc2e34ab313fbef64da70d00cab2cd69ad39816faeb80a6bc866927549b84dce6cb5a437e0e515b")
Current tree: Merge(Resolved(TreeId("4b825dc642cb6eb9a060e54bf8d69288fbee4904")))
"###);
Expand Down

0 comments on commit ea5a6f0

Please sign in to comment.