Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(1047)

Unified Diff: scm.py

Issue 18408006: Fix GenerateDiff -- don't strip whitespace. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/tools/depot_tools
Patch Set: Address iannucci comments Created 7 years, 5 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: scm.py
diff --git a/scm.py b/scm.py
index 6f508c83ab2b7a2e3ec9e266028164c14e0c2735..30bb3d17ea49bd74c0a83af490bbc486d60e3f41 100644
--- a/scm.py
+++ b/scm.py
@@ -97,13 +97,14 @@ class GIT(object):
current_version = None
@staticmethod
- def Capture(args, cwd, **kwargs):
+ def Capture(args, cwd, strip_out=True, **kwargs):
env = os.environ.copy()
# 'cat' is a magical git string that disables pagers on all platforms.
env['GIT_PAGER'] = 'cat'
- return subprocess2.check_output(
+ output = subprocess2.check_output(
['git'] + args,
- cwd=cwd, stderr=subprocess2.PIPE, env=env, **kwargs).strip()
+ cwd=cwd, stderr=subprocess2.PIPE, env=env, **kwargs)
+ return output.strip() if strip_out else output
@staticmethod
def CaptureStatus(files, cwd, upstream_branch):
@@ -359,7 +360,7 @@ class GIT(object):
if files:
command.append('--')
command.extend(files)
- diff = GIT.Capture(command, cwd=cwd).splitlines(True)
+ diff = GIT.Capture(command, cwd=cwd, strip_out=False).splitlines(True)
for i in range(len(diff)):
# In the case of added files, replace /dev/null with the path to the
# file being added.
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698