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