~bzr-pqm/bzr/bzr.dev

« back to all changes in this revision

Viewing changes to bzrlib/fetch.py

  • Committer: Andrew Bennetts
  • Date: 2009-03-04 07:10:07 UTC
  • mto: (4086.1.2 hpss-integration)
  • mto: This revision was merged to the branch mainline in revision 4087.
  • Revision ID: andrew.bennetts@canonical.com-20090304071007-8iqoi1m44ypmzg2a
Rough prototype of allowing a SearchResult to be passed to fetch, and using that to improve network conversations.

Show diffs side-by-side

added added

removed removed

Lines of Context:
70
70
    the logic in InterRepository.fetch().
71
71
    """
72
72
 
73
 
    def __init__(self, to_repository, from_repository, last_revision=None, pb=None,
74
 
        find_ghosts=True):
 
73
    def __init__(self, to_repository, from_repository, last_revision=None,
 
74
        pb=None, find_ghosts=True, fetch_spec=None):
75
75
        """Create a repo fetcher.
76
76
 
77
77
        :param find_ghosts: If True search the entire history for ghosts.
89
89
        self.sink = to_repository._get_sink()
90
90
        # must not mutate self._last_revision as its potentially a shared instance
91
91
        self._last_revision = last_revision
 
92
        self._fetch_spec = fetch_spec
92
93
        self.find_ghosts = find_ghosts
93
94
        if pb is None:
94
95
            self.pb = bzrlib.ui.ui_factory.nested_progress_bar()
176
177
 
177
178
        If no revisions need to be fetched, then this just returns None.
178
179
        """
 
180
        if self._fetch_spec is not None:
 
181
            return self._fetch_spec
179
182
        mutter('fetch up to rev {%s}', self._last_revision)
180
183
        if self._last_revision is NULL_REVISION:
181
184
            # explicit limit of no revisions needed