Tags: patch Hello,
Here is a patch[1] to implement my wish. It implements two options "-D" or "--distribution" and "--force-distribution". This permit to specify the distribution when adding a new changelog section. But it permit to switch the distribution when doing a release or a snapshot too. This is useful, at least for me: - I build snapshots and upload them on a snapshot only distribution - When I release a package I switch the distribution to a release only one Default values make no difference with the actual behaviour. Regards. * git-dch (main): Add version_group option "-D" and "--distribution" to specify the distribution name. It's default value is not provided in option declaration to avoid swiching the distribution when no option is provided. Add version_group option "--force-distribution" to force the provided distribution to be used, used by "dch". Mangle "cp['Distribution']" before calling 'do_release' or 'do_snapshot' to switch the distribution when user request it. Update "add_changelog_section" calls. (do_snapshot): Add the parsed changelog as third argument. Closes: #646684 --- git-dch | 24 +++++++++++++++++++----- 1 files changed, 19 insertions(+), 5 deletions(-) diff --git a/git-dch b/git-dch index 423f3cd..9a70771 100755 --- a/git-dch +++ b/git-dch @@ -211,14 +211,13 @@ def do_release(changelog, repo, cp, git_author, dch_options): spawn_dch(release=True, author=author, email=email, dch_options=dch_options) -def do_snapshot(changelog, repo, next_snapshot): +def do_snapshot(changelog, repo, cp, next_snapshot): """ Add new snapshot banner to most recent changelog section. The next snapshot number is calculated by eval()'ing next_snapshot """ commit = head_commit(repo) - cp = parse_changelog(filename=changelog) (release, snapshot) = snapshot_version(cp['Version']) snapshot = int(eval(next_snapshot)) @@ -287,6 +286,9 @@ def process_options(options, parser): else: dch_options += " --nomultimaint" + if options.force_distribution: + dch_options += " --force-distribution" + get_customizations(options.customization_file) return dch_options @@ -348,6 +350,9 @@ def main(argv): help="mark as release") version_group.add_option("-S", "--snapshot", action="store_true", dest="snapshot", default=False, help="mark as snapshot build") + version_group.add_option("-D", "--distribution", dest="distribution", help="Use this as distribution") + version_group.add_option("--force-distribution", action="store_true", dest="force_distribution", default=False, + help="Force the provided distribution to be used, even if it doesn't match the list of known distributions") version_group.add_option("-N", "--new-version", dest="new_version", help="use this as base for the new version number") version_group.add_option("--bpo", dest="bpo", action="store_true", default=False, @@ -439,6 +444,15 @@ def main(argv): else: add_section = False + # Permit to change the distribution when ever we want + if options.distribution: + gbp.log.debug("Change distribution from {0} to {1}".format(cp['Distribution'], + options.distribution)) + del(cp['Distribution']) + cp['Distribution'] = options.distribution + else: + options.distribution = "UNRELEASED" + i = 0 for c in commits: i += 1 @@ -452,7 +466,7 @@ def main(argv): if add_section: # Add a section containing just this message (we can't # add an empty section with dch) - add_changelog_section(distribution="UNRELEASED", msg=commit_msg, + add_changelog_section(distribution=options.distribution, msg=commit_msg, version=version_change, author=commit_author, email=commit_email, @@ -474,7 +488,7 @@ def main(argv): if add_section: # If we end up here, then there were no commits to include, # so we put a dummy message in the new section. - add_changelog_section(distribution="UNRELEASED", msg=["UNRELEASED"], + add_changelog_section(distribution=options.distribution, msg=["UNRELEASED"], version=version_change, dch_options=dch_options, repo=repo, @@ -488,7 +502,7 @@ def main(argv): do_release(changelog, repo, cp, git_author=options.git_author, dch_options=dch_options) elif options.snapshot: - (snap, version) = do_snapshot(changelog, repo, options.snapshot_number) + (snap, version) = do_snapshot(changelog, repo, cp, options.snapshot_number) gbp.log.info("Changelog has been prepared for snapshot #%d at %s" % (snap, version)) if editor_cmd: -- 1.7.7.3 Footnotes: [1] git pull git://git.baby-gnu.net/git-buildpackage dad/master -- Daniel Dehennin Récupérer ma clef GPG: gpg --keyserver pgp.mit.edu --recv-keys 0x6A2540D1
pgpZG55dMrRg5.pgp
Description: PGP signature