summaryrefslogtreecommitdiff
path: root/git-dch
diff options
context:
space:
mode:
authorGuido Günther <agx@sigxcpu.org>2008-11-14 13:40:02 +0100
committerGuido Guenther <agx@sigxcpu.org>2008-11-14 13:40:02 +0100
commit8b8c1372ec7564a6e603dcf54554f246671a422c (patch)
tree880e200d407c022006e631b8bd0a3cee8be30fdf /git-dch
parentf5c0d316cff5dc56816a8393d0ee9927d66182b8 (diff)
downloadgit-buildpackage-8b8c1372ec7564a6e603dcf54554f246671a422c.tar.gz
git-buildpackage-8b8c1372ec7564a6e603dcf54554f246671a422c.tar.bz2
git-buildpackage-8b8c1372ec7564a6e603dcf54554f246671a422c.zip
gather all invocations of dch in one function
fixes dch failures due to missing quotes introduced by [7f24b98]
Diffstat (limited to 'git-dch')
-rwxr-xr-xgit-dch48
1 files changed, 31 insertions, 17 deletions
diff --git a/git-dch b/git-dch
index 3c1667c5..6133a3cf 100755
--- a/git-dch
+++ b/git-dch
@@ -44,33 +44,48 @@ def escape_commit(msg):
return msg.replace('"','\\\"').replace("$","\$").replace("`","\`")
-def add_changelog_entry(msg, author, email):
- "add aa single changelog entry"
- cmd = """DEBFULLNAME="%s" DEBEMAIL="%s" dch --no-auto-nmu --append -- "%s" """ % (author, email, escape_commit(msg))
- system(cmd)
+def spawn_dch(msg='', author=None, email=None, newversion=False, version=None, release=False, distribution=None):
+ distopt = ""
+ versionopt = ""
+ env = ""
-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'
+ if version:
+ versionopt = '--newversion=%s' % version
+ else:
+ versionopt = '-i'
+ elif release:
+ versionopt = "--release"
+ msg = None
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, escape_commit(msg))
+
+ if distribution:
+ distopt = "--distribution=%s" % distribution
+
+ cmd = '%(env)s dch --no-auto-nmu %(distopt)s %(versionopt)s ' % locals()
+ if type(msg) == type(''):
+ cmd += '"%s"' % escape_commit(msg)
system(cmd)
+def add_changelog_entry(msg, author, email):
+ "add aa single changelog entry"
+ spawn_dch(msg=msg, author=author, email=email)
+
+
+def add_changelog_section(msg, distribution, author=None, email=None, version=None):
+ "add a new changelog section"
+ spawn_dch(msg=msg, newversion= True, version=version, author=author, email=email, distribution=distribution)
+
+
def fixup_trailer():
"""fixup the changelog trailer's comitter and email address - it might
otherwise point to the last git committer instead of the person creating
the changelog"""
- cmd = "dch \"\""
- system(cmd)
+ spawn_dch(msg='')
def head_commit():
@@ -139,8 +154,7 @@ def do_release(changelog, cp):
if snapshot:
cp['MangledVersion'] = release
mangle_changelog(changelog, cp)
- cmd = "dch --release"
- system(cmd)
+ spawn_dch(release=True)
def do_snapshot(changelog, next_snapshot):
@@ -339,7 +353,7 @@ def main(argv):
commit_author = None
commit_email = None
add_changelog_section(distribution="UNRELEASED", msg=commit_msg,
- newversion=options.new_version, author=commit_author,
+ version=options.new_version, author=commit_author,
email=commit_email)
if commits: