~bzr-pqm/bzr/bzr.dev

« back to all changes in this revision

Viewing changes to bzrlib/fetch.py

  • Committer: Danny van Heumen
  • Date: 2010-03-09 21:42:11 UTC
  • mto: (4634.139.5 2.0)
  • mto: This revision was merged to the branch mainline in revision 5160.
  • Revision ID: danny@dannyvanheumen.nl-20100309214211-iqh42x6qcikgd9p3
Reverted now-useless TODO list.

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
 
# Copyright (C) 2005-2010 Canonical Ltd
 
1
# Copyright (C) 2005, 2006, 2008, 2009 Canonical Ltd
2
2
#
3
3
# This program is free software; you can redistribute it and/or modify
4
4
# it under the terms of the GNU General Public License as published by
35
35
import bzrlib
36
36
from bzrlib import (
37
37
    errors,
38
 
    ui,
 
38
    symbol_versioning,
39
39
    )
40
40
from bzrlib.revision import NULL_REVISION
41
41
from bzrlib.trace import mutter
 
42
import bzrlib.ui
42
43
 
43
44
 
44
45
class RepoFetcher(object):
49
50
    """
50
51
 
51
52
    def __init__(self, to_repository, from_repository, last_revision=None,
52
 
        find_ghosts=True, fetch_spec=None):
 
53
        pb=None, find_ghosts=True, fetch_spec=None):
53
54
        """Create a repo fetcher.
54
55
 
55
56
        :param last_revision: If set, try to limit to the data this revision
56
57
            references.
57
58
        :param find_ghosts: If True search the entire history for ghosts.
 
59
        :param pb: ProgressBar object to use; deprecated and ignored.
 
60
            This method will just create one on top of the stack.
58
61
        """
 
62
        if pb is not None:
 
63
            symbol_versioning.warn(
 
64
                symbol_versioning.deprecated_in((1, 14, 0))
 
65
                % "pb parameter to RepoFetcher.__init__")
 
66
            # and for simplicity it is in fact ignored
59
67
        # repository.fetch has the responsibility for short-circuiting
60
68
        # attempts to copy between a repository and itself.
61
69
        self.to_repository = to_repository
88
96
        # assert not missing
89
97
        self.count_total = 0
90
98
        self.file_ids_names = {}
91
 
        pb = ui.ui_factory.nested_progress_bar()
 
99
        pb = bzrlib.ui.ui_factory.nested_progress_bar()
92
100
        pb.show_pct = pb.show_count = False
93
101
        try:
94
102
            pb.update("Finding revisions", 0, 2)
115
123
            raise errors.IncompatibleRepositories(
116
124
                self.from_repository, self.to_repository,
117
125
                "different rich-root support")
118
 
        pb = ui.ui_factory.nested_progress_bar()
 
126
        pb = bzrlib.ui.ui_factory.nested_progress_bar()
119
127
        try:
120
128
            pb.update("Get stream source")
121
129
            source = self.from_repository._get_source(
243
251
        # yet, and are unlikely to in non-rich-root environments anyway.
244
252
        root_id_order.sort(key=operator.itemgetter(0))
245
253
        # Create a record stream containing the roots to create.
246
 
        if len(revs) > 100:
247
 
            # XXX: not covered by tests, should have a flag to always run
248
 
            # this. -- mbp 20100129
249
 
            graph = self.source_repo.get_known_graph_ancestry(revs)
 
254
        from bzrlib.graph import FrozenHeadsCache
 
255
        graph = FrozenHeadsCache(graph)
250
256
        new_roots_stream = _new_root_data_stream(
251
257
            root_id_order, rev_id_to_root_id, parent_map, self.source, graph)
252
258
        return [('texts', new_roots_stream)]
253
259
 
254
260
 
255
 
def _get_rich_root_heads_graph(source_repo, revision_ids):
256
 
    """Get a Graph object suitable for asking heads() for new rich roots."""
257
 
    return 
258
 
 
259
 
 
260
261
def _new_root_data_stream(
261
262
    root_keys_to_create, rev_id_to_root_id_map, parent_map, repo, graph=None):
262
263
    """Generate a texts substream of synthesised root entries.