~bzr-pqm/bzr/bzr.dev

« back to all changes in this revision

Viewing changes to bzrlib/weave.py

  • Committer: Robert Collins
  • Date: 2006-03-04 02:30:17 UTC
  • mto: (1594.2.4 integration)
  • mto: This revision was merged to the branch mainline in revision 1596.
  • Revision ID: robertc@robertcollins.net-20060304023017-7f5f460efff7d2e8
Make join cheaper for compatibly inconsistent parents.

Show diffs side-by-side

added added

removed removed

Lines of Context:
456
456
            except IndexError:
457
457
                raise IndexError("invalid version number %r" % i)
458
458
 
 
459
    def _compatible_parents(self, my_parents, other_parents):
 
460
        """During join check that other_parents are joinable with my_parents.
 
461
 
 
462
        Joinable is defined as 'is a subset of' - supersets may require 
 
463
        regeneration of diffs, but subsets do not.
 
464
        """
 
465
        return len(other_parents.difference(my_parents)) == 0
 
466
 
459
467
    def annotate(self, version_id):
460
468
        if isinstance(version_id, int):
461
469
            warn('Weave.annotate(int) is deprecated. Please use version names'
804
812
            other_parents = other._parents[other_idx]
805
813
            n1 = set([self._names[i] for i in self_parents])
806
814
            n2 = set([other._names[i] for i in other_parents])
807
 
            if n1 != n2:
 
815
            if not self._compatible_parents(n1, n2):
808
816
                raise WeaveParentMismatch("inconsistent parents "
809
817
                    "for version {%s}: %s vs %s" % (name, n1, n2))
810
818
            else: