Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 1 addition & 2 deletions atomic-cli/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -772,8 +772,7 @@ atomic apply preview feature --to-stack main
|--------|-------------|
| `--to-stack <NAME>` | Target stack (default: current) |
| `--from-stack <NAME>` | Source stack |
| `--deps` | Automatically apply dependencies (default: true) |
| `--allow-conflicts` | Proceed even if conflicts arise |
| `--allow-conflicts` | Proceed even if conflicts arise (not available for `pick`) |

---

Expand Down
13 changes: 0 additions & 13 deletions atomic-cli/src/commands/change/command.rs
Original file line number Diff line number Diff line change
Expand Up @@ -60,12 +60,6 @@ pub struct ChangeCmd {
#[arg(long = "show-deps")]
pub show_deps: bool,

/// Show graph_op details.
///
/// When enabled, shows detailed information about each graph_op.
#[arg(long = "show-hunks")]
pub show_hunks: bool,

/// Show full hashes instead of abbreviated.
#[arg(long = "full-hash")]
pub full_hash: bool,
Expand Down Expand Up @@ -94,7 +88,6 @@ impl ChangeCmd {
view: None,
format: ChangeFormat::Default,
show_deps: false,
show_hunks: false,
full_hash: false,
show_attest: false,
show_provenance: false,
Expand Down Expand Up @@ -125,12 +118,6 @@ impl ChangeCmd {
self
}

/// Builder: set show-hunks flag.
pub fn with_show_hunks(mut self, show_hunks: bool) -> Self {
self.show_hunks = show_hunks;
self
}

/// Builder: set full-hash flag.
pub fn with_full_hash(mut self, full_hash: bool) -> Self {
self.full_hash = full_hash;
Expand Down
1 change: 0 additions & 1 deletion atomic-cli/src/commands/change/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,6 @@
//! --view <NAME> View to use for sequence lookup (default: current)
//! -f, --format <FORMAT> Output format (default, short, json)
//! --show-deps Show dependency details
//! --show-hunks Show graph_op details
//! -h, --help Print help information
//! ```
//!
Expand Down
23 changes: 0 additions & 23 deletions atomic-cli/src/commands/change/tests.rs
Original file line number Diff line number Diff line change
Expand Up @@ -199,7 +199,6 @@ mod tests {
assert!(cmd.view.is_none());
assert_eq!(cmd.format, ChangeFormat::Default);
assert!(!cmd.show_deps);
assert!(!cmd.show_hunks);
assert!(!cmd.full_hash);
}

Expand Down Expand Up @@ -240,12 +239,6 @@ mod tests {
assert!(cmd.show_deps);
}

#[test]
fn test_change_cmd_with_show_hunks() {
let cmd = ChangeCmd::new().with_show_hunks(true);
assert!(cmd.show_hunks);
}

#[test]
fn test_change_cmd_with_full_hash() {
let cmd = ChangeCmd::new().with_full_hash(true);
Expand All @@ -259,14 +252,12 @@ mod tests {
.with_view("main")
.with_format(ChangeFormat::Short)
.with_show_deps(true)
.with_show_hunks(true)
.with_full_hash(true);

assert_eq!(cmd.identifier, Some("ABC123".to_string()));
assert_eq!(cmd.view, Some("main".to_string()));
assert_eq!(cmd.format, ChangeFormat::Short);
assert!(cmd.show_deps);
assert!(cmd.show_hunks);
assert!(cmd.full_hash);
}

Expand Down Expand Up @@ -644,20 +635,6 @@ mod tests {
assert!(result.is_err());
}

#[test]
#[serial]
fn test_change_run_with_show_hunks() {
let _guard = TestGuard::new();

let _repo = Repository::init(".").unwrap();

let cmd = ChangeCmd::new().with_show_hunks(true);
let result = cmd.run();

// Will fail (no changes) but shouldn't panic
assert!(result.is_err());
}

// Debug and Clone Tests

#[test]
Expand Down
16 changes: 0 additions & 16 deletions atomic-cli/src/commands/diff/command.rs
Original file line number Diff line number Diff line change
Expand Up @@ -63,14 +63,6 @@ pub struct Diff {
#[arg(long)]
pub untracked: bool,

/// Show staged changes (reserved for future use).
#[arg(long, hide = true)]
pub cached: bool,

/// View to compare against.
#[arg(long)]
pub view: Option<String>,

/// Enable token-level diff highlighting (CRDT-powered).
///
/// Shows exactly which tokens changed within a line, not just
Expand All @@ -93,8 +85,6 @@ impl Diff {
name_status: false,
short: false,
untracked: false,
cached: false,
view: None,
word_diff: false,
}
}
Expand Down Expand Up @@ -151,12 +141,6 @@ impl Diff {
self
}

/// Builder: set the view to compare against.
pub fn with_view(mut self, view: impl Into<String>) -> Self {
self.view = Some(view.into());
self
}

/// Builder: set the word-diff flag.
pub fn with_word_diff(mut self, word_diff: bool) -> Self {
self.word_diff = word_diff;
Expand Down
1 change: 0 additions & 1 deletion atomic-cli/src/commands/diff/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,6 @@
//! --stat Show diffstat summary only
//! --no-color Disable colored output
//! --word-diff Enable token-level diff highlighting
//! --cached Show staged changes (not yet implemented)
//! --name-only Show only names of changed files
//! --name-status Show names and status of changed files
//! -h, --help Print help information
Expand Down
8 changes: 0 additions & 8 deletions atomic-cli/src/commands/diff/tests.rs
Original file line number Diff line number Diff line change
Expand Up @@ -596,8 +596,6 @@ mod tests {
assert!(!diff.no_color);
assert!(!diff.name_only);
assert!(!diff.name_status);
assert!(!diff.cached);
assert!(diff.view.is_none());
}

#[test]
Expand Down Expand Up @@ -934,12 +932,6 @@ mod tests {
assert!(diff.name_status);
}

#[test]
fn test_diff_with_view() {
let diff = Diff::new().with_view("feature");
assert_eq!(diff.view, Some("feature".to_string()));
}

#[test]
fn test_diff_builder_chain() {
let diff = Diff::new()
Expand Down
33 changes: 11 additions & 22 deletions atomic-cli/src/commands/identity/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -270,14 +270,17 @@ pub struct Default {
#[arg(long, short = 'u')]
pub usage: Option<String>,

/// Clear the default identity instead of setting one.
#[arg(long, conflicts_with = "name")]
/// Clear the global default identity instead of setting one.
///
/// Clearing a usage-specific default is not supported, so --clear
/// cannot be combined with --usage.
#[arg(long, conflicts_with_all = ["name", "usage"])]
pub clear: bool,
}

impl Command for Default {
fn run(&self) -> CliResult<()> {
use crate::output::{print_success, print_warning};
use crate::output::print_success;
use atomic_identity::{IdentityStore, IdentityUsage};

let mut store = IdentityStore::open_default().map_err(|e| {
Expand All @@ -288,25 +291,11 @@ impl Command for Default {
})?;

if self.clear {
// Clear the default
if let Some(usage_str) = &self.usage {
let usage = IdentityUsage::parse(usage_str);
// Clear usage-specific default by setting global default
// Note: The store doesn't have a clear_default_for_usage method yet
// For now, we just inform the user
print_warning(&format!(
"Clearing default for usage '{}' is not yet supported",
usage
));
} else {
store.clear_default().map_err(|e| {
crate::error::CliError::Internal(anyhow::anyhow!(
"Failed to clear default: {}",
e
))
})?;
print_success("Cleared default identity");
}
// Clear the global default (--clear conflicts with --usage in clap)
store.clear_default().map_err(|e| {
crate::error::CliError::Internal(anyhow::anyhow!("Failed to clear default: {}", e))
})?;
print_success("Cleared default identity");
} else if let Some(name) = &self.name {
// Load the identity by name
let identity = store
Expand Down
49 changes: 8 additions & 41 deletions atomic-cli/src/commands/insert.rs
Original file line number Diff line number Diff line change
Expand Up @@ -41,10 +41,6 @@ pub struct Insert {
#[arg(long)]
view: Option<String>,

/// Insert dependencies automatically.
#[arg(long, default_value = "true")]
deps: bool,

/// Allow conflicts during insert.
#[arg(long)]
allow_conflicts: bool,
Expand Down Expand Up @@ -85,10 +81,6 @@ pub struct FromViewArgs {
#[arg(long)]
to_view: Option<String>,

/// Insert dependencies automatically.
#[arg(long, default_value = "true")]
deps: bool,

/// Allow conflicts during insert.
#[arg(long)]
allow_conflicts: bool,
Expand All @@ -113,10 +105,6 @@ pub struct TagArgs {
#[arg(long)]
to_view: Option<String>,

/// Insert dependencies automatically.
#[arg(long, default_value = "true")]
deps: bool,

/// Allow conflicts during insert.
#[arg(long)]
allow_conflicts: bool,
Expand All @@ -136,14 +124,6 @@ pub struct PickArgs {
/// Target view to insert changes into (default: current view).
#[arg(long)]
to_view: Option<String>,

/// Insert dependencies automatically.
#[arg(long, default_value = "true")]
deps: bool,

/// Allow conflicts during insert.
#[arg(long)]
allow_conflicts: bool,
}

/// Arguments for previewing what would be inserted.
Expand Down Expand Up @@ -196,7 +176,7 @@ fn run_single_insert(repo: &Repository, change_str: &str, args: &Insert) -> CliR
let is_current_view = args.view.is_none() || args.view.as_deref() == Some(repo.current_view());

let options = InsertOptions::default()
.apply_deps(args.deps)
.apply_deps(true)
.allow_conflict(args.allow_conflicts);

let options = if let Some(ref view) = args.view {
Expand All @@ -207,14 +187,11 @@ fn run_single_insert(repo: &Repository, change_str: &str, args: &Insert) -> CliR

output::print_info(&format!("Inserting change {}...", format_hash(&hash, true)));

let outcome = if args.deps {
repo.insert_change_rec(&hash, options)
} else {
repo.insert_change(&hash, options)
}
.map_err(|e| CliError::Conflict {
description: e.to_string(),
})?;
let outcome = repo
.insert_change_rec(&hash, options)
.map_err(|e| CliError::Conflict {
description: e.to_string(),
})?;

print_insert_outcome(
&outcome.stats.applied_hashes,
Expand Down Expand Up @@ -250,7 +227,7 @@ fn run_from_view(repo: &Repository, args: &FromViewArgs) -> CliResult<()> {
));

let options = CrossViewInsertOptions::new(&args.from_view, &to_view)
.with_dependencies(args.deps)
.with_dependencies(true)
.allow_conflicts(args.allow_conflicts)
.dry_run(args.dry_run);

Expand Down Expand Up @@ -323,7 +300,7 @@ fn run_tag(repo: &Repository, args: &TagArgs) -> CliResult<()> {

let options = CrossViewInsertOptions::new(&from_view, &to_view)
.up_to_tag(&args.tag_name)
.with_dependencies(args.deps)
.with_dependencies(true)
.allow_conflicts(args.allow_conflicts)
.dry_run(args.dry_run);

Expand Down Expand Up @@ -587,7 +564,6 @@ mod tests {
let _ = InsertSubcommand::FromView(FromViewArgs {
from_view: "feature".to_string(),
to_view: Some("main".to_string()),
deps: true,
allow_conflicts: false,
dry_run: false,
});
Expand All @@ -596,16 +572,13 @@ mod tests {
tag_name: "v1.0.0".to_string(),
from_view: Some("feature".to_string()),
to_view: Some("main".to_string()),
deps: true,
allow_conflicts: false,
dry_run: false,
});

let _ = InsertSubcommand::Pick(PickArgs {
changes: vec!["abc123".to_string()],
to_view: None,
deps: true,
allow_conflicts: false,
});

let _ = InsertSubcommand::Preview(PreviewArgs {
Expand All @@ -620,14 +593,12 @@ mod tests {
let args = FromViewArgs {
from_view: "feature".to_string(),
to_view: None,
deps: true,
allow_conflicts: false,
dry_run: false,
};

assert_eq!(args.from_view, "feature");
assert!(args.to_view.is_none());
assert!(args.deps);
assert!(!args.allow_conflicts);
assert!(!args.dry_run);
}
Expand All @@ -638,15 +609,13 @@ mod tests {
tag_name: "v1.0.0".to_string(),
from_view: Some("feature".to_string()),
to_view: Some("main".to_string()),
deps: false,
allow_conflicts: true,
dry_run: true,
};

assert_eq!(args.tag_name, "v1.0.0");
assert_eq!(args.from_view, Some("feature".to_string()));
assert_eq!(args.to_view, Some("main".to_string()));
assert!(!args.deps);
assert!(args.allow_conflicts);
assert!(args.dry_run);
}
Expand All @@ -660,8 +629,6 @@ mod tests {
"ghi789".to_string(),
],
to_view: Some("main".to_string()),
deps: true,
allow_conflicts: false,
};

assert_eq!(args.changes.len(), 3);
Expand Down
Loading