summaryrefslogtreecommitdiff
path: root/gbp/git
diff options
context:
space:
mode:
authorMarkus Lehtonen <markus.lehtonen@linux.intel.com>2012-11-29 19:17:59 +0200
committerGuido Günther <agx@sigxcpu.org>2013-09-04 22:08:40 +0200
commit0eeafba4381cf2d82475b59a0488c6467b668959 (patch)
treedb0b8efe5ac3c0852d0d6b75036a1b2885c74339 /gbp/git
parente72a1e269e32d06616f345a44f536864806540c9 (diff)
GitRepository/diff: add 'stat' and 'summary' options
For getting diffstat and summary in the output. Signed-off-by: Markus Lehtonen <markus.lehtonen@linux.intel.com>
Diffstat (limited to 'gbp/git')
-rw-r--r--gbp/git/repository.py13
1 files changed, 11 insertions, 2 deletions
diff --git a/gbp/git/repository.py b/gbp/git/repository.py
index a9204c5..9f1987f 100644
--- a/gbp/git/repository.py
+++ b/gbp/git/repository.py
@@ -1481,7 +1481,7 @@ class GitRepository(object):
args.append(patch)
self._git_command("apply", args)
- def diff(self, obj1, obj2=None, paths=None):
+ def diff(self, obj1, obj2=None, paths=None, stat=False, summary=False):
"""
Diff two git repository objects
@@ -1491,10 +1491,19 @@ class GitRepository(object):
@type obj2: C{str}
@param paths: List of paths to diff
@type paths: C{list}
+ @param stat: Show diffstat
+ @type stat: C{bool} or C{int} or C{str}
+ @param summary: Show diffstat
+ @type summary: C{bool}
@return: diff
@rtype: C{str}
"""
- options = GitArgs()
+ options = GitArgs('-p')
+ if stat is True:
+ options.add('--stat')
+ elif stat:
+ options.add('--stat=%s' % stat)
+ options.add_true(summary, '--summary')
options.add(obj1)
options.add_true(obj2, obj2)
if paths: