~bzr-pqm/bzr/bzr.dev

« back to all changes in this revision

Viewing changes to bzrlib/repository.py

  • Committer: Matthew Gordon
  • Date: 2010-09-29 01:57:02 UTC
  • mto: (5487.1.1 trunk)
  • mto: This revision was merged to the branch mainline in revision 5488.
  • Revision ID: mgordon@ivs3d.com-20100929015702-16w9ejt21oysws45
Tested push --no-tree ang gor it working right.

Show diffs side-by-side

added added

removed removed

Lines of Context:
2511
2511
            ancestors will be traversed.
2512
2512
        """
2513
2513
        graph = self.get_graph()
2514
 
        next_id = revision_id
2515
 
        while True:
2516
 
            if next_id in (None, _mod_revision.NULL_REVISION):
2517
 
                return
2518
 
            try:
2519
 
                parents = graph.get_parent_map([next_id])[next_id]
2520
 
            except KeyError:
2521
 
                raise errors.RevisionNotPresent(next_id, self)
2522
 
            yield next_id
2523
 
            if len(parents) == 0:
2524
 
                return
2525
 
            else:
2526
 
                next_id = parents[0]
 
2514
        stop_revisions = (None, _mod_revision.NULL_REVISION)
 
2515
        return graph.iter_lefthand_ancestry(revision_id, stop_revisions)
2527
2516
 
2528
2517
    def is_shared(self):
2529
2518
        """Return True if this repository is flagged as a shared repository."""
3853
3842
                basis_id, delta, current_revision_id, parents_parents)
3854
3843
            cache[current_revision_id] = parent_tree
3855
3844
 
3856
 
    def _fetch_batch(self, revision_ids, basis_id, cache, a_graph=None):
 
3845
    def _fetch_batch(self, revision_ids, basis_id, cache):
3857
3846
        """Fetch across a few revisions.
3858
3847
 
3859
3848
        :param revision_ids: The revisions to copy
3860
3849
        :param basis_id: The revision_id of a tree that must be in cache, used
3861
3850
            as a basis for delta when no other base is available
3862
3851
        :param cache: A cache of RevisionTrees that we can use.
3863
 
        :param a_graph: A Graph object to determine the heads() of the
3864
 
            rich-root data stream.
3865
3852
        :return: The revision_id of the last converted tree. The RevisionTree
3866
3853
            for it will be in cache
3867
3854
        """
3935
3922
        if root_keys_to_create:
3936
3923
            root_stream = _mod_fetch._new_root_data_stream(
3937
3924
                root_keys_to_create, self._revision_id_to_root_id, parent_map,
3938
 
                self.source, graph=a_graph)
 
3925
                self.source)
3939
3926
            to_texts.insert_record_stream(root_stream)
3940
3927
        to_texts.insert_record_stream(from_texts.get_record_stream(
3941
3928
            text_keys, self.target._format._fetch_order,
3998
3985
        cache[basis_id] = basis_tree
3999
3986
        del basis_tree # We don't want to hang on to it here
4000
3987
        hints = []
4001
 
        if self._converting_to_rich_root and len(revision_ids) > 100:
4002
 
            a_graph = _mod_fetch._get_rich_root_heads_graph(self.source,
4003
 
                                                            revision_ids)
4004
 
        else:
4005
 
            a_graph = None
 
3988
        a_graph = None
4006
3989
 
4007
3990
        for offset in range(0, len(revision_ids), batch_size):
4008
3991
            self.target.start_write_group()
4010
3993
                pb.update('Transferring revisions', offset,
4011
3994
                          len(revision_ids))
4012
3995
                batch = revision_ids[offset:offset+batch_size]
4013
 
                basis_id = self._fetch_batch(batch, basis_id, cache,
4014
 
                                             a_graph=a_graph)
 
3996
                basis_id = self._fetch_batch(batch, basis_id, cache)
4015
3997
            except:
4016
3998
                self.source._safe_to_return_from_cache = False
4017
3999
                self.target.abort_write_group()