~bzr-pqm/bzr/bzr.dev

« back to all changes in this revision

Viewing changes to bzrlib/builtins.py

  • Committer: Martin Pool
  • Date: 2006-02-01 12:24:35 UTC
  • mfrom: (1534.4.32 branch-formats)
  • mto: This revision was merged to the branch mainline in revision 1553.
  • Revision ID: mbp@sourcefrog.net-20060201122435-53f3efb1b5749fe1
[merge] branch-formats branch, and reconcile changes

Show diffs side-by-side

added added

removed removed

Lines of Context:
30
30
from bzrlib.errors import (BzrError, BzrCheckError, BzrCommandError, 
31
31
                           NotBranchError, DivergedBranches, NotConflicted,
32
32
                           NoSuchFile, NoWorkingTree, FileInWrongBranch)
 
33
from bzrlib.log import show_one_log
33
34
from bzrlib.option import Option
34
35
from bzrlib.revisionspec import RevisionSpec
35
36
import bzrlib.trace
36
37
from bzrlib.trace import mutter, note, log_error, warning, is_quiet
 
38
from bzrlib.transport.local import LocalTransport
37
39
from bzrlib.workingtree import WorkingTree
38
 
from bzrlib.log import show_one_log
39
40
 
40
41
 
41
42
def tree_files(file_list, default_branch=u'.'):
497
498
                        if new_transport.base == transport.base:
498
499
                            raise BzrCommandError("Could not creeate "
499
500
                                                  "path prefix.")
500
 
            br_to = Branch.initialize(location)
 
501
            if isinstance(transport, LocalTransport):
 
502
                br_to = WorkingTree.create_standalone(location).branch
 
503
            else:
 
504
                br_to = Branch.create(location)
501
505
        old_rh = br_to.revision_history()
502
506
        try:
503
507
            try:
734
738
            # locations if the user supplies an extended path
735
739
            if not os.path.exists(location):
736
740
                os.mkdir(location)
737
 
        Branch.initialize(location)
 
741
        WorkingTree.create_standalone(location)
738
742
 
739
743
 
740
744
class cmd_diff(Command):
1360
1364
    """Upgrade branch storage to current format.
1361
1365
 
1362
1366
    The check command or bzr developers may sometimes advise you to run
1363
 
    this command.
1364
 
 
1365
 
    This version of this command upgrades from the full-text storage
1366
 
    used by bzr 0.0.8 and earlier to the weave format (v5).
 
1367
    this command. When the default format has changed you may also be warned
 
1368
    during other operations to upgrade.
1367
1369
    """
1368
 
    takes_args = ['dir?']
 
1370
    takes_args = ['url?']
1369
1371
 
1370
 
    def run(self, dir=u'.'):
 
1372
    def run(self, url='.'):
1371
1373
        from bzrlib.upgrade import upgrade
1372
 
        upgrade(dir)
 
1374
        upgrade(url)
1373
1375
 
1374
1376
 
1375
1377
class cmd_whoami(Command):
1389
1391
        else:
1390
1392
            print config.username()
1391
1393
 
 
1394
 
1392
1395
class cmd_nick(Command):
1393
1396
    """\
1394
1397
    Print or set the branch nickname.  
1407
1410
    def printme(self, branch):
1408
1411
        print branch.nick 
1409
1412
 
 
1413
 
1410
1414
class cmd_selftest(Command):
1411
1415
    """Run internal test suite.
1412
1416
    
1419
1423
    which tests should run.
1420
1424
    """
1421
1425
    # TODO: --list should give a list of all available tests
 
1426
 
 
1427
    # NB: this is used from the class without creating an instance, which is
 
1428
    # why it does not have a self parameter.
 
1429
    def get_transport_type(typestring):
 
1430
        """Parse and return a transport specifier."""
 
1431
        if typestring == "sftp":
 
1432
            from bzrlib.transport.sftp import SFTPAbsoluteServer
 
1433
            return SFTPAbsoluteServer
 
1434
        if typestring == "memory":
 
1435
            from bzrlib.transport.memory import MemoryServer
 
1436
            return MemoryServer
 
1437
        msg = "No known transport type %s. Supported types are: sftp\n" %\
 
1438
            (typestring)
 
1439
        raise BzrCommandError(msg)
 
1440
 
1422
1441
    hidden = True
1423
1442
    takes_args = ['testspecs*']
1424
1443
    takes_options = ['verbose', 
1425
1444
                     Option('one', help='stop when one test fails'),
1426
1445
                     Option('keep-output', 
1427
 
                            help='keep output directories when tests fail')
 
1446
                            help='keep output directories when tests fail'),
 
1447
                     Option('transport', 
 
1448
                            help='Use a different transport by default '
 
1449
                                 'throughout the test suite.',
 
1450
                            type=get_transport_type),
1428
1451
                    ]
1429
1452
 
1430
1453
    def run(self, testspecs_list=None, verbose=False, one=False,
1431
 
            keep_output=False):
 
1454
            keep_output=False, transport=None):
1432
1455
        import bzrlib.ui
1433
1456
        from bzrlib.tests import selftest
1434
1457
        # we don't want progress meters from the tests to go to the
1445
1468
            result = selftest(verbose=verbose, 
1446
1469
                              pattern=pattern,
1447
1470
                              stop_on_failure=one, 
1448
 
                              keep_output=keep_output)
 
1471
                              keep_output=keep_output,
 
1472
                              transport=transport)
1449
1473
            if result:
1450
1474
                bzrlib.trace.info('tests passed')
1451
1475
            else:
2045
2069
    from bzrlib.merge import Merger, _MergeConflictHandler
2046
2070
    if this_dir is None:
2047
2071
        this_dir = u'.'
2048
 
    this_branch = Branch.open_containing(this_dir)[0]
 
2072
    this_tree = WorkingTree.open_containing(this_dir)[0]
2049
2073
    if show_base and not merge_type is ApplyMerge3:
2050
2074
        raise BzrCommandError("Show-base is not supported for this merge"
2051
2075
                              " type. %s" % merge_type)
2054
2078
                              " type. %s" % merge_type)
2055
2079
    if reprocess and show_base:
2056
2080
        raise BzrCommandError("Cannot reprocess and show base.")
2057
 
    merger = Merger(this_branch)
 
2081
    merger = Merger(this_tree.branch, this_tree=this_tree)
2058
2082
    merger.check_basis(check_clean)
2059
2083
    merger.set_other(other_revision)
2060
2084
    merger.set_base(base_revision)