aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGuido Guenther <agx@sigxcpu.org>2008-04-09 19:57:46 +0200
committerGuido Guenther <agx@sigxcpu.org>2008-04-09 19:57:46 +0200
commit095adad44ed11bd9d60ff0335e6cfaa4b07584c9 (patch)
treee0a2c29128d977590606739e71a0b8c753a6f825
parent180c55b2d932f1c83c1174ae88b0ca11f411da6a (diff)
parent9e5d1c5e8f95cf4c4e970ccbafc3757ff47e9b98 (diff)
Merge branch '0.4.22' into bpo-etch
Conflicts: debian/changelog
-rw-r--r--debian/changelog15
-rw-r--r--docs/chapters/building.sgml2
-rw-r--r--docs/chapters/intro.sgml8
-rw-r--r--docs/chapters/releases.sgml20
-rw-r--r--docs/manpages/git-dch.sgml16
-rw-r--r--gbp.conf2
-rw-r--r--gbp/command_wrappers.py2
-rw-r--r--gbp/git_utils.py19
-rwxr-xr-xgit-dch83
9 files changed, 124 insertions, 43 deletions
diff --git a/debian/changelog b/debian/changelog
index 0600df8..3ebaefc 100644
--- a/debian/changelog
+++ b/debian/changelog
@@ -1,3 +1,18 @@
+git-buildpackage (0.4.22) unstable; urgency=low
+ * git-dch: don't skip meta tags without --force
+ * gbp: git-core 1.5.3.4 doesn't support -q so use --quiet instead
+ * fix typos in documentation (Closes: #471582) - thanks to Michael
+ Biebl
+
+ -- Guido Guenther <agx@sigxcpu.org> Wed, 19 Mar 2008 18:03:20 +0100
+
+git-buildpackage (0.4.21) unstable; urgency=low
+
+ * allow meta tags in the commit logs
+ * add --full and --meta options --full (Closes: #468118)
+
+ -- Guido Guenther <agx@sigxcpu.org> Fri, 14 Mar 2008 20:42:53 +0100
+
git-buildpackage (0.4.20~bpo40+1) etch-backports; urgency=low
* Rebuild for etch-backports.
diff --git a/docs/chapters/building.sgml b/docs/chapters/building.sgml
index 02ed91b..0025744 100644
--- a/docs/chapters/building.sgml
+++ b/docs/chapters/building.sgml
@@ -60,7 +60,7 @@ export-dir=../build-area
</para>
</sect1>
<sect1 id="gbp.building.push">
- <title>Pushing into a remote repository:</title>
+ <title>Pushing into a remote repository</title>
<para>If you want to push your changes automatically after a succesful build and tag
you can use &git-buildpackage;'s posttag hook:
<programlisting>
diff --git a/docs/chapters/intro.sgml b/docs/chapters/intro.sgml
index 32e9b83..c5a5621 100644
--- a/docs/chapters/intro.sgml
+++ b/docs/chapters/intro.sgml
@@ -11,8 +11,8 @@
<listitem><para>Import an existing &debian; package into &git;</para></listitem>
<listitem><para>Import new upstream versions, NMUs etc. with optional filters</para></listitem>
<listitem><para>Automatic upstream tarball generation</para></listitem>
- <listitem><para>Maintain a consistent branch an tag naming across
- repositires or across a team of developers</para></listitem>
+ <listitem><para>Maintain a consistent branch and tag naming across
+ repositories or across a team of developers</para></listitem>
<listitem><para>Automatically sign tags</para></listitem>
<listitem><para>Automatically push changes to remote repositories</para></listitem>
<listitem><para>Make sure you have committed all changes to the right
@@ -51,11 +51,11 @@
and you can work with an arbitrary number of branches.
For example branches like <emphasis>nmu</emphasis>,
<emphasis>bpo</emphasis> or <emphasis>stable</emphasis> might
- (temporarilly or permanent) become your <option>debian-branch</option>
+ (temporarily or permanent) become your <option>debian-branch</option>
and branches like <emphasis>dfsg_free</emphasis> or
<emphasis>snapshots</emphasis> might become your
<option>upstream-branch</option> - it doesn't matter if these branches
- are maintend with &git-import-orig; or not.</para>
+ are maintained with &git-import-orig; or not.</para>
<para>Since Git-Buildpackage only works with local &git;-repositories
you have to use <command>git-push</command> in order to publish your
changes to remote repositories like <ulink
diff --git a/docs/chapters/releases.sgml b/docs/chapters/releases.sgml
index 1509ae1..4e1874b 100644
--- a/docs/chapters/releases.sgml
+++ b/docs/chapters/releases.sgml
@@ -78,4 +78,24 @@ You can also add the snapshot-number calculation to <filename>gbp.conf</filename
snapshot-number = os.popen("git-log --pretty=oneline | wc -l").readlines()[0]
</programlisting>
</sect1>
+<sect1 id="gbp.release.commit">
+ <title>More on commit messages</title>
+ <para>You can use <option>--full</option> to include the full commit
+ message in the changelog, note that you will lose the formatting though,
+ since &dch; wraps lines by itself.</para>
+ <para>Additionally you can use tags to customize the commit message, for
+ example the git commit message
+<screen>
+New upstream version
+
+Closes: #1000
+Thanks: cool upstream
+</screen>
+ would result in a changelog entry
+<screen>
+ * New upstream version (Closes: #1000) - thanks to cool upstream
+</screen>
+You can use multiple <option>Closes:</option> tags.
+</para>
+</sect1>
</chapter>
diff --git a/docs/manpages/git-dch.sgml b/docs/manpages/git-dch.sgml
index 9f1eccb..b9aa16b 100644
--- a/docs/manpages/git-dch.sgml
+++ b/docs/manpages/git-dch.sgml
@@ -28,6 +28,8 @@
<arg><option>--snapshot</option></arg>
<arg><option>--release</option></arg>
<arg><option>--auto</option></arg>
+ <arg><option>--full</option></arg>
+ <arg><option>--meta</option></arg>
<arg><option>--snapshot-number=</option><replaceable>expression</replaceable></arg>
<arg><option>--git-log=</option><replaceable>git-log-options</replaceable></arg>
<arg choice="plain"><replaceable>[path1 path2]</replaceable></arg>
@@ -98,6 +100,20 @@
snapshot banner (or from the last tag if no snapshot banner exists).
</para>
</listitem>
+ </varlistentry>
+ <varlistentry>
+ <term><option>--meta</option></term>
+ <listitem>
+ <para>Parse meta tags like <option>Closes:</option> and
+ <option>Thanks:</option>. </para>
+ </listitem>
+ </varlistentry>
+ <varlistentry>
+ <term><option>--full</option></term>
+ <listitem>
+ <para>Include the full commit message in the changelog output</para>
+ </listitem>
+ </varlistentry>
<varlistentry>
<term><option>--snapshot</option></term>
<listitem>
diff --git a/gbp.conf b/gbp.conf
index 0508209..b9a65bb 100644
--- a/gbp.conf
+++ b/gbp.conf
@@ -24,7 +24,7 @@
#keyid = 0xdeadbeef
# push to a remote repository after a successful tag:
#posttag = git-push git.example.com
-# use this for more svn-buildpackage like bahaviour:
+# use this for more svn-buildpackage like behaviour:
#export-dir = ../build-area/
#tarball-dir = ../tarballs/
diff --git a/gbp/command_wrappers.py b/gbp/command_wrappers.py
index 45692da..91e476e 100644
--- a/gbp/command_wrappers.py
+++ b/gbp/command_wrappers.py
@@ -206,7 +206,7 @@ class GitAdd(GitCommand):
class GitRm(GitCommand):
"""Wrap git rm to remove files"""
def __init__(self, verbose=False):
- args = [ ['-q'], [] ][verbose]
+ args = [ ['--quiet'], [] ][verbose]
GitCommand.__init__(self, cmd='rm', args=args)
self.run_error = "Couldn't remove files"
diff --git a/gbp/git_utils.py b/gbp/git_utils.py
index 90802cc..72abdd9 100644
--- a/gbp/git_utils.py
+++ b/gbp/git_utils.py
@@ -27,7 +27,6 @@ class GitRepository(object):
if os.getcwd() != self.path:
raise GitRepositoryError
-
def __git_getoutput(self, command, args=[]):
"""exec a git command and return the output"""
output = []
@@ -67,7 +66,7 @@ class GitRepository(object):
for line in self.__git_getoutput('branch', [ '--no-color' ])[0]:
if line.startswith('*'):
return line.split(' ', 1)[1].strip()
-
+
def is_clean(self):
"""does the repository contain any uncommitted modifications"""
@@ -93,6 +92,22 @@ class GitRepository(object):
else:
return []
+ def commits(self, start, end, paths, options):
+ """get commits from start to end touching pathds"""
+ commits, ret = self.__git_getoutput('log', ['--pretty=format:%H',
+ options, '%s..%s' % (start, end),
+ '--', paths])
+ if ret:
+ raise GitRepositoryError, "Error gettint commits %s..%s on %s" % (start, end, paths)
+ return [ commit.strip() for commit in commits ]
+
+ def show(self, id):
+ """git-show id"""
+ commit, ret = self.__git_getoutput('show', [ id ])
+ if ret:
+ raise GitRepositoryError, "can't get %s" % id
+ return commit
+
def build_tag(format, version):
"""Generate a tag from a given format and a version"""
diff --git a/git-dch b/git-dch
index cb0e015..9935f0f 100755
--- a/git-dch
+++ b/git-dch
@@ -32,22 +32,6 @@ from gbp.command_wrappers import (Command, CommandExecFailed)
snapshot_re = "\s*\*\* SNAPSHOT build @(?P<commit>[a-z0-9]+)\s+\*\*"
-def get_log(start, end, options, paths):
- """Get the shortlog from commit 'start' to commit 'end'"""
- try:
- p1 = subprocess.Popen("git-log %s %s...%s -- %s" % (options, start, end, paths), shell=True,
- stdout=subprocess.PIPE)
- p2 = subprocess.Popen(["git-shortlog"], stdin=p1.stdout, stdout=subprocess.PIPE)
- changes = p2.communicate()[0].split('\n')
- except OSError, err:
- raise GbpError, "Cannot get changes: %s" % err
- except ValueError, err:
- raise GbpError, "Cannot get changes: %s" % err
- if p1.wait() or p2.wait():
- raise GbpError, "Cannot get changes, use --since."
- return changes
-
-
def system(cmd):
try:
Command(cmd, shell=True)()
@@ -155,25 +139,52 @@ def do_snapshot(changelog, next_snapshot):
return snapshot, commit
-def shortlog_to_dch(changes):
- """convert the changes in git shortlog format to debian changelog format"""
+def parse_commit(repo, commit,meta, short):
+ """parse a commit and return message and author"""
+ author_re = re.compile('Author: (?P<author>.*) <(?P<email>.*)>')
+ msg = ''
+ thanks = ''
+ closes = ''
+ bugs = []
+
+ commit = repo.show(commit)
+ m = author_re.match(commit[1])
+ if not m:
+ raise GbpError, "can't parse author of commit %s" % commit
+ else:
+ author = m.group('author')
+ for line in commit[4:]:
+ if line.startswith(' '): # commit body
+ line = line[4:]
+ if line.startswith('Closes: '):
+ bugs += [ line.split(' ', 1)[1].strip() ]
+ elif line.startswith('Thanks: '):
+ thanks = line.split(' ', 1)[1].strip()
+ else: # normal commit message
+ if short and msg:
+ continue
+ elif line.strip(): # don't add all whitespace lines
+ msg += line
+ else:
+ break
+ if meta:
+ if bugs:
+ closes = ' (Closes: %s)' % ', '.join(bugs)
+ if thanks:
+ thanks = ' - thanks to %s' % thanks
+ msg += closes + thanks
+ return msg, author
+
+
+def shortlog_to_dch(repo, commits, meta, short):
+ """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'
- for line in changes:
- r = commit_re.match(line)
- msg = ''
- if r:
- msg = r.group('msg')
- else:
- r = author_re.match(line)
- if r:
- author = r.group('author')
- elif line:
- print >>sys.stderr, "Unknown changelog line: %s" % line
- if msg:
- add_changelog_entry(msg, author)
+ for commit in commits:
+ msg, author = parse_commit(repo, commit, meta, short)
+ add_changelog_entry(msg, author)
def guess_snapshot_commit(cp):
@@ -209,6 +220,10 @@ def main(argv):
help="mark as snapshot build")
parser.add_option("-a", "--auto", action="store_true", dest="auto", default=False,
help="autocomplete changelog from last snapshot or tag")
+ parser.add_option("--meta", action="store_true", dest="meta", default=False,
+ help="parse meta tags in commit messages")
+ parser.add_option("--full", action="store_false", dest="short", default=True,
+ help="include the full commit message")
(options, args) = parser.parse_args(argv[1:])
if options.snapshot and options.release:
@@ -246,11 +261,11 @@ def main(argv):
if args:
print "Only looking for changes on '%s'" % " ".join(args)
- changes = get_log(since, until, options.git_log, " ".join(args))
- if changes:
+ commits = repo.commits(since, until, " ".join(args), options.git_log)
+ if commits:
if cp['Distribution'] != "UNRELEASED" and not found_snapshot_header:
add_changelog_section(distribution="UNRELEASED", msg="UNRELEASED")
- shortlog_to_dch(changes)
+ shortlog_to_dch(repo, commits, meta=options.meta, short=options.short)
fixup_trailer()
if options.snapshot:
(snap, version) = do_snapshot(changelog, options.snapshot_number)