+3
Cargo.toml
+3
Cargo.toml
+5
src/cli.rs
+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
+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