chlog: add -f/--file to target a specific changelog
The changelog path was hardcoded to debian/changelog in the series detection, the entry generation and the editor invocation. Packages keeping the changelog elsewhere (e.g. a staging copy) could not use chlog on it. Add -f/--file defaulting to debian/changelog, threaded through all three uses. The library side was already parameterized on the file, so no changelog.rs behavior changes beyond a test pinning the non-default path.
This commit is contained in:
+8
-3
@@ -329,6 +329,7 @@ fn main() {
|
||||
.conflicts_with("rebuild"))
|
||||
.arg(arg!(--rebuild "Number the entry as a no-change rebuild (1.0-1 becomes 1.0-1build1)").required(false))
|
||||
.arg(arg!(-v --version <version> "Target version (overrides the --backport/--nmu/--rebuild numbering)").required(false))
|
||||
.arg(arg!(-f --file <path> "Path to the changelog file to generate into and edit (default: debian/changelog)").required(false).default_value("debian/changelog"))
|
||||
.arg(arg!(--limit <n> "Cap how far back the history is searched for the previous changelog entry when no version tag exists (0 = unlimited)").required(false)
|
||||
.value_parser(clap::value_parser!(usize)).default_value("500")),
|
||||
)
|
||||
@@ -667,6 +668,10 @@ fn main() {
|
||||
.get_one::<usize>("limit")
|
||||
.copied()
|
||||
.unwrap_or(500);
|
||||
let changelog_file = sub_matches
|
||||
.get_one::<String>("file")
|
||||
.map(|s| s.to_string())
|
||||
.unwrap_or_else(|| "debian/changelog".to_string());
|
||||
let cwd = current_dir_or_exit();
|
||||
let version = sub_matches.get_one::<String>("version").map(|s| s.as_str());
|
||||
let cli_series = sub_matches.get_one::<String>("series").map(|s| s.as_str());
|
||||
@@ -692,7 +697,7 @@ fn main() {
|
||||
let target_series = if let Some(s) = cli_series {
|
||||
Some(s.to_string())
|
||||
} else {
|
||||
let changelog_path = cwd.join("debian/changelog");
|
||||
let changelog_path = cwd.join(&changelog_file);
|
||||
match rt.block_on(pkh::changelog::series_candidates(&changelog_path)) {
|
||||
Some(pkh::changelog::SeriesCandidates::Choose {
|
||||
options,
|
||||
@@ -720,7 +725,7 @@ fn main() {
|
||||
};
|
||||
|
||||
let entry = match rt.block_on(pkh::changelog::generate_entry(
|
||||
"debian/changelog",
|
||||
&changelog_file,
|
||||
Some(&cwd),
|
||||
version,
|
||||
target_series.as_deref(),
|
||||
@@ -752,7 +757,7 @@ fn main() {
|
||||
};
|
||||
let _status = std::process::Command::new(&editor)
|
||||
.current_dir(&cwd)
|
||||
.args(["debian/changelog"])
|
||||
.arg(&changelog_file)
|
||||
.status()
|
||||
.map_err(|e| {
|
||||
error!(
|
||||
|
||||
Reference in New Issue
Block a user