/brz/remove-bazaar

To get this branch, use:
bzr branch http://gegoxaren.bato24.eu/bzr/brz/remove-bazaar

« back to all changes in this revision

Viewing changes to breezy/diff.py

  • Committer: Breezy landing bot
  • Author(s): Jelmer Vernooij
  • Date: 2019-06-15 14:43:05 UTC
  • mfrom: (7131.11.4 diff-tree-reference)
  • Revision ID: breezy.the.bot@gmail.com-20190615144305-a9tq8mn0139sidim
Support running diff on tree references.

Merged from https://code.launchpad.net/~jelmer/brz/diff-tree-reference/+merge/355881

Show diffs side-by-side

added added

removed removed

Lines of Context:
638
638
            self.differs, old_path, new_path, None, new_kind)
639
639
 
640
640
 
 
641
class DiffTreeReference(DiffPath):
 
642
 
 
643
    def diff(self, old_path, new_path, old_kind, new_kind):
 
644
        """Perform comparison between two tree references.  (dummy)
 
645
 
 
646
        """
 
647
        if 'tree-reference' not in (old_kind, new_kind):
 
648
            return self.CANNOT_DIFF
 
649
        if old_kind not in ('tree-reference', None):
 
650
            return self.CANNOT_DIFF
 
651
        if new_kind not in ('tree-reference', None):
 
652
            return self.CANNOT_DIFF
 
653
        return self.CHANGED
 
654
 
 
655
 
641
656
class DiffDirectory(DiffPath):
642
657
 
643
658
    def diff(self, old_path, new_path, old_kind, new_kind):
948
963
    # list of factories that can provide instances of DiffPath objects
949
964
    # may be extended by plugins.
950
965
    diff_factories = [DiffSymlink.from_diff_tree,
951
 
                      DiffDirectory.from_diff_tree]
 
966
                      DiffDirectory.from_diff_tree,
 
967
                      DiffTreeReference.from_diff_tree]
952
968
 
953
969
    def __init__(self, old_tree, new_tree, to_file, path_encoding='utf-8',
954
970
                 diff_text=None, extra_factories=None):