~bzr-pqm/bzr/bzr.dev

« back to all changes in this revision

Viewing changes to bzrlib/fetch.py

  • Committer: Canonical.com Patch Queue Manager
  • Date: 2009-09-19 00:32:14 UTC
  • mfrom: (4685.2.1 bzr.dev)
  • Revision ID: pqm@pqm.ubuntu.com-20090919003214-2dli9jc4y5xhjj3n
(mbp for garyvdm) Revert rename of
        test_merge_uncommitted_otherbasis_ancestor_of_thisbasis.

Show diffs side-by-side

added added

removed removed

Lines of Context:
28
28
from bzrlib.lazy_import import lazy_import
29
29
lazy_import(globals(), """
30
30
from bzrlib import (
31
 
    graph as _mod_graph,
32
 
    static_tuple,
33
31
    tsort,
34
32
    versionedfile,
35
33
    )
38
36
from bzrlib import (
39
37
    errors,
40
38
    symbol_versioning,
41
 
    ui,
42
39
    )
43
40
from bzrlib.revision import NULL_REVISION
44
41
from bzrlib.trace import mutter
 
42
import bzrlib.ui
45
43
 
46
44
 
47
45
class RepoFetcher(object):
98
96
        # assert not missing
99
97
        self.count_total = 0
100
98
        self.file_ids_names = {}
101
 
        pb = ui.ui_factory.nested_progress_bar()
 
99
        pb = bzrlib.ui.ui_factory.nested_progress_bar()
102
100
        pb.show_pct = pb.show_count = False
103
101
        try:
104
102
            pb.update("Finding revisions", 0, 2)
125
123
            raise errors.IncompatibleRepositories(
126
124
                self.from_repository, self.to_repository,
127
125
                "different rich-root support")
128
 
        pb = ui.ui_factory.nested_progress_bar()
 
126
        pb = bzrlib.ui.ui_factory.nested_progress_bar()
129
127
        try:
130
128
            pb.update("Get stream source")
131
129
            source = self.from_repository._get_source(
253
251
        # yet, and are unlikely to in non-rich-root environments anyway.
254
252
        root_id_order.sort(key=operator.itemgetter(0))
255
253
        # Create a record stream containing the roots to create.
256
 
        if len(revs) > 100:
257
 
            graph = _get_rich_root_heads_graph(self.source_repo, revs)
 
254
        from bzrlib.graph import FrozenHeadsCache
 
255
        graph = FrozenHeadsCache(graph)
258
256
        new_roots_stream = _new_root_data_stream(
259
257
            root_id_order, rev_id_to_root_id, parent_map, self.source, graph)
260
258
        return [('texts', new_roots_stream)]
261
259
 
262
260
 
263
 
def _get_rich_root_heads_graph(source_repo, revision_ids):
264
 
    """Get a Graph object suitable for asking heads() for new rich roots."""
265
 
    st = static_tuple.StaticTuple
266
 
    revision_keys = [st(r_id).intern() for r_id in revision_ids]
267
 
    known_graph = source_repo.revisions.get_known_graph_ancestry(
268
 
                    revision_keys)
269
 
    return _mod_graph.GraphThunkIdsToKeys(known_graph)
270
 
 
271
 
 
272
261
def _new_root_data_stream(
273
262
    root_keys_to_create, rev_id_to_root_id_map, parent_map, repo, graph=None):
274
263
    """Generate a texts substream of synthesised root entries.