Have git not colorize output for diffs

We need more control over diff colorization for proper rendering
and processing. Ensure that local settings don't cause us to
blow up when we're doing it.

Change-Id: I07fc445d9328c9df1ed52e8b328cce6fbea78f43
This commit is contained in:
Monty Taylor 2014-09-05 12:44:26 -07:00
parent 4cdf87687d
commit f2aacf177a

View File

@ -267,7 +267,7 @@ class Repo(object):
def diffstat(self, old, new):
repo = git.Repo(self.path)
diff = repo.git.diff('-M', '--numstat', old, new)
diff = repo.git.diff('-M', '--color=never', '--numstat', old, new)
ret = []
for x in diff.split('\n'):
# Added, removed, filename
@ -360,7 +360,8 @@ class Repo(object):
else:
extra_contexts.append(CommitContext(None, newc))
contexts = itertools.chain(
extra_contexts, oldc.diff(newc, create_patch=True, U=context))
extra_contexts, oldc.diff(
newc, color='never',create_patch=True, U=context))
for diff_context in contexts:
# Each iteration of this is a file
f = DiffFile()