Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Implement finding proof by git revision #782

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open
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: 3 additions & 0 deletions cargo-crev/CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,9 @@
<!-- next-url -->
## [Unreleased](https://github.com/crev-dev/cargo-crev/compare/v0.26.0...HEAD) - ReleaseDate

- Implement `crev proof find --git-rev 0f0f0f`.
- Make filer for `crev proof find --version 1.1.1` indepent of name filter.

## [0.26.0](https://github.com/crev-dev/cargo-crev/compare/v0.25.11...v0.26.0) - 2024-11-07

- Fixed handling of the `--diff` flag.
Expand Down
18 changes: 15 additions & 3 deletions cargo-crev/src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -119,10 +119,22 @@ pub fn proof_find(args: opts::ProofFind) -> Result<()> {

if let Some(crate_) = args.crate_.as_ref() {
iter = Box::new(iter.filter(move |r| &r.package.id.id.name == crate_));
if let Some(version) = args.version.as_ref() {
iter = Box::new(iter.filter(move |r| &r.package.id.version == version));
}
}

if let Some(version) = args.version.as_ref() {
iter = Box::new(iter.filter(move |r| &r.package.id.version == version));
}

if let Some(git_revision) = args.git_revision.as_ref() {
iter = Box::new(iter.filter(move |r|
r.package.revision_type == proof::default_revision_type()
&& (
git_revision.is_empty() && &r.package.revision == git_revision
|| !git_revision.is_empty() && r.package.revision.starts_with(git_revision)
)
));
}

for review in iter {
println!("---\n{review}");
}
Expand Down
3 changes: 3 additions & 0 deletions cargo-crev/src/opts.rs
Original file line number Diff line number Diff line change
Expand Up @@ -884,6 +884,9 @@ pub struct ProofFind {
#[structopt(name = "vers", long = "vers")]
pub version: Option<Version>,

#[structopt(name = "git-rev", long = "git-rev")]
pub git_revision: Option<String>,

/// Find a proof by a crev Id
#[structopt(name = "author", long = "author")]
pub author: Option<String>,
Expand Down
Loading