537
535
location can be accessed.
540
takes_options = ['remember', 'overwrite', 'revision', 'verbose']
538
takes_options = ['remember', 'overwrite', 'revision', 'verbose',
540
help='branch to pull into, '
541
'rather than the one containing the working directory',
541
546
takes_args = ['location?']
542
547
encoding_type = 'replace'
544
def run(self, location=None, remember=False, overwrite=False, revision=None, verbose=False):
549
def run(self, location=None, remember=False, overwrite=False,
550
revision=None, verbose=False,
545
552
# FIXME: too much stuff is in the command class
553
if directory is None:
547
tree_to = WorkingTree.open_containing(u'.')[0]
556
tree_to = WorkingTree.open_containing(directory)[0]
548
557
branch_to = tree_to.branch
549
558
except errors.NoWorkingTree:
551
branch_to = Branch.open_containing(u'.')[0]
560
branch_to = Branch.open_containing(directory)[0]
554
563
if location is not None:
590
598
old_rh = branch_to.revision_history()
591
599
if tree_to is not None:
592
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))
594
603
count = branch_to.pull(branch_from, overwrite, rev_id)
595
604
note('%d revision(s) pulled.' % (count,))
632
641
takes_options = ['remember', 'overwrite', 'verbose',
633
Option('create-prefix',
634
help='Create the path leading up to the branch '
635
'if it does not already exist'),
636
Option('use-existing-dir',
637
help='By default push will fail if the target'
638
' directory exists, but does not already'
639
' have a control directory. This flag will'
640
' allow push to proceed.'),
642
Option('create-prefix',
643
help='Create the path leading up to the branch '
644
'if it does not already exist'),
646
help='branch to push from, '
647
'rather than the one containing the working directory',
651
Option('use-existing-dir',
652
help='By default push will fail if the target'
653
' directory exists, but does not already'
654
' have a control directory. This flag will'
655
' allow push to proceed.'),
642
657
takes_args = ['location?']
643
658
encoding_type = 'replace'
645
660
def run(self, location=None, remember=False, overwrite=False,
646
create_prefix=False, verbose=False, use_existing_dir=False):
661
create_prefix=False, verbose=False,
662
use_existing_dir=False,
647
664
# FIXME: Way too big! Put this into a function called from the
650
br_from = Branch.open_containing('.')[0]
666
if directory is None:
668
br_from = Branch.open_containing(directory)[0]
651
669
stored_loc = br_from.get_push_location()
652
670
if location is None:
653
671
if stored_loc is None:
1194
1206
value_switches=True,
1195
1207
title="Branch Format",
1209
Option('append-revisions-only',
1210
help='Never change revnos or the existing log.'
1211
' Append revisions to it only.')
1198
def run(self, location=None, format=None):
1213
def run(self, location=None, format=None, append_revisions_only=False):
1199
1214
if format is None:
1200
1215
format = bzrdir.format_registry.make_bzrdir('default')
1201
1216
if location is None:
1218
1233
existing_bzrdir = bzrdir.BzrDir.open(location)
1219
1234
except errors.NotBranchError:
1220
1235
# really a NotBzrDir error...
1221
bzrdir.BzrDir.create_branch_convenience(location, format=format)
1236
branch = bzrdir.BzrDir.create_branch_convenience(location,
1223
1239
from bzrlib.transport.local import LocalTransport
1224
1240
if existing_bzrdir.has_branch():
1227
1243
raise errors.BranchExistsWithoutWorkingTree(location)
1228
1244
raise errors.AlreadyBranchError(location)
1230
existing_bzrdir.create_branch()
1246
branch = existing_bzrdir.create_branch()
1231
1247
existing_bzrdir.create_workingtree()
1248
if append_revisions_only:
1250
branch.set_append_revisions_only(True)
1251
except errors.UpgradeRequired:
1252
raise errors.BzrCommandError('This branch format cannot be set'
1253
' to append-revisions-only. Try --experimental-branch6')
1234
1256
class cmd_init_repository(Command):
1533
1555
dir, relpath = bzrdir.BzrDir.open_containing(location)
1534
1556
b = dir.open_branch()
1536
if revision is None:
1539
elif len(revision) == 1:
1540
rev1 = rev2 = revision[0].in_history(b).revno
1541
elif len(revision) == 2:
1542
if revision[1].get_branch() != revision[0].get_branch():
1543
# b is taken from revision[0].get_branch(), and
1544
# show_log will use its revision_history. Having
1545
# different branches will lead to weird behaviors.
1560
if revision is None:
1563
elif len(revision) == 1:
1564
rev1 = rev2 = revision[0].in_history(b).revno
1565
elif len(revision) == 2:
1566
if revision[1].get_branch() != revision[0].get_branch():
1567
# b is taken from revision[0].get_branch(), and
1568
# show_log will use its revision_history. Having
1569
# different branches will lead to weird behaviors.
1570
raise errors.BzrCommandError(
1571
"Log doesn't accept two revisions in different"
1573
if revision[0].spec is None:
1574
# missing begin-range means first revision
1577
rev1 = revision[0].in_history(b).revno
1579
if revision[1].spec is None:
1580
# missing end-range means last known revision
1583
rev2 = revision[1].in_history(b).revno
1546
1585
raise errors.BzrCommandError(
1547
"Log doesn't accept two revisions in different branches.")
1548
if revision[0].spec is None:
1549
# missing begin-range means first revision
1552
rev1 = revision[0].in_history(b).revno
1554
if revision[1].spec is None:
1555
# missing end-range means last known revision
1558
rev2 = revision[1].in_history(b).revno
1560
raise errors.BzrCommandError('bzr log --revision takes one or two values.')
1562
# By this point, the revision numbers are converted to the +ve
1563
# form if they were supplied in the -ve form, so we can do
1564
# this comparison in relative safety
1566
(rev2, rev1) = (rev1, rev2)
1568
if log_format is None:
1569
log_format = log.log_formatter_registry.get_default(b)
1571
lf = log_format(show_ids=show_ids, to_file=self.outf,
1572
show_timezone=timezone)
1578
direction=direction,
1579
start_revision=rev1,
1586
'bzr log --revision takes one or two values.')
1588
# By this point, the revision numbers are converted to the +ve
1589
# form if they were supplied in the -ve form, so we can do
1590
# this comparison in relative safety
1592
(rev2, rev1) = (rev1, rev2)
1594
if log_format is None:
1595
log_format = log.log_formatter_registry.get_default(b)
1597
lf = log_format(show_ids=show_ids, to_file=self.outf,
1598
show_timezone=timezone)
1604
direction=direction,
1605
start_revision=rev1,
1584
1612
def get_log_format(long=False, short=False, line=False, default='long'):
2357
2385
default, use --remember. The value will only be saved if the remote
2358
2386
location can be accessed.
2388
The results of the merge are placed into the destination working
2389
directory, where they can be reviewed (with bzr diff), tested, and then
2390
committed to record the result of the merge.
2362
2394
To merge the latest revision from bzr.dev
2376
2408
takes_args = ['branch?']
2377
2409
takes_options = ['revision', 'force', 'merge-type', 'reprocess', 'remember',
2378
Option('show-base', help="Show base revision text in "
2380
Option('uncommitted', help='Apply uncommitted changes'
2381
' from a working copy, instead of branch changes'),
2382
Option('pull', help='If the destination is already'
2383
' completely merged into the source, pull from the'
2384
' source rather than merging. When this happens,'
2385
' you do not need to commit the result.'),
2410
Option('show-base', help="Show base revision text in "
2412
Option('uncommitted', help='Apply uncommitted changes'
2413
' from a working copy, instead of branch changes'),
2414
Option('pull', help='If the destination is already'
2415
' completely merged into the source, pull from the'
2416
' source rather than merging. When this happens,'
2417
' you do not need to commit the result.'),
2419
help='branch to merge into, '
2420
'rather than the one containing the working directory',
2388
2426
def run(self, branch=None, revision=None, force=False, merge_type=None,
2389
show_base=False, reprocess=False, remember=False,
2390
uncommitted=False, pull=False):
2427
show_base=False, reprocess=False, remember=False,
2428
uncommitted=False, pull=False,
2391
2431
if merge_type is None:
2392
2432
merge_type = _mod_merge.Merge3Merger
2394
tree = WorkingTree.open_containing(u'.')[0]
2434
if directory is None: directory = u'.'
2435
tree = WorkingTree.open_containing(directory)[0]
2436
change_reporter = delta.ChangeReporter(tree.inventory)
2396
2438
if branch is not None:
2913
2957
See "help checkouts" for more information on checkouts.
2916
takes_args = ['location']
2960
takes_args = ['location?']
2917
2961
takes_options = []
2919
2963
def run(self, location=None):
2920
2964
b, relpath = Branch.open_containing(u'.')
2965
if location is None:
2967
location = b.get_old_bound_location()
2968
except errors.UpgradeRequired:
2969
raise errors.BzrCommandError('No location supplied. '
2970
'This format does not remember old locations.')
2972
if location is None:
2973
raise errors.BzrCommandError('No location supplied and no '
2974
'previous location known')
2921
2975
b_other = Branch.open(location)
2923
2977
b.bind(b_other)
3161
3216
raise errors.BzrCommandError("Cannot do conflict reduction and show base.")
3163
3218
merger = _mod_merge.Merger(this_tree.branch, this_tree=this_tree,
3219
pb=pb, change_reporter=change_reporter)
3165
3220
merger.pp = ProgressPhase("Merge phase", 5, pb)
3166
3221
merger.pp.next_phase()
3167
3222
merger.check_basis(check_clean)