~bzr-pqm/bzr/bzr.dev

« back to all changes in this revision

Viewing changes to bzrlib/weave.py

  • Committer: Robert Collins
  • Date: 2005-10-06 00:52:53 UTC
  • Revision ID: robertc@robertcollins.net-20051006005253-415c38ad22094f13
define some expected behaviour for inventory_entry.snapshot

Show diffs side-by-side

added added

removed removed

Lines of Context:
805
805
 
806
806
    def _check_version_consistent(self, other, other_idx, name):
807
807
        """Check if a version in consistent in this and other.
808
 
 
809
 
        To be consistent it must have:
810
 
 
811
 
         * the same text
812
 
         * the same direct parents (by name, not index, and disregarding
813
 
           order)
814
808
        
815
809
        If present & correct return True;
816
810
        if not present in self return False; 
818
812
        this_idx = self._name_map.get(name, -1)
819
813
        if this_idx != -1:
820
814
            if self._sha1s[this_idx] != other._sha1s[other_idx]:
821
 
                raise WeaveError("inconsistent texts for version {%s} "
822
 
                                 "when joining weaves"
823
 
                                 % (name))
824
 
            self_parents = self._parents[this_idx]
825
 
            other_parents = other._parents[other_idx]
826
 
            n1 = [self._names[i] for i in self_parents]
827
 
            n2 = [other._names[i] for i in other_parents]
828
 
            n1.sort()
829
 
            n2.sort()
830
 
            if n1 != n2:
831
 
                raise WeaveError("inconsistent parents for version {%s}: "
832
 
                                 "%s vs %s"
833
 
                                 % (name, n1, n2))
 
815
                raise WeaveError("inconsistent texts for version {%s} in %r and %r"
 
816
                                 % (name, self, other))
 
817
            elif set(self._parents[this_idx]) != set(other._parents[other_idx]):
 
818
                raise WeaveError("inconsistent parents for version {%s} in %r and %r"
 
819
                                 % (name, self, other))
834
820
            else:
835
821
                return True         # ok!
836
822
        else: