diff options
author | Zhang Qiang <qiang.z.zhang@intel.com> | 2012-06-08 09:31:13 +0800 |
---|---|---|
committer | Zhang Qiang <qiang.z.zhang@intel.com> | 2012-06-08 09:31:13 +0800 |
commit | d8d30a5b813170fc2e58338d6b280b1628ae742c (patch) | |
tree | 3c2c6a9dc6485e160aefdb1b9be0404b7d1fcdd0 | |
parent | 7fb6881257fef19bac6f29e680e68f5f67a91654 (diff) | |
download | git-buildpackage-d8d30a5b813170fc2e58338d6b280b1628ae742c.tar.gz git-buildpackage-d8d30a5b813170fc2e58338d6b280b1628ae742c.tar.bz2 git-buildpackage-d8d30a5b813170fc2e58338d6b280b1628ae742c.zip |
extend git.get_commit_info to get commit file status
-rw-r--r-- | gbp/git/repository.py | 15 |
1 files changed, 13 insertions, 2 deletions
diff --git a/gbp/git/repository.py b/gbp/git/repository.py index 1e27452b..5730ce0b 100644 --- a/gbp/git/repository.py +++ b/gbp/git/repository.py @@ -19,6 +19,7 @@ import re import subprocess import os.path +from collections import defaultdict import gbp.log as log from gbp.command_wrappers import (GitCommand, CommandExecFailed) @@ -1130,16 +1131,26 @@ class GitRepository(object): """ out, ret = self._git_getoutput('log', ['--pretty=format:%an%n%ae%n%at%n%s%n%b%n', - '-n1', commit]) + '-n1', '--name-status', commit]) if ret: raise GitRepositoryError("Unable to retrieve log entry for %s" % commit) + + files = defaultdict(list) + for line in reversed(out): + if not line.strip(): + break + key, val = line.strip().split(None, 1) + files[key].append(val) + out.remove(line) + return {'id' : commit, 'author' : out[0].strip(), 'email' : out[1].strip(), 'timestamp': out[2].strip(), 'subject' : out[3].rstrip(), - 'body' : [line.rstrip() for line in out[4:]]} + 'body' : [line.rstrip() for line in out[4:]], + 'files' : files} #{ Patches |