64 lines
1.4 KiB
Rust
64 lines
1.4 KiB
Rust
|
use anyhow::Context;
|
||
|
use chrono::NaiveDate;
|
||
|
use libgitheatmap::{self, cli::CliArgs};
|
||
|
|
||
|
fn main() {
|
||
|
divan::main();
|
||
|
}
|
||
|
|
||
|
#[divan::bench]
|
||
|
fn current_repo_commits() {
|
||
|
let home_dir = std::env::current_dir().unwrap();
|
||
|
|
||
|
let args = CliArgs {
|
||
|
root_dir: Some(vec![home_dir]),
|
||
|
authors: None,
|
||
|
char: '▩',
|
||
|
repos: None,
|
||
|
ignored_repos: None,
|
||
|
branches: None,
|
||
|
since: "2024-01-01".to_string(),
|
||
|
until: None,
|
||
|
split_months: false,
|
||
|
months_per_row: 13,
|
||
|
no_merges: false,
|
||
|
..Default::default()
|
||
|
};
|
||
|
|
||
|
let since = NaiveDate::parse_from_str(&args.since, "%Y-%m-%d").unwrap();
|
||
|
|
||
|
let until = NaiveDate::parse_from_str("2025-01-01", "%Y-%m-%d").unwrap();
|
||
|
|
||
|
libgitheatmap::get_commits(args, since, until)
|
||
|
.with_context(|| "Could not fetch commit list")
|
||
|
.unwrap();
|
||
|
}
|
||
|
|
||
|
#[divan::bench(sample_count = 20)]
|
||
|
fn all_repos_commits() {
|
||
|
let home_dir = std::path::PathBuf::from("/home");
|
||
|
|
||
|
let args = CliArgs {
|
||
|
root_dir: Some(vec![home_dir]),
|
||
|
authors: None,
|
||
|
char: '▩',
|
||
|
repos: None,
|
||
|
ignored_repos: None,
|
||
|
branches: None,
|
||
|
since: "2024-01-01".to_string(),
|
||
|
until: None,
|
||
|
split_months: false,
|
||
|
months_per_row: 13,
|
||
|
no_merges: false,
|
||
|
..Default::default()
|
||
|
};
|
||
|
|
||
|
let since = NaiveDate::parse_from_str(&args.since, "%Y-%m-%d").unwrap();
|
||
|
|
||
|
let until = NaiveDate::parse_from_str("2025-01-01", "%Y-%m-%d").unwrap();
|
||
|
|
||
|
libgitheatmap::get_commits(args, since, until)
|
||
|
.with_context(|| "Could not fetch commit list")
|
||
|
.unwrap();
|
||
|
}
|