~bzr-pqm/bzr/bzr.dev

« back to all changes in this revision

Viewing changes to bzrlib/repository.py

  • Committer: Jelmer Vernooij
  • Date: 2011-12-07 10:33:23 UTC
  • mfrom: (6349 +trunk)
  • mto: This revision was merged to the branch mainline in revision 6372.
  • Revision ID: jelmer@samba.org-20111207103323-1cuu4mr2vy2dwwyy
Merge bzr.dev.

Show diffs side-by-side

added added

removed removed

Lines of Context:
675
675
    def _resume_write_group(self, tokens):
676
676
        raise errors.UnsuspendableWriteGroup(self)
677
677
 
678
 
    def fetch(self, source, revision_id=None, find_ghosts=False,
679
 
            fetch_spec=None):
 
678
    def fetch(self, source, revision_id=None, find_ghosts=False):
680
679
        """Fetch the content required to construct revision_id from source.
681
680
 
682
 
        If revision_id is None and fetch_spec is None, then all content is
683
 
        copied.
 
681
        If revision_id is None, then all content is copied.
684
682
 
685
683
        fetch() may not be used when the repository is in a write group -
686
684
        either finish the current write group before using fetch, or use
692
690
        :param revision_id: If specified, all the content needed for this
693
691
            revision ID will be copied to the target.  Fetch will determine for
694
692
            itself which content needs to be copied.
695
 
        :param fetch_spec: If specified, a SearchResult or
696
 
            PendingAncestryResult that describes which revisions to copy.  This
697
 
            allows copying multiple heads at once.  Mutually exclusive with
698
 
            revision_id.
699
693
        """
700
 
        if fetch_spec is not None and revision_id is not None:
701
 
            raise AssertionError(
702
 
                "fetch_spec and revision_id are mutually exclusive.")
703
694
        if self.is_in_write_group():
704
695
            raise errors.InternalBzrError(
705
696
                "May not fetch while in a write group.")
707
698
        # TODO: lift out to somewhere common with RemoteRepository
708
699
        # <https://bugs.launchpad.net/bzr/+bug/401646>
709
700
        if (self.has_same_location(source)
710
 
            and fetch_spec is None
711
701
            and self._has_same_fallbacks(source)):
712
702
            # check that last_revision is in 'from' and then return a
713
703
            # no-operation.
716
706
                self.get_revision(revision_id)
717
707
            return 0, []
718
708
        inter = InterRepository.get(source, self)
719
 
        return inter.fetch(revision_id=revision_id,
720
 
            find_ghosts=find_ghosts, fetch_spec=fetch_spec)
 
709
        return inter.fetch(revision_id=revision_id, find_ghosts=find_ghosts)
721
710
 
722
711
    def create_bundle(self, target, base, fileobj, format=None):
723
712
        return serializer.write_bundle(self, target, base, fileobj, format)
1158
1147
                [parents_provider, other_repository._make_parents_provider()])
1159
1148
        return graph.Graph(parents_provider)
1160
1149
 
1161
 
    def revision_ids_to_search_result(self, result_set):
1162
 
        """Convert a set of revision ids to a graph SearchResult."""
1163
 
        result_parents = set()
1164
 
        for parents in self.get_graph().get_parent_map(
1165
 
            result_set).itervalues():
1166
 
            result_parents.update(parents)
1167
 
        included_keys = result_set.intersection(result_parents)
1168
 
        start_keys = result_set.difference(included_keys)
1169
 
        exclude_keys = result_parents.difference(result_set)
1170
 
        result = graph.SearchResult(start_keys, exclude_keys,
1171
 
            len(result_set), result_set)
1172
 
        return result
1173
 
 
1174
1150
    @needs_write_lock
1175
1151
    def set_make_working_trees(self, new_value):
1176
1152
        """Set the policy flag for making working trees when creating branches.
1716
1692
        self.target.fetch(self.source, revision_id=revision_id)
1717
1693
 
1718
1694
    @needs_write_lock
1719
 
    def fetch(self, revision_id=None, find_ghosts=False,
1720
 
            fetch_spec=None):
 
1695
    def fetch(self, revision_id=None, find_ghosts=False):
1721
1696
        """Fetch the content required to construct revision_id.
1722
1697
 
1723
1698
        The content is copied from self.source to self.target.