Update the blame subcommand to handle multiple line ranges. This allows specifying multiple `-L` options similar to the usage of git.
Unified · Split
| @@ -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, |
| @@ -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>, |