History

feat: add support for multiple blame ranges like `gix blame -L <range> -L <other-range> ...`

Update the blame subcommand to handle multiple line ranges. This allows specifying multiple `-L` options similar to the usage of git.

Bart Dubbeldam committed 1 year ago

Commit 36a6ffe1 parent 8143d692 files · +4 −4Browse files

Unified · Split

2 files
  1. src/plumbing/main.rs +2 −2
  2. src/plumbing/options/mod.rs +2 −2
src/plumbing/main.rs+2−2
@@ -1560,7 +1560,7 @@ pub fn main() -> Result<()> { · 1559 unmodified lines
1560 Subcommands::Blame {1560 Subcommands::Blame {
1561 statistics,1561 statistics,
1562 file,1562 file,
1563 range,1563 ranges,
1564 since,1564 since,
1565 } => prepare_and_run(1565 } => prepare_and_run(
1566 "blame",1566 "blame",
@@ -1578,7 +1578,7 @@ pub fn main() -> Result<()> { · 11 unmodified lines
1578 &file,1578 &file,
1579 gix::blame::Options {1579 gix::blame::Options {
1580 diff_algorithm,1580 diff_algorithm,
1581 range: range.map(BlameRanges::from_range).unwrap_or_default(),1581 range: gix::blame::BlameRanges::from_ranges(ranges),
1582 since,1582 since,
1583 },1583 },
1584 out,1584 out,
src/plumbing/options/mod.rs+2−2
@@ -168,8 +168,8 @@ pub enum Subcommands { · 167 unmodified lines
168 /// The file to create the blame information for.168 /// The file to create the blame information for.
169 file: std::ffi::OsString,169 file: std::ffi::OsString,
170 /// Only blame lines in the given 1-based inclusive range '<start>,<end>', e.g. '20,40'.170 /// Only blame lines in the given 1-based inclusive range '<start>,<end>', e.g. '20,40'.
171 #[clap(short='L', value_parser=AsRange)]171 #[clap(short='L', value_parser=AsRange, action=clap::ArgAction::Append)]
172 range: Option<std::ops::Range<u32>>,172 ranges: Vec<std::ops::Range<u32>>,
173 /// Don't consider commits before the given date.173 /// Don't consider commits before the given date.
174 #[clap(long, value_parser=AsTime, value_name = "DATE")]174 #[clap(long, value_parser=AsTime, value_name = "DATE")]
175 since: Option<gix::date::Time>,175 since: Option<gix::date::Time>,

Keyboard shortcuts

General

Show keyboard shortcuts
?
Focus the current search
/

Issues and pull requests

Open filters
f

Issues, pull requests and Inbox

Select next item
j↓
Select previous item
k↑
Open selected item
Enter
Dismiss filters or clear selection
Esc

Repository code

Go to file
t