The color output is convenient when manually looking at the
output. But when saving output to a file, (for example, for use in the
test suite), it's useful to have a much more minimal output.
def diff(ref_trace, src_trace):
def diff(ref_trace, src_trace):
+ isatty = sys.stdout.isatty()
+
ref_dumper = Dumper(ref_trace, options.ref_calls)
src_dumper = Dumper(src_trace, options.src_calls)
ref_dumper = Dumper(ref_trace, options.ref_calls)
src_dumper = Dumper(src_trace, options.src_calls)
diff_args = [
'diff',
'--speed-large-files',
diff_args = [
'diff',
'--speed-large-files',
+ ]
+ if isatty:
+ diff_args += [
'--old-line-format=' + start_delete + '%l' + end_delete + '\n',
'--new-line-format=' + start_insert + '%l' + end_insert + '\n',
]
'--old-line-format=' + start_delete + '%l' + end_delete + '\n',
'--new-line-format=' + start_insert + '%l' + end_insert + '\n',
]
'wdiff',
#'--terminal',
'--avoid-wraps',
'wdiff',
#'--terminal',
'--avoid-wraps',
+ ]
+ if isatty:
+ diff_args += [
'--start-delete=' + start_delete,
'--end-delete=' + end_delete,
'--start-insert=' + start_insert,
'--start-delete=' + start_delete,
'--end-delete=' + end_delete,
'--start-insert=' + start_insert,
src_dumper.dump.wait()
less = None
src_dumper.dump.wait()
less = None
- if sys.stdout.isatty():
less = subprocess.Popen(
args = ['less', '-FRXn'],
stdin = subprocess.PIPE
less = subprocess.Popen(
args = ['less', '-FRXn'],
stdin = subprocess.PIPE