~bzr-pqm/bzr/bzr.dev

« back to all changes in this revision

Viewing changes to bzrlib/commands.py

  • Committer: Martin Pool
  • Date: 2005-08-29 10:57:01 UTC
  • mfrom: (1092.1.41)
  • Revision ID: mbp@sourcefrog.net-20050829105701-7aaa81ecf1bfee05
- merge in merge improvements and additional tests 
  from aaron and lifeless

robertc@robertcollins.net-20050825131100-85772edabc817481

Show diffs side-by-side

added added

removed removed

Lines of Context:
58
58
        k_unsquished = k
59
59
    if not plugin_cmds.has_key(k_unsquished):
60
60
        plugin_cmds[k_unsquished] = cmd
 
61
        mutter('registered plugin command %s', k_unsquished)      
61
62
    else:
62
63
        log_error('Two plugins defined the same command: %r' % k)
63
64
        log_error('Not loading the one in %r' % sys.modules[cmd.__module__])
199
200
 
200
201
    # first look up this command under the specified name
201
202
    cmds = _get_cmd_dict(plugins_override=plugins_override)
 
203
    mutter("all commands: %r", cmds.keys())
202
204
    try:
203
205
        return cmd, cmds[cmd]
204
206
    except KeyError:
475
477
    
476
478
    def run(self, file_list, verbose=False, no_recurse=False):
477
479
        from bzrlib.add import smart_add, _PrintAddCallback
 
480
        recurse = not no_recurse
478
481
        smart_add(file_list, verbose, not no_recurse,
479
482
                  callback=_PrintAddCallback)
480
483
 
494
497
            os.mkdir(d)
495
498
            if not b:
496
499
                b = find_branch(d)
497
 
            b.add([d], verbose=True)
 
500
            b.add([d])
 
501
            print 'added', d
498
502
 
499
503
 
500
504
class cmd_relpath(Command):
589
593
        
590
594
        if os.path.isdir(names_list[-1]):
591
595
            # move into existing directory
592
 
            b.move(rel_names[:-1], rel_names[-1])
 
596
            for pair in b.move(rel_names[:-1], rel_names[-1]):
 
597
                print "%s => %s" % pair
593
598
        else:
594
599
            if len(names_list) != 2:
595
600
                raise BzrCommandError('to mv multiple files the destination '
596
601
                                      'must be a versioned directory')
597
 
            b.move(rel_names[0], rel_names[1])
 
602
            for pair in b.move(rel_names[0], rel_names[1]):
 
603
                print "%s => %s" % pair
598
604
            
599
605
    
600
606
 
1351
1357
class cmd_upgrade(Command):
1352
1358
    """Upgrade branch storage to current format.
1353
1359
 
1354
 
    This should normally be used only after the check command tells
1355
 
    you to run it.
 
1360
    The check command or bzr developers may sometimes advise you to run
 
1361
    this command.
1356
1362
    """
1357
1363
    takes_args = ['dir?']
1358
1364
 
1390
1396
        # the real logs.
1391
1397
        save_ui = bzrlib.ui.ui_factory
1392
1398
        bzrlib.trace.info('running tests...')
1393
 
        bzrlib.trace.disable_default_logging()
1394
1399
        try:
1395
1400
            bzrlib.ui.ui_factory = bzrlib.ui.SilentUIFactory()
1396
1401
            result = selftest(verbose=verbose, pattern=pattern)
1400
1405
                bzrlib.trace.info('tests failed')
1401
1406
            return int(not result)
1402
1407
        finally:
1403
 
            bzrlib.trace.enable_default_logging()
1404
1408
            bzrlib.ui.ui_factory = save_ui
1405
1409
 
1406
1410
 
1524
1528
 
1525
1529
        if revision is None or len(revision) < 1:
1526
1530
            base = [None, None]
1527
 
            other = [branch, -1]
 
1531
            other = (branch, -1)
1528
1532
        else:
1529
1533
            if len(revision) == 1:
1530
 
                other = [branch, revision[0]]
1531
 
                base = [None, None]
 
1534
                other = (branch, revision[0])
 
1535
                base = (None, None)
1532
1536
            else:
1533
1537
                assert len(revision) == 2
1534
1538
                if None in revision:
1648
1652
        from inspect import getdoc
1649
1653
        from pprint import pprint
1650
1654
        for plugin in bzrlib.plugin.all_plugins:
1651
 
            print plugin.__path__[0]
 
1655
            if hasattr(plugin, '__path__'):
 
1656
                print plugin.__path__[0]
 
1657
            else:
 
1658
                print `plugin`
1652
1659
            d = getdoc(plugin)
1653
1660
            if d:
1654
1661
                print '\t', d.split('\n')[0]