31
31
from bzrlib.errors import (BzrError, BzrCheckError, BzrCommandError,
32
32
NotBranchError, DivergedBranches, NotConflicted,
33
33
NoSuchFile, NoWorkingTree, FileInWrongBranch)
34
from bzrlib.log import show_one_log
34
35
from bzrlib.option import Option
35
36
from bzrlib.revisionspec import RevisionSpec
36
37
import bzrlib.trace
37
38
from bzrlib.trace import mutter, note, log_error, warning, is_quiet
39
from bzrlib.transport.local import LocalTransport
38
40
from bzrlib.workingtree import WorkingTree
39
from bzrlib.log import show_one_log
42
43
def tree_files(file_list, default_branch=u'.'):
516
517
if new_transport.base == transport.base:
517
518
raise BzrCommandError("Could not creeate "
519
br_to = Branch.initialize(location)
520
if isinstance(transport, LocalTransport):
521
br_to = WorkingTree.create_standalone(location).branch
523
br_to = Branch.create(location)
520
524
old_rh = br_to.revision_history()
731
735
tree = WorkingTree.open_containing(u'.')[0]
733
737
# FIXME. should be tree.last_revision
734
for revision_id in b.get_ancestry(b.last_revision()):
738
for revision_id in b.repository.get_ancestry(b.last_revision()):
735
739
if revision_id is None:
737
741
self.outf.write(revision_id)
974
978
rev1 = rev2 = revision[0].in_history(b).revno
975
979
elif len(revision) == 2:
976
980
rev1 = revision[0].in_history(b).revno
977
rev2 = revision[1].in_history(b).revno
981
if revision[1].spec is None:
982
# missing end-range means last known revision
985
rev2 = revision[1].in_history(b).revno
979
987
raise BzrCommandError('bzr log --revision takes one or two values.')
1203
1211
Note: export of tree with non-ascii filenames to zip is not supported.
1205
Supported formats Autodetected by extension
1206
----------------- -------------------------
1213
Supported formats Autodetected by extension
1214
----------------- -------------------------
1209
1217
tbz2 .tar.bz2, .tbz2
1394
1402
"""Upgrade branch storage to current format.
1396
1404
The check command or bzr developers may sometimes advise you to run
1399
This version of this command upgrades from the full-text storage
1400
used by bzr 0.0.8 and earlier to the weave format (v5).
1405
this command. When the default format has changed you may also be warned
1406
during other operations to upgrade.
1402
takes_args = ['dir?']
1408
takes_args = ['url?']
1404
def run(self, dir=u'.'):
1410
def run(self, url='.'):
1405
1411
from bzrlib.upgrade import upgrade
1409
1415
class cmd_whoami(Command):
1424
1430
print config.username()
1426
1433
class cmd_nick(Command):
1428
Print or set the branch nickname.
1434
"""Print or set the branch nickname.
1429
1436
If unset, the tree root directory name is used as the nickname
1430
1437
To print the current nickname, execute with no argument.
1452
1460
If arguments are given, they are regular expressions that say
1453
1461
which tests should run.
1463
If the global option '--no-plugins' is given, plugins are not loaded
1464
before running the selftests. This has two effects: features provided or
1465
modified by plugins will not be tested, and tests provided by plugins will
1470
bzr --no-plugins selftest -v
1455
1472
# TODO: --list should give a list of all available tests
1474
# NB: this is used from the class without creating an instance, which is
1475
# why it does not have a self parameter.
1476
def get_transport_type(typestring):
1477
"""Parse and return a transport specifier."""
1478
if typestring == "sftp":
1479
from bzrlib.transport.sftp import SFTPAbsoluteServer
1480
return SFTPAbsoluteServer
1481
if typestring == "memory":
1482
from bzrlib.transport.memory import MemoryServer
1484
msg = "No known transport type %s. Supported types are: sftp\n" %\
1486
raise BzrCommandError(msg)
1457
1489
takes_args = ['testspecs*']
1458
takes_options = ['verbose',
1490
takes_options = ['verbose',
1459
1491
Option('one', help='stop when one test fails'),
1460
1492
Option('keep-output',
1461
help='keep output directories when tests fail')
1493
help='keep output directories when tests fail'),
1495
help='Use a different transport by default '
1496
'throughout the test suite.',
1497
type=get_transport_type),
1464
1500
def run(self, testspecs_list=None, verbose=False, one=False,
1501
keep_output=False, transport=None):
1466
1502
import bzrlib.ui
1467
1503
from bzrlib.tests import selftest
1468
1504
# we don't want progress meters from the tests to go to the
1557
1594
last1 = branch1.last_revision()
1558
1595
last2 = branch2.last_revision()
1560
source = MultipleRevisionSources(branch1, branch2)
1597
source = MultipleRevisionSources(branch1.repository,
1562
1600
base_rev_id = common_ancestor(last1, last2, source)
2079
2117
from bzrlib.merge import Merger, _MergeConflictHandler
2080
2118
if this_dir is None:
2081
2119
this_dir = u'.'
2082
this_branch = Branch.open_containing(this_dir)[0]
2120
this_tree = WorkingTree.open_containing(this_dir)[0]
2083
2121
if show_base and not merge_type is ApplyMerge3:
2084
2122
raise BzrCommandError("Show-base is not supported for this merge"
2085
2123
" type. %s" % merge_type)
2088
2126
" type. %s" % merge_type)
2089
2127
if reprocess and show_base:
2090
2128
raise BzrCommandError("Cannot reprocess and show base.")
2091
merger = Merger(this_branch)
2129
merger = Merger(this_tree.branch, this_tree=this_tree)
2092
2130
merger.check_basis(check_clean)
2093
2131
merger.set_other(other_revision)
2094
2132
merger.set_base(base_revision)