From 725b9d34b81a1a415ac710458487a78d4f4f4e09 Mon Sep 17 00:00:00 2001 From: Matthijs Kooijman Date: Thu, 17 Dec 2009 12:54:23 +0100 Subject: Add support for a Git-Dch: Ignore metaheader. Closes: #561346 Thanks: Matthijs Kooijman --- docs/chapters/releases.sgml | 18 ++++++++++++++++++ docs/manpages/git-dch.sgml | 4 ++-- git-dch | 12 ++++++++++-- 3 files changed, 30 insertions(+), 4 deletions(-) diff --git a/docs/chapters/releases.sgml b/docs/chapters/releases.sgml index 95c2335..00fb76f 100644 --- a/docs/chapters/releases.sgml +++ b/docs/chapters/releases.sgml @@ -115,5 +115,23 @@ via &git-dch;'s option. Using This makes it much easier to see which commit actually fixed bug #1000. + +Finally, there is the header that can +currently only be set to (or omitted). When this +header is set to , the commit message is +completely ignored and will not be included in the changelog at all. +This is useful for janitorial commits or other commits that really don't +need to end up in the changelog. + + +For example, the following git commit message + +Set correct branchnames in debian/gbp.conf + +Git-Dch: Ignore + +will not show up in the generated changelog in any way. + + diff --git a/docs/manpages/git-dch.sgml b/docs/manpages/git-dch.sgml index 890df67..4c4a6f7 100644 --- a/docs/manpages/git-dch.sgml +++ b/docs/manpages/git-dch.sgml @@ -107,8 +107,8 @@ - Parse meta tags like and - . + Parse meta tags like , + and . diff --git a/git-dch b/git-dch index 1051f82..b3ceb59 100755 --- a/git-dch +++ b/git-dch @@ -198,6 +198,7 @@ def parse_commit(repo, commitid, options): msg = '' thanks = '' closes = '' + git_dch = '' bugs = {} bts_closes = re.compile(r'(?P%s):\s+%s' % (options.meta_closes, bug_r), re.I) @@ -217,6 +218,8 @@ def parse_commit(repo, commitid, options): bugs[m.group('bts')] = bug_nums elif line.startswith('Thanks: '): thanks = line.split(' ', 1)[1].strip() + elif line.startswith('Git-Dch: '): + git_dch = line.split(' ', 1)[1].strip() else: # normal commit message if msg and not options.full: continue @@ -226,6 +229,8 @@ def parse_commit(repo, commitid, options): elif line.startswith('diff '): break if options.meta: + if git_dch == 'Ignore': + return None for bts in bugs: closes += '(%s: %s) ' % (bts, ', '.join(bugs[bts])) if thanks: @@ -241,8 +246,11 @@ def shortlog_to_dch(repo, commits, options): author = 'Unknown' for commit in commits: - msg, (author, email) = parse_commit(repo, commit, options) - add_changelog_entry(msg, author, email) + 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): -- cgit v1.2.3