Skip to content

Conversation

@jleben
Copy link

@jleben jleben commented Jan 13, 2026

This PR expands the CLI with the following commands:

branch list <repo>
branch create <repo> <branch name>
branch delete <repo> <branch name>
tag list <repo>
tag create <repo> <tag name> [<ref>]
tag delete <repo> <tag name>
history <repo> [<ref>]
diff <repo> <from ref> <to ref>
inspect <repo> [<ref>]

I think the purpose of these commands is pretty self-explanatory.

The actual output format of these commands was chosen according to fairly subjective criteria for utility + completeness + compactness. I will welcome any suggestions for change.

There is a beginning of a unit test there, nothing more in terms of automated testing. I am finding myself short of time for this lately, so I thought I'd pass it off to someone else at this point.

Related to: #826 #827 #831

@paraseba
Copy link
Collaborator

This is awesome! We'll review in detail. Thank you @jleben !

Copy link
Collaborator

@paraseba paraseba left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This looks great! Made a few small comments

async fn resolve_ref_by_name(
repository: &Repository,
reference: &String,
) -> Result<SnapshotId> {
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is useful logic, and in fact I think we have something similar somewhere. But for now I'd prefer to keep the CLI as logic-free as possible. I'd recommend we only take a snapshot_id as reference, which is what the python API supports today. Then we can add this logic to the main rust code and extend support in the python library and CLI

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done.

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I've also renamed the history command to ancestry in the spirit of conforming to the Python API.

}

fn show_snapshot(mut writer: impl std::io::Write, snapshot: SnapshotInfo, with_meta: bool) -> Result<()> {
writeln!(writer, "Snapshot: {}", snapshot.id)?;
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

we have an inspect.rs module. Can we use that instead?

let repository = open_repository(&args.repo, config).await?;
let snapshot = resolve_ref_by_name(&repository, &args.reference).await?;
let ancestry = repository.ancestry(&VersionInfo::SnapshotId(snapshot)).await?;
let snapshots: Vec<_> = ancestry.take(args.n).collect().await;
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't think you need to collect here

}
}

async fn inspect(
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'd love if we instead reused and extended the logic in inspect.rs

}

async fn diff(
args: &DiffArgs,
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It would be great if we could DRY things up, some of this logic is present in the python bindings module too: repository.rs, see PyDiff. But maybe this is OK for an initial version

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants