Skip to content

Commit 751d8cd

Browse files
committed
feat(commands): diff can use latest~N to identify snapshots
1 parent b0e3161 commit 751d8cd

File tree

1 file changed

+5
-1
lines changed

1 file changed

+5
-1
lines changed

src/commands/diff.rs

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,10 +28,14 @@ use crate::commands::tui;
2828
#[derive(clap::Parser, Command, Debug)]
2929
pub(crate) struct DiffCmd {
3030
/// Reference snapshot/path
31+
///
32+
/// Snapshot can be identified the following ways: "01a2b3c4" or "latest" or "latest~N" (N >= 0)
3133
#[clap(value_name = "SNAPSHOT1[:PATH1]")]
3234
snap1: String,
3335

3436
/// New snapshot/path (uses PATH2 = PATH1, if not given; uses local path if no snapshot is given)
37+
///
38+
/// Snapshot can be identified the following ways: "01a2b3c4" or "latest" or "latest~N" (N >= 0)
3539
#[clap(value_name = "SNAPSHOT2[:PATH2]|PATH2", value_hint = ValueHint::AnyPath)]
3640
snap2: Option<String>,
3741

@@ -83,7 +87,7 @@ impl DiffCmd {
8387
match (id1, id2) {
8488
(Some(id1), Some(id2)) => {
8589
// diff between two snapshots
86-
let snaps = repo.get_snapshots(&[id1, id2])?;
90+
let snaps = repo.get_snapshot_from_strs(&[id1, id2], |_| true)?;
8791

8892
let snap1 = &snaps[0];
8993
let snap2 = &snaps[1];

0 commit comments

Comments
 (0)