~bzr-pqm/bzr/bzr.dev

« back to all changes in this revision

Viewing changes to bzrlib/builtins.py

  • Committer: Aaron Bentley
  • Date: 2005-09-26 15:03:16 UTC
  • mto: (1185.14.1) (1393.1.21)
  • mto: This revision was merged to the branch mainline in revision 1391.
  • Revision ID: abentley@panoramicfeedback.com-20050926150316-ed498650ab07a6ce
Fixed bug where pull throws DivergedBranches if branch is newer than upstream

Show diffs side-by-side

added added

removed removed

Lines of Context:
62
62
    directory is shown.  Otherwise, only the status of the specified
63
63
    files or directories is reported.  If a directory is given, status
64
64
    is reported for everything inside that directory.
 
65
 
 
66
    If a revision argument is given, the status is calculated against
 
67
    that revision, or between two revisions if two are provided.
65
68
    """
66
69
    # XXX: FIXME: bzr status should accept a -r option to show changes
67
70
    # relative to a revision, or between revisions
68
71
 
69
72
    takes_args = ['file*']
70
 
    takes_options = ['all', 'show-ids']
 
73
    takes_options = ['all', 'show-ids', 'revision']
71
74
    aliases = ['st', 'stat']
72
75
    
73
 
    def run(self, all=False, show_ids=False, file_list=None):
 
76
    def run(self, all=False, show_ids=False, file_list=None, revision=None):
74
77
        if file_list:
75
78
            b = Branch.open_containing(file_list[0])
76
79
            file_list = [b.relpath(x) for x in file_list]
83
86
            
84
87
        from bzrlib.status import show_status
85
88
        show_status(b, show_unchanged=all, show_ids=show_ids,
86
 
                    specific_files=file_list)
 
89
                    specific_files=file_list, revision=revision)
87
90
 
88
91
 
89
92
class cmd_cat_revision(Command):
369
372
 
370
373
    To retrieve the branch as of a particular revision, supply the --revision
371
374
    parameter, as in "branch foo/bar -r 5".
 
375
 
 
376
    --basis is to speed up branching from remote branches.  When specified, it
 
377
    copies all the file-contents, inventory and revision data from the basis
 
378
    branch before copying anything from the remote branch.
372
379
    """
373
380
    takes_args = ['from_location', 'to_location?']
374
 
    takes_options = ['revision']
 
381
    takes_options = ['revision', 'basis']
375
382
    aliases = ['get', 'clone']
376
383
 
377
 
    def run(self, from_location, to_location=None, revision=None):
 
384
    def run(self, from_location, to_location=None, revision=None, basis=None):
378
385
        from bzrlib.branch import copy_branch
379
386
        import tempfile
380
387
        import errno
395
402
                else:
396
403
                    raise
397
404
            br_from.setup_caching(cache_root)
 
405
            if basis is not None:
 
406
                basis_branch = Branch.open_containing(basis)
 
407
            else:
 
408
                basis_branch = None
 
409
            if len(revision) == 1 and revision[0] is not None:
 
410
                revno = revision[0].in_history(br_from)[0]
 
411
            else:
 
412
                revno = None
398
413
            if to_location is None:
399
414
                to_location = os.path.basename(from_location.rstrip("/\\"))
400
415
            try:
409
424
                else:
410
425
                    raise
411
426
            try:
412
 
                copy_branch(br_from, to_location, revision[0])
 
427
                copy_branch(br_from, to_location, revno, basis_branch)
413
428
            except bzrlib.errors.NoSuchRevision:
414
429
                rmtree(to_location)
415
430
                msg = "The branch %s has no revision %d." % (from_location, revision[0])
416
431
                raise BzrCommandError(msg)
 
432
            except bzrlib.errors.UnlistableBranch:
 
433
                msg = "The branch %s cannot be used as a --basis"
417
434
        finally:
418
435
            rmtree(cache_root)
419
436
 
1328
1345
            # should not change the parent
1329
1346
            b.set_parent(remote)
1330
1347
        br_remote = Branch.open_containing(remote)
 
1348
 
1331
1349
        return show_missing(b, br_remote, verbose=verbose, quiet=quiet)
1332
1350
 
1333
1351
 
 
1352
 
1334
1353
class cmd_plugins(Command):
1335
1354
    """List plugins"""
1336
1355
    hidden = True