diff options
author | Luis R. Rodriguez <mcgrof@do-not-panic.com> | 2014-04-02 11:38:16 +0000 |
---|---|---|
committer | Luis R. Rodriguez <mcgrof@do-not-panic.com> | 2014-04-08 18:16:21 -0700 |
commit | 3d7489a0ac33f7c5c2b4173cc2accf989b1b1c5e (patch) | |
tree | 1398ebbcef254755b077c861df5b5613d7b20fa8 | |
parent | c723126011159cd18b9646e283f58bb4e79abf50 (diff) |
backports: add git diff support to lib/bpgit.py
This will be used later for proving SmPL patches against
legacy patch series.
Signed-off-by: Luis R. Rodriguez <mcgrof@do-not-panic.com>
-rw-r--r-- | lib/bpgit.py | 12 |
1 files changed, 12 insertions, 0 deletions
diff --git a/lib/bpgit.py b/lib/bpgit.py index f56e377a..f4b53c4c 100644 --- a/lib/bpgit.py +++ b/lib/bpgit.py @@ -328,3 +328,15 @@ def reset(opts=[], tree=None): close_fds=True, universal_newlines=True, cwd=tree) process.wait() _check(process) + +def diff(tree=None, extra_args=None): + cmd = ['git', 'diff', '--color=always'] + extra_args + + process = subprocess.Popen(cmd, + stdout=subprocess.PIPE, stderr=subprocess.STDOUT, + close_fds=True, universal_newlines=True, cwd=tree) + stdout = process.communicate()[0] + process.wait() + _check(process) + + return stdout |