~bzr-pqm/bzr/bzr.dev

« back to all changes in this revision

Viewing changes to bzrlib/fetch.py

  • Committer: John Arbash Meinel
  • Date: 2010-07-13 07:44:02 UTC
  • mto: This revision was merged to the branch mainline in revision 5342.
  • Revision ID: john@arbash-meinel.com-20100713074402-wp3oh7cyx76fkvmm
Bump trunk to 2.3-dev1

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
 
# Copyright (C) 2005, 2006, 2008, 2009 Canonical Ltd
 
1
# Copyright (C) 2005-2010 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
 
    symbol_versioning,
 
38
    ui,
39
39
    )
40
40
from bzrlib.revision import NULL_REVISION
41
41
from bzrlib.trace import mutter
42
 
import bzrlib.ui
43
42
 
44
43
 
45
44
class RepoFetcher(object):
50
49
    """
51
50
 
52
51
    def __init__(self, to_repository, from_repository, last_revision=None,
53
 
        pb=None, find_ghosts=True, fetch_spec=None):
 
52
        find_ghosts=True, fetch_spec=None):
54
53
        """Create a repo fetcher.
55
54
 
56
55
        :param last_revision: If set, try to limit to the data this revision
57
56
            references.
58
57
        :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.
61
58
        """
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
67
59
        # repository.fetch has the responsibility for short-circuiting
68
60
        # attempts to copy between a repository and itself.
69
61
        self.to_repository = to_repository
96
88
        # assert not missing
97
89
        self.count_total = 0
98
90
        self.file_ids_names = {}
99
 
        pb = bzrlib.ui.ui_factory.nested_progress_bar()
 
91
        pb = ui.ui_factory.nested_progress_bar()
100
92
        pb.show_pct = pb.show_count = False
101
93
        try:
102
94
            pb.update("Finding revisions", 0, 2)
123
115
            raise errors.IncompatibleRepositories(
124
116
                self.from_repository, self.to_repository,
125
117
                "different rich-root support")
126
 
        pb = bzrlib.ui.ui_factory.nested_progress_bar()
 
118
        pb = ui.ui_factory.nested_progress_bar()
127
119
        try:
128
120
            pb.update("Get stream source")
129
121
            source = self.from_repository._get_source(
251
243
        # yet, and are unlikely to in non-rich-root environments anyway.
252
244
        root_id_order.sort(key=operator.itemgetter(0))
253
245
        # Create a record stream containing the roots to create.
254
 
        from bzrlib.graph import FrozenHeadsCache
255
 
        graph = FrozenHeadsCache(graph)
 
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)
256
250
        new_roots_stream = _new_root_data_stream(
257
251
            root_id_order, rev_id_to_root_id, parent_map, self.source, graph)
258
252
        return [('texts', new_roots_stream)]
259
253
 
260
254
 
 
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
 
261
260
def _new_root_data_stream(
262
261
    root_keys_to_create, rev_id_to_root_id_map, parent_map, repo, graph=None):
263
262
    """Generate a texts substream of synthesised root entries.