~ace17/bzr/fixDiff4

« back to all changes in this revision

Viewing changes to bzrlib/diff.py

  • Committer: Sebastien Alaiwan
  • Date: 2014-06-11 19:06:03 UTC
  • Revision ID: sebastien.alaiwan@gmail.com-20140611190603-aij5jbn0kmghexmy
Avoid calling 'external_diff' with options passed to --diff-options if --using is specified. Fixes the following from failing 'bzr add somefile.txt ; bzr diff --using gvimdiff --diff-options '-f -n -d'

Show diffs side-by-side

added added

removed removed

Lines of Context:
930
930
        """
931
931
        if using is not None:
932
932
            extra_factories = [DiffFromTool.make_from_diff_tree(using, external_diff_options)]
 
933
            diff_file = internal_diff
933
934
        else:
934
935
            extra_factories = []
935
 
        if external_diff_options:
936
 
            opts = external_diff_options.split()
937
 
            def diff_file(olab, olines, nlab, nlines, to_file, path_encoding=None, context_lines=None):
938
 
                """:param path_encoding: not used but required
939
 
                        to match the signature of internal_diff.
940
 
                """
941
 
                external_diff(olab, olines, nlab, nlines, to_file, opts)
942
 
        else:
943
 
            diff_file = internal_diff
 
936
            if external_diff_options:
 
937
                opts = external_diff_options.split()
 
938
                def diff_file(olab, olines, nlab, nlines, to_file, path_encoding=None, context_lines=None):
 
939
                    """:param path_encoding: not used but required
 
940
                            to match the signature of internal_diff.
 
941
                    """
 
942
                    external_diff(olab, olines, nlab, nlines, to_file, opts)
 
943
            else:
 
944
                diff_file = internal_diff
944
945
        diff_text = DiffText(old_tree, new_tree, to_file, path_encoding,
945
946
                             old_label, new_label, diff_file, context_lines=context_lines)
946
947
        return klass(old_tree, new_tree, to_file, path_encoding, diff_text,