~bzr-pqm/bzr/bzr.dev

« back to all changes in this revision

Viewing changes to bzrlib/weave.py

  • Committer: Canonical.com Patch Queue Manager
  • Date: 2008-03-26 03:06:52 UTC
  • mfrom: (3287.5.10 integration)
  • Revision ID: pqm@pqm.ubuntu.com-20080326030652-vgwdkwda9mi8s200
Deprecate VersionedFile.get_parents. (Robert Collins)

Show diffs side-by-side

added added

removed removed

Lines of Context:
245
245
 
246
246
    __contains__ = has_version
247
247
 
248
 
    def get_parents(self, version_id):
249
 
        """See VersionedFile.get_parent."""
250
 
        return map(self._idx_to_name, self._parents[self._lookup(version_id)])
 
248
    def get_parent_map(self, version_ids):
 
249
        """See VersionedFile.get_parent_map."""
 
250
        result = {}
 
251
        for version_id in version_ids:
 
252
            try:
 
253
                result[version_id] = tuple(
 
254
                    map(self._idx_to_name, self._parents[self._lookup(version_id)]))
 
255
            except RevisionNotPresent:
 
256
                pass
 
257
        return result
 
258
 
 
259
    def get_parents_with_ghosts(self, version_id):
 
260
        raise NotImplementedError(self.get_parents_with_ghosts)
251
261
 
252
262
    def _check_repeated_add(self, name, parents, text, sha1):
253
263
        """Check that a duplicated add is OK.
758
768
        version_ids = set(other.versions()).intersection(set(version_ids))
759
769
        # pull in the referenced graph.
760
770
        version_ids = other.get_ancestry(version_ids)
761
 
        pending_graph = [(version, other.get_parents(version)) for
762
 
                         version in version_ids]
 
771
        pending_parents = other.get_parent_map(version_ids)
 
772
        pending_graph = pending_parents.items()
 
773
        if len(pending_graph) != len(version_ids):
 
774
            raise RevisionNotPresent(
 
775
                set(version_ids) - set(pending_parents.keys()), self)
763
776
        for name in topo_sort(pending_graph):
764
777
            other_idx = other._name_map[name]
765
778
            # returns True if we have it, False if we need it.
767
780
                names_to_join.append((other_idx, name))
768
781
            processed += 1
769
782
 
770
 
 
771
783
        if pb and not msg:
772
784
            msg = 'weave join'
773
785