From: Luis R. Rodriguez Date: Wed, 2 Apr 2014 11:38:16 +0000 (+0000) Subject: backports: add git diff support to lib/bpgit.py X-Git-Url: http://git.lede-project.org./?a=commitdiff_plain;h=3d7489a0ac33f7c5c2b4173cc2accf989b1b1c5e;p=openwrt%2Fstaging%2Fblogic.git 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 --- diff --git a/lib/bpgit.py b/lib/bpgit.py index f56e377a9642..f4b53c4c672a 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