summaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
authorMarkus Lehtonen <markus.lehtonen@linux.intel.com>2012-10-30 08:56:19 +0200
committerGuido Günther <agx@sigxcpu.org>2012-11-24 12:20:54 +0100
commit3362147479b89918a09efc8a698111e28c78f10c (patch)
tree3835f3edc38fdc9ff38729f697cb7a5f39fab958
parent24fdd97267ec03e0b7b94afcd5cefb56772df1e4 (diff)
GitRepository/get_commit_info: support tags
Dereference the given revision to a commit. Fixes get_commit_info() when called for a tag. Signed-off-by: Markus Lehtonen <markus.lehtonen@linux.intel.com>
-rw-r--r--gbp/git/repository.py14
1 files changed, 8 insertions, 6 deletions
diff --git a/gbp/git/repository.py b/gbp/git/repository.py
index b2df4eaf..265ea3fc 100644
--- a/gbp/git/repository.py
+++ b/gbp/git/repository.py
@@ -1316,20 +1316,22 @@ class GitRepository(object):
% commit)
return out[0].strip()
- def get_commit_info(self, commit):
+ def get_commit_info(self, commitish):
"""
- Look up data of a specific commit
+ Look up data of a specific commit-ish. Dereferences given commit-ish
+ to the commit it points to.
- @param commit: the commit to inspect
+ @param commitish: the commit-ish to inspect
@return: the commit's including id, author, email, subject and body
@rtype: dict
"""
+ commit_sha1 = self.rev_parse("%s^0" % commitish)
args = GitArgs('--pretty=format:%an%x00%ae%x00%ad%x00%cn%x00%ce%x00%cd%x00%s%x00%b%x00',
- '-z', '--date=raw', '--name-status', commit)
+ '-z', '--date=raw', '--name-status', commit_sha1)
out, err, ret = self._git_inout('show', args.args)
if ret:
raise GitRepositoryError("Unable to retrieve commit info for %s"
- % commit)
+ % commitish)
fields = out.split('\x00')
@@ -1349,7 +1351,7 @@ class GitRepository(object):
path = file_fields.pop(0)
files[status].append(path)
- return {'id' : commit,
+ return {'id' : commitish,
'author' : author,
'committer' : committer,
'subject' : fields[6],