aboutsummaryrefslogtreecommitdiff
path: root/git-dch
diff options
context:
space:
mode:
authorGuido Guenther <agx@sigxcpu.org>2007-10-03 14:08:05 +0200
committerGuido Guenther <agx@sigxcpu.org>2007-10-03 14:08:05 +0200
commitc5aef28fc1151d44cb71fc6d2f4262fbac6b325d (patch)
tree00be380032ac48cf4f39fd91b3e9e0246ef00727 /git-dch
parent1ff242981d8c495454c4ad8bd7e2efbfc3cdc1d3 (diff)
don't create a new changelog section if the current package is unreleased
Diffstat (limited to 'git-dch')
-rwxr-xr-xgit-dch45
1 files changed, 25 insertions, 20 deletions
diff --git a/git-dch b/git-dch
index f341e656..d2dda69e 100755
--- a/git-dch
+++ b/git-dch
@@ -45,18 +45,26 @@ def get_log(start, end):
return changes
-def shortlog_to_dch(changes, verbose):
+def add_changelog_entry(msg, author):
+ cmd = 'DEBFULLNAME="%s" dch "%s"' % (author, msg.replace('"','\"'))
+ ret = os.system(cmd)
+ if ret:
+ raise GbpError, "Error executing %s: %d" % (cmd, ret)
+
+
+def add_changelog_section(msg, distribution):
+ ret = os.system("dch --distribution=%s -i %s" % (distribution, msg))
+ if ret:
+ raise GbpError, "Error executing %s: %d" % (cmd, ret)
+
+
+def shortlog_to_dch(changes):
"""convert the changes in git shortlog format to debian changelog format"""
commit_re = re.compile('\s+(?P<msg>.*)')
author_re = re.compile('(?P<author>.*) \([0-9]+\)')
author = 'Unknown'
ret = 0
- # FIXME: this isn't flexible enough
- ret = os.system("dch --distribution=UNRELEASED -i UNRELEASED")
- if ret:
- raise GbpError, "Error executing %s: %d" % (cmd, ret)
-
for line in changes:
r = commit_re.match(line)
msg = ''
@@ -69,12 +77,7 @@ def shortlog_to_dch(changes, verbose):
elif line:
print >>sys.stderr, "Unknown changelog line: %s" % line
if msg:
- cmd = 'DEBFULLNAME="%s" dch "%s"' % (author, msg.replace('"','\"'))
- if verbose:
- print cmd
- ret = os.system(cmd)
- if ret:
- raise GbpError, "Error executing %s: %d" % (cmd, ret)
+ add_changelog_entry(msg, author)
def main(argv):
@@ -104,17 +107,20 @@ def main(argv):
except GitRepositoryError:
raise GbpError, "%s is not a git repository" % (os.path.abspath('.'))
+ cp = parse_changelog('debian/changelog')
if options.from_commit:
- start = options.from_commit
+ start = options.from_commit
else:
- cp = parse_changelog('debian/changelog')
start = build_tag(options.debian_tag, cp['Version'])
changes = get_log(start, options.debian)
- if changes:
- shortlog_to_dch(changes, options.verbose)
- else:
- print "No changes detected from %s to %s." % (start, options.debian)
+ if changes:
+ # FIXME: need a way to force a new verison anyway:
+ if cp['Distribution'] != "UNRELEASED":
+ add_changelog_section(distribution="UNRELEASED", msg="UNRELEASED")
+ shortlog_to_dch(changes)
+ else:
+ print "No changes detected from %s to %s." % (start, options.debian)
except GbpError, err:
if len(err.__str__()):
@@ -125,5 +131,4 @@ def main(argv):
if __name__ == "__main__":
sys.exit(main(sys.argv))
-# vim:et:ts=4:sw=4:
-
+# vim:et:ts=4:sw=4:et:sts=4:ai:set list listchars=tab\:»·,trail\:·: