~bzr-pqm/bzr/bzr.dev

« back to all changes in this revision

Viewing changes to bzrlib/builtins.py

[merge] Erik Bågfors: add --revision to bzr pull

Show diffs side-by-side

added added

removed removed

Lines of Context:
392
392
    If you want to forget your local changes and just update your branch to
393
393
    match the remote one, use --overwrite.
394
394
    """
395
 
    takes_options = ['remember', 'overwrite', 'verbose']
 
395
    takes_options = ['remember', 'overwrite', 'revision', 'verbose']
396
396
    takes_args = ['location?']
397
397
 
398
 
    def run(self, location=None, remember=False, overwrite=False, verbose=False):
 
398
    def run(self, location=None, remember=False, overwrite=False, revision=None, verbose=False):
399
399
        from shutil import rmtree
400
400
        import errno
401
401
        # FIXME: too much stuff is in the command class        
411
411
        br_from = Branch.open(location)
412
412
        br_to = tree_to.branch
413
413
 
 
414
        if revision is None:
 
415
            rev_id = None
 
416
        elif len(revision) == 1:
 
417
            rev_id = revision[0].in_history(br_from).rev_id
 
418
        else:
 
419
            raise BzrCommandError('bzr pull --revision takes one value.')
 
420
 
414
421
        old_rh = br_to.revision_history()
415
 
        count = tree_to.pull(br_from, overwrite)
 
422
        count = tree_to.pull(br_from, overwrite, rev_id)
416
423
 
417
424
        if br_to.get_parent() is None or remember:
418
425
            br_to.set_parent(location)