~bzr-pqm/bzr/bzr.dev

« back to all changes in this revision

Viewing changes to bzrlib/fetch.py

  • Committer: Andrew Bennetts
  • Date: 2011-02-07 04:14:29 UTC
  • mfrom: (5535.4.26 fetch-all-tags-309682)
  • mto: This revision was merged to the branch mainline in revision 5648.
  • Revision ID: andrew.bennetts@canonical.com-20110207041429-3kc1blj34rvvxod9
Merge fetch-all-tags-309682.

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
 
# Copyright (C) 2005-2010 Canonical Ltd
 
1
# Copyright (C) 2005-2011 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
55
55
 
56
56
        :param last_revision: If set, try to limit to the data this revision
57
57
            references.
 
58
        :param fetch_spec: A SearchResult specifying which revisions to fetch.
 
59
            If set, this overrides last_revision.
58
60
        :param find_ghosts: If True search the entire history for ghosts.
59
61
        """
60
62
        # repository.fetch has the responsibility for short-circuiting
93
95
        pb.show_pct = pb.show_count = False
94
96
        try:
95
97
            pb.update("Finding revisions", 0, 2)
96
 
            search = self._revids_to_fetch()
97
 
            mutter('fetching: %s', search)
98
 
            if search.is_empty():
 
98
            search_result = self._revids_to_fetch()
 
99
            mutter('fetching: %s', search_result)
 
100
            if search_result.is_empty():
99
101
                return
100
102
            pb.update("Fetching revisions", 1, 2)
101
 
            self._fetch_everything_for_search(search)
 
103
            self._fetch_everything_for_search(search_result)
102
104
        finally:
103
105
            pb.finished()
104
106
 
153
155
        :returns: A SearchResult of some sort.  (Possibly a
154
156
            PendingAncestryResult, EmptySearchResult, etc.)
155
157
        """
156
 
        get_search_result = getattr(self._fetch_spec, 'get_search_result', None)
157
 
        if get_search_result is not None:
158
 
            mutter(
159
 
                'resolving fetch_spec into search result: %s', self._fetch_spec)
160
 
            # This is EverythingNotInOther or a similar kind of fetch_spec.
161
 
            # Turn it into a search result.
162
 
            return get_search_result()
163
 
        elif self._fetch_spec is not None:
 
158
        if self._fetch_spec is not None:
164
159
            # The fetch spec is already a concrete search result.
165
160
            return self._fetch_spec
166
161
        elif self._last_revision == NULL_REVISION:
170
165
        elif self._last_revision is not None:
171
166
            return graph.NotInOtherForRevs(self.to_repository,
172
167
                self.from_repository, [self._last_revision],
173
 
                find_ghosts=self.find_ghosts).get_search_result()
 
168
                find_ghosts=self.find_ghosts).execute()
174
169
        else: # self._last_revision is None:
175
170
            return graph.EverythingNotInOther(self.to_repository,
176
171
                self.from_repository,
177
 
                find_ghosts=self.find_ghosts).get_search_result()
 
172
                find_ghosts=self.find_ghosts).execute()
178
173
 
179
174
 
180
175
class Inter1and2Helper(object):
394
389
                # We want everything not already in the target (or target's
395
390
                # fallbacks).
396
391
                return graph.EverythingNotInOther(
397
 
                    self.target_repo, self.source_repo)
 
392
                    self.target_repo, self.source_repo).execute()
398
393
        heads_to_fetch = set(self._explicit_rev_ids)
399
394
        tags_to_fetch = set()
400
395
        if self.source_branch is not None:
416
411
            all_heads = heads_to_fetch.union(tags_to_fetch)
417
412
            return graph.PendingAncestryResult(all_heads, self.source_repo)
418
413
        return graph.NotInOtherForRevs(self.target_repo, self.source_repo,
419
 
            required_ids=heads_to_fetch, if_present_ids=tags_to_fetch)
 
414
            required_ids=heads_to_fetch, if_present_ids=tags_to_fetch
 
415
            ).execute()
420
416
 
421
417