parent
e608cd9958
commit
a748f78a94
File diff suppressed because it is too large
Load Diff
21
Cargo.toml
21
Cargo.toml
|
|
@ -21,24 +21,19 @@ bench = false
|
||||||
unsafe_code = { level = "forbid" }
|
unsafe_code = { level = "forbid" }
|
||||||
|
|
||||||
[dependencies]
|
[dependencies]
|
||||||
gix = { version = "0.70.0", default-features = false, features = [
|
gix = { version = "0.73", default-features = false, features = [
|
||||||
"mailmap",
|
"mailmap",
|
||||||
"parallel",
|
"parallel",
|
||||||
] }
|
] }
|
||||||
clap = { version = "4.5.32", features = ["derive"] }
|
clap = { version = "4.5", features = ["derive"] }
|
||||||
chrono = { version = "0.4.40" }
|
chrono = { version = "0.4" }
|
||||||
itertools = { version = "0.14.0" }
|
itertools = { version = "0.14" }
|
||||||
anyhow = { version = "1.0.95" }
|
anyhow = { version = "1.0" }
|
||||||
rayon = { version = "1.10.0" }
|
rayon = { version = "1.11" }
|
||||||
|
|
||||||
[dev-dependencies]
|
[dev-dependencies]
|
||||||
divan = { version = "0.1.17" }
|
divan = { version = "0.1" }
|
||||||
mockd = { version = "0.4.35", features = [
|
mockd = { version = "0.4", features = ["datetime", "words", "name", "contact"] }
|
||||||
"datetime",
|
|
||||||
"words",
|
|
||||||
"name",
|
|
||||||
"contact",
|
|
||||||
] }
|
|
||||||
|
|
||||||
[[bench]]
|
[[bench]]
|
||||||
name = "commits"
|
name = "commits"
|
||||||
|
|
|
||||||
|
|
@ -18,6 +18,8 @@ pub struct Heatmap {
|
||||||
branches: usize,
|
branches: usize,
|
||||||
repos: usize,
|
repos: usize,
|
||||||
chunks: Vec<Chunk>,
|
chunks: Vec<Chunk>,
|
||||||
|
streak: u32,
|
||||||
|
max_streak: u32,
|
||||||
|
|
||||||
format: Format,
|
format: Format,
|
||||||
list_repos: bool,
|
list_repos: bool,
|
||||||
|
|
@ -69,6 +71,8 @@ impl Heatmap {
|
||||||
|
|
||||||
let mut chunk = Chunk::new(day_of_week);
|
let mut chunk = Chunk::new(day_of_week);
|
||||||
let mut chunk_idx = 0;
|
let mut chunk_idx = 0;
|
||||||
|
let mut streak = 0;
|
||||||
|
let mut max_streak = 0;
|
||||||
|
|
||||||
// Track the very first day of the heatmap, as we don't want the extra spacing in front of
|
// Track the very first day of the heatmap, as we don't want the extra spacing in front of
|
||||||
// those.
|
// those.
|
||||||
|
|
@ -108,12 +112,18 @@ impl Heatmap {
|
||||||
let value = grouped_commits.get(¤t_day);
|
let value = grouped_commits.get(¤t_day);
|
||||||
match value {
|
match value {
|
||||||
Some(val) => {
|
Some(val) => {
|
||||||
|
streak += 1;
|
||||||
|
if streak > max_streak {
|
||||||
|
max_streak = streak;
|
||||||
|
}
|
||||||
|
|
||||||
chunk.data[day_of_week as usize].push(*val);
|
chunk.data[day_of_week as usize].push(*val);
|
||||||
if *val > highest_count {
|
if *val > highest_count {
|
||||||
highest_count = *val;
|
highest_count = *val;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
None => {
|
None => {
|
||||||
|
streak = 0;
|
||||||
chunk.data[day_of_week as usize].push(0);
|
chunk.data[day_of_week as usize].push(0);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -135,6 +145,9 @@ impl Heatmap {
|
||||||
branches,
|
branches,
|
||||||
repos,
|
repos,
|
||||||
chunks,
|
chunks,
|
||||||
|
streak,
|
||||||
|
max_streak,
|
||||||
|
|
||||||
format,
|
format,
|
||||||
list_repos,
|
list_repos,
|
||||||
list_days,
|
list_days,
|
||||||
|
|
@ -180,6 +193,14 @@ impl Display for Heatmap {
|
||||||
writeln!(f, " {}: {} {}", repo, repo_commits, commits_label).unwrap();
|
writeln!(f, " {}: {} {}", repo, repo_commits, commits_label).unwrap();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
writeln!(
|
||||||
|
f,
|
||||||
|
"{} current streak | {} longest streak",
|
||||||
|
self.streak, self.max_streak
|
||||||
|
)
|
||||||
|
.unwrap();
|
||||||
|
|
||||||
writeln!(f).unwrap();
|
writeln!(f).unwrap();
|
||||||
|
|
||||||
let mut per_day_commits: [i32; 7] = [0, 0, 0, 0, 0, 0, 0];
|
let mut per_day_commits: [i32; 7] = [0, 0, 0, 0, 0, 0, 0];
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue