Loading diffoscope/presenters/formats.py +16 −7 Original line number Diff line number Diff line Loading @@ -76,7 +76,7 @@ class PresenterManager(object): # If no output specified, default to printing --text output to stdout if not self.config: parsed_args.text_output = FORMATS['text']['target'] = '-' FORMATS['text']['target'] = '-' self.config['text'] = FORMATS['text'] logger.debug( Loading @@ -85,16 +85,25 @@ 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: try: target = self.config['text']['target'] if target != '-': open(target, 'w').close() except KeyError: pass return if difference is None: return for name, data in self.config.items(): logger.debug("Generating %r output at %r", name, data['target']) with profile('output', name): data['klass'].run( data, difference, parsed_args, has_differences, ) data['klass'].run(data, difference, parsed_args) def compute_visual_diffs(self): """ Loading diffoscope/presenters/html/html.py +2 −2 Original line number Diff line number Diff line Loading @@ -82,7 +82,7 @@ class HTMLPresenter(Presenter): supports_visual_diffs = True @classmethod def run(cls, data, difference, parsed_args, has_differences): def run(cls, data, difference, parsed_args): with make_printer(parsed_args.html_output) as fn: output_html( difference, Loading @@ -93,7 +93,7 @@ class HTMLPresenter(Presenter): class HTMLDirectoryPresenter(HTMLPresenter): @classmethod def run(cls, data, difference, parsed_args, has_differences): def run(cls, data, difference, parsed_args): output_html_directory( parsed_args.html_output_directory, difference, Loading diffoscope/presenters/text.py +2 −7 Original line number Diff line number Diff line Loading @@ -44,13 +44,8 @@ class TextPresenter(Presenter): super().__init__() @classmethod def run(cls, data, difference, parsed_args, has_differences): # As a special case, write an empty file instead of an empty diff. if not has_differences: open(parsed_args.text_output, 'w').close() return with make_printer(parsed_args.text_output or '-') as fn: def run(cls, data, difference, parsed_args): with make_printer(data['target']) as fn: color = { 'auto': fn.output.isatty(), 'never': False, Loading diffoscope/presenters/utils.py +1 −1 Original line number Diff line number Diff line Loading @@ -29,7 +29,7 @@ class Presenter(object): self.depth = 0 @classmethod def run(cls, data, difference, parsed_args, has_differences): def run(cls, data, difference, parsed_args): with make_printer(data['target']) as fn: cls(fn).start(difference) Loading Loading
diffoscope/presenters/formats.py +16 −7 Original line number Diff line number Diff line Loading @@ -76,7 +76,7 @@ class PresenterManager(object): # If no output specified, default to printing --text output to stdout if not self.config: parsed_args.text_output = FORMATS['text']['target'] = '-' FORMATS['text']['target'] = '-' self.config['text'] = FORMATS['text'] logger.debug( Loading @@ -85,16 +85,25 @@ 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: try: target = self.config['text']['target'] if target != '-': open(target, 'w').close() except KeyError: pass return if difference is None: return for name, data in self.config.items(): logger.debug("Generating %r output at %r", name, data['target']) with profile('output', name): data['klass'].run( data, difference, parsed_args, has_differences, ) data['klass'].run(data, difference, parsed_args) def compute_visual_diffs(self): """ Loading
diffoscope/presenters/html/html.py +2 −2 Original line number Diff line number Diff line Loading @@ -82,7 +82,7 @@ class HTMLPresenter(Presenter): supports_visual_diffs = True @classmethod def run(cls, data, difference, parsed_args, has_differences): def run(cls, data, difference, parsed_args): with make_printer(parsed_args.html_output) as fn: output_html( difference, Loading @@ -93,7 +93,7 @@ class HTMLPresenter(Presenter): class HTMLDirectoryPresenter(HTMLPresenter): @classmethod def run(cls, data, difference, parsed_args, has_differences): def run(cls, data, difference, parsed_args): output_html_directory( parsed_args.html_output_directory, difference, Loading
diffoscope/presenters/text.py +2 −7 Original line number Diff line number Diff line Loading @@ -44,13 +44,8 @@ class TextPresenter(Presenter): super().__init__() @classmethod def run(cls, data, difference, parsed_args, has_differences): # As a special case, write an empty file instead of an empty diff. if not has_differences: open(parsed_args.text_output, 'w').close() return with make_printer(parsed_args.text_output or '-') as fn: def run(cls, data, difference, parsed_args): with make_printer(data['target']) as fn: color = { 'auto': fn.output.isatty(), 'never': False, Loading
diffoscope/presenters/utils.py +1 −1 Original line number Diff line number Diff line Loading @@ -29,7 +29,7 @@ class Presenter(object): self.depth = 0 @classmethod def run(cls, data, difference, parsed_args, has_differences): def run(cls, data, difference, parsed_args): with make_printer(data['target']) as fn: cls(fn).start(difference) Loading