600
598
old_rh = branch_to.revision_history()
601
599
if tree_to is not None:
602
count = tree_to.pull(branch_from, overwrite, rev_id)
600
count = tree_to.pull(branch_from, overwrite, rev_id,
601
delta.ChangeReporter(tree_to.inventory))
604
603
count = branch_to.pull(branch_from, overwrite, rev_id)
605
604
_copy_tags_maybe(branch_from, branch_to)
653
Option('use-existing-dir',
654
help='By default push will fail if the target'
655
' directory exists, but does not already'
656
' have a control directory. This flag will'
657
' allow push to proceed.'),
652
Option('use-existing-dir',
653
help='By default push will fail if the target'
654
' directory exists, but does not already'
655
' have a control directory. This flag will'
656
' allow push to proceed.'),
659
658
takes_args = ['location?']
660
659
encoding_type = 'replace'
662
661
def run(self, location=None, remember=False, overwrite=False,
663
662
create_prefix=False, verbose=False,
665
663
use_existing_dir=False,
667
665
# FIXME: Way too big! Put this into a function called from the
669
667
if directory is None:
1225
1223
value_switches=True,
1226
1224
title="Branch Format",
1226
Option('append-revisions-only',
1227
help='Never change revnos or the existing log.'
1228
' Append revisions to it only.')
1229
def run(self, location=None, format=None):
1230
def run(self, location=None, format=None, append_revisions_only=False):
1230
1231
if format is None:
1231
1232
format = bzrdir.format_registry.make_bzrdir('default')
1232
1233
if location is None:
1249
1250
existing_bzrdir = bzrdir.BzrDir.open(location)
1250
1251
except errors.NotBranchError:
1251
1252
# really a NotBzrDir error...
1252
bzrdir.BzrDir.create_branch_convenience(location, format=format)
1253
branch = bzrdir.BzrDir.create_branch_convenience(location,
1254
1256
from bzrlib.transport.local import LocalTransport
1255
1257
if existing_bzrdir.has_branch():
1258
1260
raise errors.BranchExistsWithoutWorkingTree(location)
1259
1261
raise errors.AlreadyBranchError(location)
1261
existing_bzrdir.create_branch()
1263
branch = existing_bzrdir.create_branch()
1262
1264
existing_bzrdir.create_workingtree()
1265
if append_revisions_only:
1267
branch.set_append_revisions_only(True)
1268
except errors.UpgradeRequired:
1269
raise errors.BzrCommandError('This branch format cannot be set'
1270
' to append-revisions-only. Try --experimental-branch6')
1265
1273
class cmd_init_repository(Command):
1564
1572
dir, relpath = bzrdir.BzrDir.open_containing(location)
1565
1573
b = dir.open_branch()
1567
if revision is None:
1570
elif len(revision) == 1:
1571
rev1 = rev2 = revision[0].in_history(b).revno
1572
elif len(revision) == 2:
1573
if revision[1].get_branch() != revision[0].get_branch():
1574
# b is taken from revision[0].get_branch(), and
1575
# show_log will use its revision_history. Having
1576
# different branches will lead to weird behaviors.
1577
if revision is None:
1580
elif len(revision) == 1:
1581
rev1 = rev2 = revision[0].in_history(b).revno
1582
elif len(revision) == 2:
1583
if revision[1].get_branch() != revision[0].get_branch():
1584
# b is taken from revision[0].get_branch(), and
1585
# show_log will use its revision_history. Having
1586
# different branches will lead to weird behaviors.
1587
raise errors.BzrCommandError(
1588
"Log doesn't accept two revisions in different"
1590
if revision[0].spec is None:
1591
# missing begin-range means first revision
1594
rev1 = revision[0].in_history(b).revno
1596
if revision[1].spec is None:
1597
# missing end-range means last known revision
1600
rev2 = revision[1].in_history(b).revno
1577
1602
raise errors.BzrCommandError(
1578
"Log doesn't accept two revisions in different branches.")
1579
if revision[0].spec is None:
1580
# missing begin-range means first revision
1583
rev1 = revision[0].in_history(b).revno
1585
if revision[1].spec is None:
1586
# missing end-range means last known revision
1589
rev2 = revision[1].in_history(b).revno
1591
raise errors.BzrCommandError('bzr log --revision takes one or two values.')
1593
# By this point, the revision numbers are converted to the +ve
1594
# form if they were supplied in the -ve form, so we can do
1595
# this comparison in relative safety
1597
(rev2, rev1) = (rev1, rev2)
1599
if log_format is None:
1600
log_format = log.log_formatter_registry.get_default(b)
1602
lf = log_format(show_ids=show_ids, to_file=self.outf,
1603
show_timezone=timezone)
1609
direction=direction,
1610
start_revision=rev1,
1603
'bzr log --revision takes one or two values.')
1605
# By this point, the revision numbers are converted to the +ve
1606
# form if they were supplied in the -ve form, so we can do
1607
# this comparison in relative safety
1609
(rev2, rev1) = (rev1, rev2)
1611
if log_format is None:
1612
log_format = log.log_formatter_registry.get_default(b)
1614
lf = log_format(show_ids=show_ids, to_file=self.outf,
1615
show_timezone=timezone)
1621
direction=direction,
1622
start_revision=rev1,
1615
1629
def get_log_format(long=False, short=False, line=False, default='long'):
2419
2433
' source rather than merging. When this happens,'
2420
2434
' you do not need to commit the result.'),
2421
2435
Option('directory',
2422
help='branch to push from, '
2436
help='Branch to merge into, '
2423
2437
'rather than the one containing the working directory',
2424
2438
short_name='d',
2429
2443
def run(self, branch=None, revision=None, force=False, merge_type=None,
2430
show_base=False, reprocess=False, remember=False,
2444
show_base=False, reprocess=False, remember=False,
2431
2445
uncommitted=False, pull=False,
2432
2446
directory=None,
2434
2448
if merge_type is None:
2435
2449
merge_type = _mod_merge.Merge3Merger
2436
2451
if directory is None: directory = u'.'
2437
2452
tree = WorkingTree.open_containing(directory)[0]
2453
change_reporter = delta.ChangeReporter(tree.inventory)
2439
2455
if branch is not None:
2961
2978
See "help checkouts" for more information on checkouts.
2964
takes_args = ['location']
2981
takes_args = ['location?']
2965
2982
takes_options = []
2967
2984
def run(self, location=None):
2968
2985
b, relpath = Branch.open_containing(u'.')
2986
if location is None:
2988
location = b.get_old_bound_location()
2989
except errors.UpgradeRequired:
2990
raise errors.BzrCommandError('No location supplied. '
2991
'This format does not remember old locations.')
2993
if location is None:
2994
raise errors.BzrCommandError('No location supplied and no '
2995
'previous location known')
2969
2996
b_other = Branch.open(location)
2971
2998
b.bind(b_other)
3277
3305
raise errors.BzrCommandError("Cannot do conflict reduction and show base.")
3279
3307
merger = _mod_merge.Merger(this_tree.branch, this_tree=this_tree,
3308
pb=pb, change_reporter=change_reporter)
3281
3309
merger.pp = ProgressPhase("Merge phase", 5, pb)
3282
3310
merger.pp.next_phase()
3283
3311
merger.check_basis(check_clean)