~bzr-pqm/bzr/bzr.dev

« back to all changes in this revision

Viewing changes to bzrlib/commands.py

  • Committer: Martin Pool
  • Date: 2005-08-12 15:24:19 UTC
  • Revision ID: mbp@sourcefrog.net-20050812152419-8f65f048a739f44d
- add revert command to tutorial

Show diffs side-by-side

added added

removed removed

Lines of Context:
987
987
    """
988
988
 
989
989
    takes_args = ['filename?']
990
 
    takes_options = ['forward', 'timezone', 'verbose', 'show-ids', 'revision',
991
 
                     'long', 'message', 'short',]
 
990
    takes_options = ['forward', 'timezone', 'verbose', 'show-ids', 'revision','long', 'message']
992
991
    
993
992
    def run(self, filename=None, timezone='original',
994
993
            verbose=False,
996
995
            forward=False,
997
996
            revision=None,
998
997
            message=None,
999
 
            long=False,
1000
 
            short=False):
 
998
            long=False):
1001
999
        from bzrlib.branch import find_branch
1002
1000
        from bzrlib.log import log_formatter, show_log
1003
1001
        import codecs
1037
1035
        # in e.g. the default C locale.
1038
1036
        outf = codecs.getwriter(bzrlib.user_encoding)(sys.stdout, errors='replace')
1039
1037
 
1040
 
        if not short:
 
1038
        if long:
1041
1039
            log_format = 'long'
1042
1040
        else:
1043
1041
            log_format = 'short'
1536
1534
 
1537
1535
 
1538
1536
 
1539
 
class cmd_missing(Command):
1540
 
    """What is missing in this branch relative to other branch.
1541
 
    """
1542
 
    takes_args = ['remote?']
1543
 
    aliases = ['mis', 'miss']
1544
 
    # We don't have to add quiet to the list, because 
1545
 
    # unknown options are parsed as booleans
1546
 
    takes_options = ['verbose', 'quiet']
1547
 
 
1548
 
    def run(self, remote=None, verbose=False, quiet=False):
1549
 
        from bzrlib.branch import find_branch, DivergedBranches
1550
 
        from bzrlib.errors import BzrCommandError
1551
 
        from bzrlib.missing import get_parent, show_missing
1552
 
 
1553
 
        if verbose and quiet:
1554
 
            raise BzrCommandError('Cannot pass both quiet and verbose')
1555
 
 
1556
 
        b = find_branch('.')
1557
 
        parent = get_parent(b)
1558
 
        if remote is None:
1559
 
            if parent is None:
1560
 
                raise BzrCommandError("No missing location known or specified.")
1561
 
            else:
1562
 
                if not quiet:
1563
 
                    print "Using last location: %s" % parent
1564
 
                remote = parent
1565
 
        elif parent is None:
1566
 
            # We only update x-pull if it did not exist, missing should not change the parent
1567
 
            b.controlfile('x-pull', 'wb').write(remote + '\n')
1568
 
        br_remote = find_branch(remote)
1569
 
 
1570
 
        return show_missing(b, br_remote, verbose=verbose, quiet=quiet)
1571
 
 
1572
 
 
1573
1537
class cmd_plugins(Command):
1574
1538
    """List plugins"""
1575
1539
    hidden = True
1602
1566
    'no-recurse':             None,
1603
1567
    'profile':                None,
1604
1568
    'revision':               _parse_revision_str,
1605
 
    'short':                  None,
1606
1569
    'show-ids':               None,
1607
1570
    'timezone':               str,
1608
1571
    'verbose':                None,