summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMarkus Lehtonen <markus.lehtonen@linux.intel.com>2012-08-07 16:22:00 +0300
committerMarkus Lehtonen <markus.lehtonen@linux.intel.com>2012-09-18 13:11:45 +0300
commit1a360d65f62c031e1905514d7be9e6648f8b9294 (patch)
treedaeffdc31dae8fe71219c16ba9a41390f0a51cb8
parent9a1245ba29af87fffa084094cd7f113a0f2659e0 (diff)
downloadgit-buildpackage-1a360d65f62c031e1905514d7be9e6648f8b9294.tar.gz
git-buildpackage-1a360d65f62c031e1905514d7be9e6648f8b9294.tar.bz2
git-buildpackage-1a360d65f62c031e1905514d7be9e6648f8b9294.zip
GitRepository/get_commit_info: add patchname to info
Add a new 'patchname' field to the information returned by get_commit_info. That is, the subject in a sanitized format, similar to what git-format-patch uses. Signed-off-by: Markus Lehtonen <markus.lehtonen@linux.intel.com>
-rw-r--r--gbp/git/repository.py7
-rw-r--r--tests/test_GitRepository.py2
2 files changed, 6 insertions, 3 deletions
diff --git a/gbp/git/repository.py b/gbp/git/repository.py
index 5df55713..b1e79059 100644
--- a/gbp/git/repository.py
+++ b/gbp/git/repository.py
@@ -1335,7 +1335,7 @@ class GitRepository(object):
@return: the commit's including id, author, email, subject and body
@rtype: dict
"""
- args = GitArgs('--pretty=format:%an%x00%ae%x00%ad%x00%cn%x00%ce%x00%cd%x00%s%x00%b%x00',
+ args = GitArgs('--pretty=format:%an%x00%ae%x00%ad%x00%cn%x00%ce%x00%cd%x00%s%x00%f%x00%b%x00',
'-z', '--date=raw', '--name-status', commit)
out, err, ret = self._git_inout('show', args.args)
if ret:
@@ -1352,7 +1352,7 @@ class GitRepository(object):
fields[5].strip())
files = defaultdict(list)
- file_fields = fields[8:]
+ file_fields = fields[9:]
# For some reason git returns one extra empty field for merge commits
if file_fields[0] == '': file_fields.pop(0)
while len(file_fields) and file_fields[0] != '':
@@ -1364,7 +1364,8 @@ class GitRepository(object):
'author' : author,
'committer' : committer,
'subject' : fields[6],
- 'body' : fields[7],
+ 'patchname' : fields[7],
+ 'body' : fields[8],
'files' : files}
#{ Patches
diff --git a/tests/test_GitRepository.py b/tests/test_GitRepository.py
index 5a97d314..c4200c02 100644
--- a/tests/test_GitRepository.py
+++ b/tests/test_GitRepository.py
@@ -412,6 +412,8 @@ def test_get_commit_info():
True
>>> (now - datetime.fromtimestamp(int(info['committer'].date.split()[0]))).seconds < 10
True
+ >>> info['patchname']
+ 'foo'
>>> info['files']
defaultdict(<type 'list'>, {'M': ['testfile']})
"""