WIP: List the most recent change to each top-level entry in a git tree

feat: add flag to limit search time

Signed-off-by: tjh <did:plc:65gha4t3avpfpzmvpbwovss7>

tjh.dev e1071942 06758f28

verified
+22
+3
Cargo.toml
··· 14 gix = { version = "0.73.0", default-features = false, features = ["max-performance"] } 15 time = { version = "0.3.41", features = ["formatting"] } 16 17 [profile.release] 18 strip = true 19 lto = "fat"
··· 14 gix = { version = "0.73.0", default-features = false, features = ["max-performance"] } 15 time = { version = "0.3.41", features = ["formatting"] } 16 17 + [features] 18 + time-budget = [] 19 + 20 [profile.release] 21 strip = true 22 lto = "fat"
+5
src/cli.rs
··· 24 #[arg(long, short = 'R', value_hint = ValueHint::DirPath, default_value = ".")] 25 pub repository: PathBuf, 26 27 pub subtree: Option<PathBuf>, 28 }
··· 24 #[arg(long, short = 'R', value_hint = ValueHint::DirPath, default_value = ".")] 25 pub repository: PathBuf, 26 27 + /// Maximum search time in milliseconds. 28 + #[cfg(feature = "time-budget")] 29 + #[arg(long, default_value_t = u64::MAX)] 30 + pub time_limit: u64, 31 + 32 pub subtree: Option<PathBuf>, 33 }
+14
src/main.rs
··· 11 use gix::traverse::commit::simple::CommitTimeOrder; 12 use std::collections::HashSet; 13 14 mod cli; 15 16 fn main() -> anyhow::Result<()> { 17 let arguments = cli::parse(); 18 let repository = gix::open(arguments.repository)?; 19 20 let mut current_commit = repository.resolve_revspec(&arguments.from)?; ··· 68 69 for revision in rev_walk.all()? { 70 if interested.is_empty() { 71 break; 72 } 73
··· 11 use gix::traverse::commit::simple::CommitTimeOrder; 12 use std::collections::HashSet; 13 14 + #[cfg(feature = "time-budget")] 15 + use std::time::Duration; 16 + #[cfg(feature = "time-budget")] 17 + use std::time::Instant; 18 + 19 mod cli; 20 21 fn main() -> anyhow::Result<()> { 22 let arguments = cli::parse(); 23 + 24 + #[cfg(feature = "time-budget")] 25 + let (time_limit, start) = (Duration::from_millis(arguments.time_limit), Instant::now()); 26 + 27 let repository = gix::open(arguments.repository)?; 28 29 let mut current_commit = repository.resolve_revspec(&arguments.from)?; ··· 77 78 for revision in rev_walk.all()? { 79 if interested.is_empty() { 80 + break; 81 + } 82 + 83 + #[cfg(feature = "time-budget")] 84 + if start.elapsed() > time_limit { 85 break; 86 } 87