Skip to content
This repository was archived by the owner on Dec 12, 2024. It is now read-only.

Commit 16cd086

Browse files
WIP: feat: add since-last-tag cmd.
1 parent 8cc5926 commit 16cd086

File tree

1 file changed

+27
-0
lines changed

1 file changed

+27
-0
lines changed

src/main.rs

+27
Original file line numberDiff line numberDiff line change
@@ -54,6 +54,18 @@ enum Subcommand {
5454
#[clap(flatten)]
5555
files: FileSelection,
5656
},
57+
/// Select the (local) mainline branch and the most recent tag.
58+
///
59+
/// Many Git projects use tags to manage project releases and/or milestones. This command is
60+
/// useful for viewing the set of changes since the most recent tag. This can be helpful when
61+
/// for example, analyzing changes for determining which SemVer version to use for a next
62+
/// release, performing risk assessments, or writing release notes.
63+
SinceLastTag {
64+
#[clap(long, short)]
65+
base: Option<String>,
66+
#[clap(flatten)]
67+
files: FileSelection,
68+
},
5769
/// Select a custom set of commit-ish refs.
5870
Select {
5971
/// Additional branches to include.
@@ -193,6 +205,21 @@ fn main() {
193205
config,
194206
files: FileSelection { files },
195207
} => (branches(&config, &|cmd| cmd)?, files),
208+
Subcommand::SinceLastTag {
209+
base,
210+
files: FileSelection { files },
211+
} => {
212+
let base = base.map(Ok).unwrap_or_else(fallback_base)?;
213+
let branches = branches(
214+
&PresetConfig {
215+
select_upstreams: false,
216+
select_pushes: false,
217+
select_last_tag: true,
218+
},
219+
&|cmd| cmd.arg(&base),
220+
)?;
221+
(branches, files)
222+
}
196223
Subcommand::Select {
197224
branches,
198225
files: FileSelection { files },

0 commit comments

Comments
 (0)