diff options
author | Guido Günther <agx@sigxcpu.org> | 2010-07-21 18:26:29 +0200 |
---|---|---|
committer | Guido Günther <agx@sigxcpu.org> | 2010-07-21 18:33:18 +0200 |
commit | 28082073975466b8af17c7ff55bd8da9b54ea5ff (patch) | |
tree | f78a8881ed7c078ac2bc4715f3d176e6ed17feaf /git-dch | |
parent | 8c8167f96e85cd4a7d2fddb904596f85de0da23a (diff) |
Terminate the patch description with a dot
in case of multiline commits where the second line starts with a
uppercase letter. Heavily based on a patch by Jonathan Nieder.
Diffstat (limited to 'git-dch')
-rwxr-xr-x | git-dch | 22 |
1 files changed, 21 insertions, 1 deletions
@@ -46,6 +46,23 @@ def system(cmd): def escape_commit(msg): return msg.replace('"','\\\"').replace("$","\$").replace("`","\`") +def ispunct(ch): + return not ch.isalnum() and not ch.isspace() + +def punctuate_commit(msg): + """Terminate the first line of a commit message with a '.' if it's a + multiline commit""" + lines = msg.split('\n', 1) + if len(lines) <= 1: + return msg + first, rest = lines + if not rest: + return msg + if first and ispunct(first[-1]): + return msg + if rest[0].islower(): + return msg + return "%s.\n%s" % (first, rest) def spawn_dch(msg='', author=None, email=None, newversion=False, version=None, release=False, distribution=None): distopt = "" @@ -61,6 +78,9 @@ def spawn_dch(msg='', author=None, email=None, newversion=False, version=None, r versionopt = "--release --no-force-save-on-release" msg = None + if msg: + msg = punctuate_commit(msg) + if author and email: env = """DEBFULLNAME="%s" DEBEMAIL="%s" """ % (author, email) @@ -74,7 +94,7 @@ def spawn_dch(msg='', author=None, email=None, newversion=False, version=None, r def add_changelog_entry(msg, author, email): - "add aa single changelog entry" + "add a single changelog entry" spawn_dch(msg=msg, author=author, email=email) |