diff options
author | Matthijs Kooijman <matthijs@stdin.nl> | 2009-12-18 18:16:58 +0100 |
---|---|---|
committer | Guido Günther <agx@sigxcpu.org> | 2009-12-23 20:26:10 +0100 |
commit | e54b7bf1daca28504463b0b0bb924bd56d45e66b (patch) | |
tree | f22f5a6c92822e354d877fc80aca5f1176cc9688 | |
parent | 02ab603ce799c0001bbf3b3c34182170b02d85b5 (diff) |
There was a second use of parse_commit.
Both uses of parse_commit now support the None return value. The
shortlog_to_dch function is now superfluous and was removed.
-rwxr-xr-x | git-dch | 58 |
1 files changed, 30 insertions, 28 deletions
@@ -241,18 +241,6 @@ def parse_commit(repo, commitid, options): return msg, (author, email) -def shortlog_to_dch(repo, commits, options): - """convert the changes in git shortlog format to debian changelog format""" - author = 'Unknown' - - for commit in commits: - parsed = parse_commit(repo, commit, options) - # Allow commits to be ignored. - if parsed: - msg, (author, email) = parsed - add_changelog_entry(msg, author, email) - - def guess_snapshot_commit(cp, repo, options): """ guess the last commit documented in the changelog from the snapshot banner @@ -379,25 +367,39 @@ def main(argv): else: add_section = False - if add_section: - if commits: - first_commit = commits[0] - commits = commits[1:] - commit_msg, (commit_author, commit_email) = parse_commit(repo, first_commit, options) + for c in commits: + parsed = parse_commit(repo, c, options) + if not parsed: + # Some commits can be ignored + continue + + commit_msg, (commit_author, commit_email) = parsed + 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, + version=options.new_version, author=commit_author, + email=commit_email) + # Adding a section only needs to happen once. + add_section = False else: - commit_msg = "UNRELEASED" - commit_author = None - commit_email = None - add_changelog_section(distribution="UNRELEASED", msg=commit_msg, - version=options.new_version, author=commit_author, - email=commit_email) - - if commits: - shortlog_to_dch(repo, commits, options) - fixup_trailer(repo, git_author=options.git_author) - elif not first_commit: + add_changelog_entry(commit_msg, commit_author, commit_email) + + + # Show a message if there were no commits (not even ignored + # commits). + if not commits: print "No changes detected from %s to %s." % (since, until) + 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. + commit_msg = "UNRELEASED" + add_changelog_section(distribution="UNRELEASED", msg="UNRELEASED", + version=options.new_version) + + fixup_trailer(repo, git_author=options.git_author) + if options.release: do_release(changelog, cp) elif options.snapshot: |