Skip to content

Commit 732d9f2

Browse files
authored
Merge pull request #41 from kyle-rader-msft/user/kyrader/repo-stats-default-all
2 parents 088c8b6 + 0e5a1b0 commit 732d9f2

4 files changed

Lines changed: 17 additions & 10 deletions

File tree

Cargo.lock

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Cargo.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
[package]
22
name = "loki-cli"
3-
version = "2.5.0"
3+
version = "2.6.0"
44
authors = ["Kyle W. Rader"]
55
description = "Loki: 🚀 A Git productivity tool"
66
homepage = "https://github.com/kyle-rader/loki-cli"

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -182,7 +182,7 @@ Analyze commits reachable from HEAD to see who has been landing work in a reposi
182182

183183
- `--name` filters by author display name (repeatable, case-insensitive).
184184
- `--email` filters by author email (repeatable, case-insensitive).
185-
- `--all` includes all commits (default is first-parent only).
185+
- `--first-parent` restricts the walk to the first-parent chain of HEAD (one tally per merge commit). Default walks all commits reachable from HEAD, relying on patch-id dedup to handle rebased / cherry-picked / migrated history.
186186
- `--no-dedup` disables patch-id deduplication (see below).
187187

188188
#### Patch-id deduplication

src/main.rs

Lines changed: 14 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -75,9 +75,16 @@ struct RepoStatsOptions {
7575
#[clap(long, default_value_t = 20)]
7676
top: usize,
7777

78-
/// Include all commits (disables first-parent-only filtering).
79-
#[clap(long, default_value = "false")]
80-
all: bool,
78+
/// Only count commits on the first-parent chain of HEAD.
79+
///
80+
/// By default `lk repo stats` walks every commit reachable from HEAD
81+
/// (with patch-id deduplication applied so logically-identical commits
82+
/// from rebases / cherry-picks / cross-repo migrations are counted
83+
/// once). Pass `--first-parent` to restrict the walk to the mainline
84+
/// of merges into HEAD — useful when each PR is merged with a merge
85+
/// commit and you want one tally per PR.
86+
#[clap(long, default_value_t = false)]
87+
first_parent: bool,
8188

8289
/// Only include commits authored by these names (repeatable, case-insensitive fuzzy match).
8390
#[clap(long = "name", value_name = "NAME")]
@@ -384,14 +391,14 @@ fn repo_stats(options: &RepoStatsOptions) -> Result<(), String> {
384391
progress.finish();
385392

386393
if totals.is_empty() {
387-
if options.all {
394+
if options.first_parent {
388395
println!(
389-
"No commits found between {} and {}.",
396+
"No first-parent commits found between {} and {}.",
390397
range.start_label, range.end_label
391398
);
392399
} else {
393400
println!(
394-
"No first-parent commits found between {} and {}.",
401+
"No commits found between {} and {}.",
395402
range.start_label, range.end_label
396403
);
397404
}
@@ -464,7 +471,7 @@ fn collect_raw_commits(
464471
range: &TimeRange,
465472
) -> Result<Vec<RawCommit>, String> {
466473
let mut git_args: Vec<String> = vec!["log".to_string()];
467-
if !options.all {
474+
if options.first_parent {
468475
git_args.push("--first-parent".to_string());
469476
}
470477
git_args.push("--pretty=format:%H%x09%ct%x09%an%x09%ae".to_string());

0 commit comments

Comments
 (0)