From 7f24b98cb2b2e9588176bd1bc99dc077ae6d816d Mon Sep 17 00:00:00 2001 From: Felipe Sateler Date: Wed, 12 Nov 2008 00:04:13 -0300 Subject: Don't include first UNRELEASED line There's not much point in keeping this line when either doing a release or when having a snapshot header (nor does it help much if one invokes git-dch without options). Closes: #505400 --- git-dch | 19 ++++++++++++++++--- 1 file changed, 16 insertions(+), 3 deletions(-) diff --git a/git-dch b/git-dch index 7be6777d..77d5f15a 100755 --- a/git-dch +++ b/git-dch @@ -50,13 +50,18 @@ def add_changelog_entry(msg, author, email): system(cmd) -def add_changelog_section(msg, distribution, newversion=None): +def add_changelog_section(msg, distribution, newversion=None, author=None, email=None): "add a new changelog section" if newversion: versionopt = '--newversion=%s' % newversion else: versionopt = '-i' - cmd = "dch --no-auto-nmu --distribution=%s %s %s" % (distribution, versionopt, msg) + + if author and email: + env = """DEBFULLNAME="%s" DEBEMAIL="%s" """ % (author, email) + else: + env = "" + cmd = "%s dch --no-auto-nmu --distribution=%s %s %s" % (env, distribution, versionopt, msg) system(cmd) @@ -325,7 +330,15 @@ def main(argv): add_section = False if add_section: - add_changelog_section(distribution="UNRELEASED", msg="UNRELEASED", newversion=options.new_version) + if commits: + first_commit = commits[0] + commits = commits[1:] + commit_msg, (commit_author, commit_email) = parse_commit(repo, first_commit, options) + else: + commit_msg = "UNRELEASED" + commit_author = None + commit_email = None + add_changelog_section(distribution="UNRELEASED", msg=commit_msg, newversion=options.new_version, author=commit_author, email=commit_email) if commits: shortlog_to_dch(repo, commits, options) -- cgit v1.2.3