Allow to interdiff with a pre-made ref
This commit is contained in:
parent
2fc6af4390
commit
e9a3c9a6b0
1 changed files with 90 additions and 78 deletions
20
src/main.rs
20
src/main.rs
|
|
@ -238,6 +238,13 @@ struct FormatPatch {
|
|||
help = "Reference for the interdiff (defaults to ${config.interdiff_base})"
|
||||
)]
|
||||
base_diff: Option<String>,
|
||||
#[arg(
|
||||
short = 'D',
|
||||
long,
|
||||
help = "Perform the interdiff with an explicit reference",
|
||||
conflicts_with = "diff"
|
||||
)]
|
||||
diff_to: Option<String>,
|
||||
extra_args: Vec<String>,
|
||||
}
|
||||
|
||||
|
|
@ -345,7 +352,10 @@ impl FormatPatch {
|
|||
})
|
||||
};
|
||||
|
||||
let _version_dir = if let Some(interdiff) = self.diff {
|
||||
let _version_dir = match (self.diff, self.diff_to) {
|
||||
(None, None) => format_patch(&[])?,
|
||||
(Some(_), Some(_)) => unreachable!(),
|
||||
(Some(patch_version), None) => {
|
||||
let base = self
|
||||
.base_diff
|
||||
.or(config.interdiff_base)
|
||||
|
|
@ -411,7 +421,7 @@ impl FormatPatch {
|
|||
wt.exec(&["switch", branch.name])?;
|
||||
|
||||
let patches = branch_dir
|
||||
.join(&interdiff.to_string())
|
||||
.join(&patch_version.to_string())
|
||||
.read_dir()
|
||||
.into_diagnostic()
|
||||
.wrap_err("Could not read interdiff folder")?
|
||||
|
|
@ -439,8 +449,10 @@ impl FormatPatch {
|
|||
|
||||
let interdiff_branch = format!("--interdiff={}", branch.name);
|
||||
format_patch(&[&interdiff_branch])?
|
||||
} else {
|
||||
format_patch(&[])?
|
||||
}
|
||||
(None, Some(diff_to)) => {
|
||||
format_patch(&[&format!("--interdiff={diff_to}")])?
|
||||
},
|
||||
};
|
||||
|
||||
let cover_letter = branch_dir.join(COVER_LETTER_NAME);
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue