Commit 0670bc0b authored by Ximin Luo's avatar Ximin Luo

presenters/formats: allow non-text formats to output an empty diff

parent e5dc438f
......@@ -85,23 +85,21 @@ class PresenterManager(object):
def output(self, difference, parsed_args, has_differences):
# As a special case, write an empty file instead of an empty diff.
if not has_differences:
target = self.config['text']['target']
if target != '-':
open(target, 'w').close()
except KeyError:
if difference is None:
for name, data in self.config.items():
logger.debug("Generating %r output at %r", name, data['target'])
# As a special case for text format, write an empty file instead of
# an empty diff (with headers including the path). This lets people
# test if the file is empty.
if not has_differences and name == 'text':
target = data['target']
if target != '-':
open(target, 'w').close()
with profile('output', name):
data['klass'].run(data, difference, parsed_args)
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment