~bzr-pqm/bzr/bzr.dev

« back to all changes in this revision

Viewing changes to bzrlib/repository.py

  • Committer: John Arbash Meinel
  • Date: 2010-09-25 20:08:01 UTC
  • mfrom: (5444 +trunk)
  • mto: This revision was merged to the branch mainline in revision 5445.
  • Revision ID: john@arbash-meinel.com-20100925200801-7uf0ux3uwxo9i3x0
Merge bzr.dev 5444 to resolve some small text conflicts.

Show diffs side-by-side

added added

removed removed

Lines of Context:
25
25
    check,
26
26
    chk_map,
27
27
    config,
 
28
    controldir,
28
29
    debug,
29
30
    fetch as _mod_fetch,
30
31
    fifo_cache,
891
892
# Repositories
892
893
 
893
894
 
894
 
class Repository(_RelockDebugMixin, bzrdir.ControlComponent):
 
895
class Repository(_RelockDebugMixin, controldir.ControlComponent):
895
896
    """Repository holding history for one or more branches.
896
897
 
897
898
    The repository holds and retrieves historical information including
2510
2511
            ancestors will be traversed.
2511
2512
        """
2512
2513
        graph = self.get_graph()
2513
 
        next_id = revision_id
2514
 
        while True:
2515
 
            if next_id in (None, _mod_revision.NULL_REVISION):
2516
 
                return
2517
 
            try:
2518
 
                parents = graph.get_parent_map([next_id])[next_id]
2519
 
            except KeyError:
2520
 
                raise errors.RevisionNotPresent(next_id, self)
2521
 
            yield next_id
2522
 
            if len(parents) == 0:
2523
 
                return
2524
 
            else:
2525
 
                next_id = parents[0]
 
2514
        stop_revisions = (None, _mod_revision.NULL_REVISION)
 
2515
        return graph.iter_lefthand_ancestry(revision_id, stop_revisions)
2526
2516
 
2527
2517
    def is_shared(self):
2528
2518
        """Return True if this repository is flagged as a shared repository."""
3388
3378
    'bzrlib.repofmt.groupcompress_repo',
3389
3379
    'RepositoryFormat2a',
3390
3380
    )
 
3381
format_registry.register_lazy(
 
3382
    'Bazaar development format 8\n',
 
3383
    'bzrlib.repofmt.groupcompress_repo',
 
3384
    'RepositoryFormat2aSubtree',
 
3385
    )
3391
3386
 
3392
3387
 
3393
3388
class InterRepository(InterObject):
3847
3842
                basis_id, delta, current_revision_id, parents_parents)
3848
3843
            cache[current_revision_id] = parent_tree
3849
3844
 
3850
 
    def _fetch_batch(self, revision_ids, basis_id, cache, a_graph=None):
 
3845
    def _fetch_batch(self, revision_ids, basis_id, cache):
3851
3846
        """Fetch across a few revisions.
3852
3847
 
3853
3848
        :param revision_ids: The revisions to copy
3854
3849
        :param basis_id: The revision_id of a tree that must be in cache, used
3855
3850
            as a basis for delta when no other base is available
3856
3851
        :param cache: A cache of RevisionTrees that we can use.
3857
 
        :param a_graph: A Graph object to determine the heads() of the
3858
 
            rich-root data stream.
3859
3852
        :return: The revision_id of the last converted tree. The RevisionTree
3860
3853
            for it will be in cache
3861
3854
        """
3929
3922
        if root_keys_to_create:
3930
3923
            root_stream = _mod_fetch._new_root_data_stream(
3931
3924
                root_keys_to_create, self._revision_id_to_root_id, parent_map,
3932
 
                self.source, graph=a_graph)
 
3925
                self.source)
3933
3926
            to_texts.insert_record_stream(root_stream)
3934
3927
        to_texts.insert_record_stream(from_texts.get_record_stream(
3935
3928
            text_keys, self.target._format._fetch_order,
3992
3985
        cache[basis_id] = basis_tree
3993
3986
        del basis_tree # We don't want to hang on to it here
3994
3987
        hints = []
3995
 
        if self._converting_to_rich_root and len(revision_ids) > 100:
3996
 
            a_graph = _mod_fetch._get_rich_root_heads_graph(self.source,
3997
 
                                                            revision_ids)
3998
 
        else:
3999
 
            a_graph = None
 
3988
        a_graph = None
4000
3989
 
4001
3990
        for offset in range(0, len(revision_ids), batch_size):
4002
3991
            self.target.start_write_group()
4004
3993
                pb.update('Transferring revisions', offset,
4005
3994
                          len(revision_ids))
4006
3995
                batch = revision_ids[offset:offset+batch_size]
4007
 
                basis_id = self._fetch_batch(batch, basis_id, cache,
4008
 
                                             a_graph=a_graph)
 
3996
                basis_id = self._fetch_batch(batch, basis_id, cache)
4009
3997
            except:
4010
3998
                self.source._safe_to_return_from_cache = False
4011
3999
                self.target.abort_write_group()