~bzr-pqm/bzr/bzr.dev

« back to all changes in this revision

Viewing changes to bzrlib/fetch.py

  • Committer: Alexander Belchenko
  • Date: 2012-03-29 08:34:13 UTC
  • mto: (6015.44.14 2.4)
  • mto: This revision was merged to the branch mainline in revision 6513.
  • Revision ID: bialix@ukr.net-20120329083413-d4bqqdtfn2yrxp4f
change st_dev, st_ino, st_uid, st_gid from int members to properties.

Show diffs side-by-side

added added

removed removed

Lines of Context:
14
14
# along with this program; if not, write to the Free Software
15
15
# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
16
16
 
 
17
 
17
18
"""Copying of history from one branch to another.
18
19
 
19
20
The basic plan is that every branch knows the history of everything
22
23
branch.
23
24
"""
24
25
 
25
 
from __future__ import absolute_import
26
 
 
27
26
import operator
28
27
 
29
28
from bzrlib.lazy_import import lazy_import
30
29
lazy_import(globals(), """
31
30
from bzrlib import (
 
31
    graph as _mod_graph,
32
32
    tsort,
33
33
    versionedfile,
34
 
    vf_search,
35
34
    )
36
35
""")
37
36
from bzrlib import (
38
37
    errors,
39
38
    ui,
40
39
    )
41
 
from bzrlib.i18n import gettext
42
40
from bzrlib.revision import NULL_REVISION
43
41
from bzrlib.trace import mutter
44
42
 
95
93
        pb = ui.ui_factory.nested_progress_bar()
96
94
        pb.show_pct = pb.show_count = False
97
95
        try:
98
 
            pb.update(gettext("Finding revisions"), 0, 2)
 
96
            pb.update("Finding revisions", 0, 2)
99
97
            search_result = self._revids_to_fetch()
100
98
            mutter('fetching: %s', search_result)
101
99
            if search_result.is_empty():
102
100
                return
103
 
            pb.update(gettext("Fetching revisions"), 1, 2)
 
101
            pb.update("Fetching revisions", 1, 2)
104
102
            self._fetch_everything_for_search(search_result)
105
103
        finally:
106
104
            pb.finished()
162
160
        elif self._last_revision == NULL_REVISION:
163
161
            # fetch_spec is None + last_revision is null => empty fetch.
164
162
            # explicit limit of no revisions needed
165
 
            return vf_search.EmptySearchResult()
 
163
            return _mod_graph.EmptySearchResult()
166
164
        elif self._last_revision is not None:
167
 
            return vf_search.NotInOtherForRevs(self.to_repository,
 
165
            return _mod_graph.NotInOtherForRevs(self.to_repository,
168
166
                self.from_repository, [self._last_revision],
169
167
                find_ghosts=self.find_ghosts).execute()
170
168
        else: # self._last_revision is None:
171
 
            return vf_search.EverythingNotInOther(self.to_repository,
 
169
            return _mod_graph.EverythingNotInOther(self.to_repository,
172
170
                self.from_repository,
173
171
                find_ghosts=self.find_ghosts).execute()
174
172
 
203
201
        revs = list(revs)
204
202
        while revs:
205
203
            for tree in self.source.revision_trees(revs[:100]):
206
 
                if tree.root_inventory.revision_id is None:
207
 
                    tree.root_inventory.revision_id = tree.get_revision_id()
 
204
                if tree.inventory.revision_id is None:
 
205
                    tree.inventory.revision_id = tree.get_revision_id()
208
206
                yield tree
209
207
            revs = revs[100:]
210
208
 
211
209
    def _find_root_ids(self, revs, parent_map, graph):
212
210
        revision_root = {}
213
211
        for tree in self.iter_rev_trees(revs):
 
212
            revision_id = tree.inventory.root.revision
214
213
            root_id = tree.get_root_id()
215
 
            revision_id = tree.get_file_revision(root_id, u"")
216
214
            revision_root[revision_id] = root_id
217
215
        # Find out which parents we don't already know root ids for
218
216
        parents = set()
390
388
                    "limit is only supported with a source branch set")
391
389
            # Caller hasn't specified any revisions or source branch
392
390
            if self.target_repo_kind == TargetRepoKinds.EMPTY:
393
 
                return vf_search.EverythingResult(self.source_repo)
 
391
                return _mod_graph.EverythingResult(self.source_repo)
394
392
            else:
395
393
                # We want everything not already in the target (or target's
396
394
                # fallbacks).
397
 
                return vf_search.EverythingNotInOther(
 
395
                return _mod_graph.EverythingNotInOther(
398
396
                    self.target_repo, self.source_repo).execute()
399
397
        heads_to_fetch = set(self._explicit_rev_ids)
400
398
        if self.source_branch is not None:
417
415
            # heads_to_fetch will almost certainly be present so this doesn't
418
416
            # matter much.
419
417
            all_heads = heads_to_fetch.union(if_present_fetch)
420
 
            ret = vf_search.PendingAncestryResult(all_heads, self.source_repo)
 
418
            ret = _mod_graph.PendingAncestryResult(all_heads, self.source_repo)
421
419
            if self.limit is not None:
422
420
                graph = self.source_repo.get_graph()
423
421
                topo_order = list(graph.iter_topo_order(ret.get_keys()))
425
423
                ret = self.source_repo.revision_ids_to_search_result(result_set)
426
424
            return ret
427
425
        else:
428
 
            return vf_search.NotInOtherForRevs(self.target_repo, self.source_repo,
 
426
            return _mod_graph.NotInOtherForRevs(self.target_repo, self.source_repo,
429
427
                required_ids=heads_to_fetch, if_present_ids=if_present_fetch,
430
428
                limit=self.limit).execute()