~bzr-pqm/bzr/bzr.dev

« back to all changes in this revision

Viewing changes to bzrlib/branch.py

  • Committer: Canonical.com Patch Queue Manager
  • Date: 2011-05-20 13:28:35 UTC
  • mfrom: (5852.1.11 fetch-limit)
  • Revision ID: pqm@pqm.ubuntu.com-20110520132835-3rf01eu5mbkz3zos
(jelmer) Add limit argument to Branch.fetch(). (Jelmer Vernooij)

Show diffs side-by-side

added added

removed removed

Lines of Context:
669
669
        raise errors.UnsupportedOperation(self.get_reference_info, self)
670
670
 
671
671
    @needs_write_lock
672
 
    def fetch(self, from_branch, last_revision=None):
 
672
    def fetch(self, from_branch, last_revision=None, limit=None):
673
673
        """Copy revisions from from_branch into this branch.
674
674
 
675
675
        :param from_branch: Where to copy from.
676
676
        :param last_revision: What revision to stop at (None for at the end
677
677
                              of the branch.
 
678
        :param limit: Optional rough limit of revisions to fetch
678
679
        :return: None
679
680
        """
680
 
        return InterBranch.get(from_branch, self).fetch(last_revision)
 
681
        return InterBranch.get(from_branch, self).fetch(last_revision, limit=limit)
681
682
 
682
683
    def get_bound_location(self):
683
684
        """Return the URL of the branch we are bound to.
3251
3252
        raise NotImplementedError(self.copy_content_into)
3252
3253
 
3253
3254
    @needs_write_lock
3254
 
    def fetch(self, stop_revision=None):
 
3255
    def fetch(self, stop_revision=None, limit=None):
3255
3256
        """Fetch revisions.
3256
3257
 
3257
3258
        :param stop_revision: Last revision to fetch
 
3259
        :param limit: Optional rough limit of revisions to fetch
3258
3260
        """
3259
3261
        raise NotImplementedError(self.fetch)
3260
3262
 
3298
3300
            self.source.tags.merge_to(self.target.tags)
3299
3301
 
3300
3302
    @needs_write_lock
3301
 
    def fetch(self, stop_revision=None):
 
3303
    def fetch(self, stop_revision=None, limit=None):
3302
3304
        if self.target.base == self.source.base:
3303
3305
            return (0, [])
3304
3306
        self.source.lock_read()
3309
3311
            fetch_spec_factory.source_repo = self.source.repository
3310
3312
            fetch_spec_factory.target_repo = self.target.repository
3311
3313
            fetch_spec_factory.target_repo_kind = fetch.TargetRepoKinds.PREEXISTING
 
3314
            fetch_spec_factory.limit = limit
3312
3315
            fetch_spec = fetch_spec_factory.make_fetch_spec()
3313
3316
            return self.target.repository.fetch(self.source.repository,
3314
3317
                fetch_spec=fetch_spec)