~bzr-pqm/bzr/bzr.dev

« back to all changes in this revision

Viewing changes to bzrlib/weave.py

  • Committer: Robert Collins
  • Date: 2006-03-06 12:11:25 UTC
  • mto: (1594.2.4 integration)
  • mto: This revision was merged to the branch mainline in revision 1596.
  • Revision ID: robertc@robertcollins.net-20060306121125-4f05992d44e3bda8
Convert Knit repositories to use knits.

Show diffs side-by-side

added added

removed removed

Lines of Context:
730
730
        # no lines outside of insertion blocks, that deletions are
731
731
        # properly paired, etc.
732
732
 
733
 
    def _join(self, other, pb, msg, version_ids):
 
733
    def _join(self, other, pb, msg, version_ids, ignore_missing):
734
734
        """Worker routine for join()."""
735
735
        if not other.versions():
736
736
            return          # nothing to update, easy
737
737
 
738
738
        if version_ids:
739
739
            for version_id in version_ids:
740
 
                if not self.has_version(version_id):
 
740
                if not self.has_version(version_id) and not ignore_missing:
741
741
                    raise RevisionNotPresent(version_id, self._weave_name)
742
 
        assert version_ids == None
 
742
        else:
 
743
            version_ids = other.versions()
743
744
 
744
745
        # two loops so that we do not change ourselves before verifying it
745
746
        # will be ok
746
747
        # work through in index order to make sure we get all dependencies
747
748
        names_to_join = []
748
749
        processed = 0
749
 
        for other_idx, name in enumerate(other._names):
 
750
        version_ids = set(other.versions()).intersection(set(version_ids))
 
751
        pending_graph = [(version, other.get_parents(version)) for
 
752
                         version in version_ids]
 
753
        for name in topo_sort(pending_graph):
 
754
            other_idx = other._name_map[name]
750
755
            self._check_version_consistent(other, other_idx, name)
751
756
            sha1 = other._sha1s[other_idx]
752
757
 
893
898
        """See VersionedFile.get_suffixes()."""
894
899
        return [WeaveFile.WEAVE_SUFFIX]
895
900
 
896
 
    def join(self, other, pb=None, msg=None, version_ids=None):
 
901
    def join(self, other, pb=None, msg=None, version_ids=None,
 
902
             ignore_missing=False):
897
903
        """Join other into self and save."""
898
 
        super(WeaveFile, self).join(other, pb, msg, version_ids)
 
904
        super(WeaveFile, self).join(other, pb, msg, version_ids, ignore_missing)
899
905
        self._save()
900
906
 
901
907
 
1221
1227
        except AttributeError:
1222
1228
            return False
1223
1229
 
1224
 
    def join(self, pb=None, msg=None, version_ids=None):
 
1230
    def join(self, pb=None, msg=None, version_ids=None, ignore_missing=False):
1225
1231
        """See InterVersionedFile.join."""
1226
1232
        try:
1227
 
            self.target._join(self.source, pb, msg, version_ids)
 
1233
            self.target._join(self.source, pb, msg, version_ids, ignore_missing)
1228
1234
        except errors.WeaveParentMismatch:
1229
1235
            self.target._reweave(self.source, pb, msg)
1230
1236