Fix GenerateDiff -- don't strip whitespace.

BUG=259434
R=iannucci

Review URL: https://chromiumcodereview.appspot.com/18408006

git-svn-id: svn://svn.chromium.org/chrome/trunk/tools/depot_tools@211483 0039d316-1c4b-4281-b951-d872f2087c98
diff --git a/scm.py b/scm.py
index 6f508c8..30bb3d1 100644
--- a/scm.py
+++ b/scm.py
@@ -97,13 +97,14 @@
   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 @@
     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.