~bzr-pqm/bzr/bzr.dev

« back to all changes in this revision

Viewing changes to bzrlib/fetch.py

  • Committer: Martin Pool
  • Date: 2011-11-18 05:13:19 UTC
  • mto: This revision was merged to the branch mainline in revision 6277.
  • Revision ID: mbp@canonical.com-20111118051319-9cj53bg5e06zl7rw
Remove more lzma related code

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 (
162
161
        elif self._last_revision == NULL_REVISION:
163
162
            # fetch_spec is None + last_revision is null => empty fetch.
164
163
            # explicit limit of no revisions needed
165
 
            return vf_search.EmptySearchResult()
 
164
            return _mod_graph.EmptySearchResult()
166
165
        elif self._last_revision is not None:
167
 
            return vf_search.NotInOtherForRevs(self.to_repository,
 
166
            return _mod_graph.NotInOtherForRevs(self.to_repository,
168
167
                self.from_repository, [self._last_revision],
169
168
                find_ghosts=self.find_ghosts).execute()
170
169
        else: # self._last_revision is None:
171
 
            return vf_search.EverythingNotInOther(self.to_repository,
 
170
            return _mod_graph.EverythingNotInOther(self.to_repository,
172
171
                self.from_repository,
173
172
                find_ghosts=self.find_ghosts).execute()
174
173
 
203
202
        revs = list(revs)
204
203
        while revs:
205
204
            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()
 
205
                if tree.inventory.revision_id is None:
 
206
                    tree.inventory.revision_id = tree.get_revision_id()
208
207
                yield tree
209
208
            revs = revs[100:]
210
209
 
211
210
    def _find_root_ids(self, revs, parent_map, graph):
212
211
        revision_root = {}
213
212
        for tree in self.iter_rev_trees(revs):
 
213
            revision_id = tree.inventory.root.revision
214
214
            root_id = tree.get_root_id()
215
 
            revision_id = tree.get_file_revision(root_id, u"")
216
215
            revision_root[revision_id] = root_id
217
216
        # Find out which parents we don't already know root ids for
218
217
        parents = set()
390
389
                    "limit is only supported with a source branch set")
391
390
            # Caller hasn't specified any revisions or source branch
392
391
            if self.target_repo_kind == TargetRepoKinds.EMPTY:
393
 
                return vf_search.EverythingResult(self.source_repo)
 
392
                return _mod_graph.EverythingResult(self.source_repo)
394
393
            else:
395
394
                # We want everything not already in the target (or target's
396
395
                # fallbacks).
397
 
                return vf_search.EverythingNotInOther(
 
396
                return _mod_graph.EverythingNotInOther(
398
397
                    self.target_repo, self.source_repo).execute()
399
398
        heads_to_fetch = set(self._explicit_rev_ids)
400
399
        if self.source_branch is not None:
417
416
            # heads_to_fetch will almost certainly be present so this doesn't
418
417
            # matter much.
419
418
            all_heads = heads_to_fetch.union(if_present_fetch)
420
 
            ret = vf_search.PendingAncestryResult(all_heads, self.source_repo)
 
419
            ret = _mod_graph.PendingAncestryResult(all_heads, self.source_repo)
421
420
            if self.limit is not None:
422
421
                graph = self.source_repo.get_graph()
423
422
                topo_order = list(graph.iter_topo_order(ret.get_keys()))
425
424
                ret = self.source_repo.revision_ids_to_search_result(result_set)
426
425
            return ret
427
426
        else:
428
 
            return vf_search.NotInOtherForRevs(self.target_repo, self.source_repo,
 
427
            return _mod_graph.NotInOtherForRevs(self.target_repo, self.source_repo,
429
428
                required_ids=heads_to_fetch, if_present_ids=if_present_fetch,
430
429
                limit=self.limit).execute()