1208
1208
value_switches=True,
1209
1209
title="Branch Format",
1211
Option('append-revisions-only',
1212
help='Never change revnos or the existing log.'
1213
' Append revisions to it only.')
1212
def run(self, location=None, format=None):
1215
def run(self, location=None, format=None, append_revisions_only=False):
1213
1216
if format is None:
1214
1217
format = bzrdir.format_registry.make_bzrdir('default')
1215
1218
if location is None:
1232
1235
existing_bzrdir = bzrdir.BzrDir.open(location)
1233
1236
except errors.NotBranchError:
1234
1237
# really a NotBzrDir error...
1235
bzrdir.BzrDir.create_branch_convenience(location, format=format)
1238
branch = bzrdir.BzrDir.create_branch_convenience(location,
1237
1241
from bzrlib.transport.local import LocalTransport
1238
1242
if existing_bzrdir.has_branch():
1241
1245
raise errors.BranchExistsWithoutWorkingTree(location)
1242
1246
raise errors.AlreadyBranchError(location)
1244
existing_bzrdir.create_branch()
1248
branch = existing_bzrdir.create_branch()
1245
1249
existing_bzrdir.create_workingtree()
1250
if append_revisions_only:
1252
branch.set_append_revisions_only(True)
1253
except errors.UpgradeRequired:
1254
raise errors.BzrCommandError('This branch format cannot be set'
1255
' to append-revisions-only. Try --experimental-branch6')
1248
1258
class cmd_init_repository(Command):
1547
1557
dir, relpath = bzrdir.BzrDir.open_containing(location)
1548
1558
b = dir.open_branch()
1550
if revision is None:
1553
elif len(revision) == 1:
1554
rev1 = rev2 = revision[0].in_history(b).revno
1555
elif len(revision) == 2:
1556
if revision[1].get_branch() != revision[0].get_branch():
1557
# b is taken from revision[0].get_branch(), and
1558
# show_log will use its revision_history. Having
1559
# different branches will lead to weird behaviors.
1562
if revision is None:
1565
elif len(revision) == 1:
1566
rev1 = rev2 = revision[0].in_history(b).revno
1567
elif len(revision) == 2:
1568
if revision[1].get_branch() != revision[0].get_branch():
1569
# b is taken from revision[0].get_branch(), and
1570
# show_log will use its revision_history. Having
1571
# different branches will lead to weird behaviors.
1572
raise errors.BzrCommandError(
1573
"Log doesn't accept two revisions in different"
1575
if revision[0].spec is None:
1576
# missing begin-range means first revision
1579
rev1 = revision[0].in_history(b).revno
1581
if revision[1].spec is None:
1582
# missing end-range means last known revision
1585
rev2 = revision[1].in_history(b).revno
1560
1587
raise errors.BzrCommandError(
1561
"Log doesn't accept two revisions in different branches.")
1562
if revision[0].spec is None:
1563
# missing begin-range means first revision
1566
rev1 = revision[0].in_history(b).revno
1568
if revision[1].spec is None:
1569
# missing end-range means last known revision
1572
rev2 = revision[1].in_history(b).revno
1574
raise errors.BzrCommandError('bzr log --revision takes one or two values.')
1576
# By this point, the revision numbers are converted to the +ve
1577
# form if they were supplied in the -ve form, so we can do
1578
# this comparison in relative safety
1580
(rev2, rev1) = (rev1, rev2)
1582
if log_format is None:
1583
log_format = log.log_formatter_registry.get_default(b)
1585
lf = log_format(show_ids=show_ids, to_file=self.outf,
1586
show_timezone=timezone)
1592
direction=direction,
1593
start_revision=rev1,
1588
'bzr log --revision takes one or two values.')
1590
# By this point, the revision numbers are converted to the +ve
1591
# form if they were supplied in the -ve form, so we can do
1592
# this comparison in relative safety
1594
(rev2, rev1) = (rev1, rev2)
1596
if log_format is None:
1597
log_format = log.log_formatter_registry.get_default(b)
1599
lf = log_format(show_ids=show_ids, to_file=self.outf,
1600
show_timezone=timezone)
1606
direction=direction,
1607
start_revision=rev1,
1598
1614
def get_log_format(long=False, short=False, line=False, default='long'):
2943
2959
See "help checkouts" for more information on checkouts.
2946
takes_args = ['location']
2962
takes_args = ['location?']
2947
2963
takes_options = []
2949
2965
def run(self, location=None):
2950
2966
b, relpath = Branch.open_containing(u'.')
2967
if location is None:
2969
location = b.get_old_bound_location()
2970
except errors.UpgradeRequired:
2971
raise errors.BzrCommandError('No location supplied. '
2972
'This format does not remember old locations.')
2974
if location is None:
2975
raise errors.BzrCommandError('No location supplied and no '
2976
'previous location known')
2951
2977
b_other = Branch.open(location)
2953
2979
b.bind(b_other)