252
250
To skip the display of pending merge information altogether, use
253
251
the no-pending option or specify a file/directory.
255
To compare the working directory to a specific revision, pass a
256
single revision to the revision argument.
258
To see which files have changed in a specific revision, or between
259
two revisions, pass a revision range to the revision argument.
260
This will produce the same results as calling 'bzr diff --summarize'.
253
If a revision argument is given, the status is calculated against
254
that revision, or between two revisions if two are provided.
263
257
# TODO: --no-recurse, --recurse options
929
923
"branch. Local pulls are not applied to "
930
924
"the master branch."
933
help="Show base revision text in conflicts.")
935
927
takes_args = ['location?']
936
928
encoding_type = 'replace'
938
930
def run(self, location=None, remember=False, overwrite=False,
939
931
revision=None, verbose=False,
940
directory=None, local=False,
932
directory=None, local=False):
942
933
# FIXME: too much stuff is in the command class
943
934
revision_id = None
1079
1063
def run(self, location=None, remember=False, overwrite=False,
1080
1064
create_prefix=False, verbose=False, revision=None,
1081
1065
use_existing_dir=False, directory=None, stacked_on=None,
1082
stacked=False, strict=None, no_tree=False):
1066
stacked=False, strict=None):
1083
1067
from bzrlib.push import _show_push_branch
1085
1069
if directory is None:
1131
1115
_show_push_branch(br_from, revision_id, location, self.outf,
1132
1116
verbose=verbose, overwrite=overwrite, remember=remember,
1133
1117
stacked_on=stacked_on, create_prefix=create_prefix,
1134
use_existing_dir=use_existing_dir, no_tree=no_tree)
1118
use_existing_dir=use_existing_dir)
1137
1121
class cmd_branch(Command):
1370
1354
If you want to discard your local changes, you can just do a
1371
1355
'bzr revert' instead of 'bzr commit' after the update.
1373
If you want to restore a file that has been removed locally, use
1374
'bzr revert' instead of 'bzr update'.
1376
1357
If the tree's branch is bound to a master branch, it will also update
1377
1358
the branch from the master.
1380
1361
_see_also = ['pull', 'working-trees', 'status-flags']
1381
1362
takes_args = ['dir?']
1382
takes_options = ['revision',
1384
help="Show base revision text in conflicts."),
1363
takes_options = ['revision']
1386
1364
aliases = ['up']
1388
def run(self, dir='.', revision=None, show_base=None):
1366
def run(self, dir='.', revision=None):
1389
1367
if revision is not None and len(revision) != 1:
1390
1368
raise errors.BzrCommandError(
1391
1369
"bzr update --revision takes exactly one revision")
1514
1491
title='Deletion Strategy', value_switches=True, enum_switch=False,
1515
1492
safe='Backup changed files (default).',
1516
1493
keep='Delete from bzr but leave the working copy.',
1517
no_backup='Don\'t backup changed files.',
1518
1494
force='Delete all the specified files, even if they can not be '
1519
'recovered and even if they are non-empty directories. '
1520
'(deprecated, use no-backup)')]
1495
'recovered and even if they are non-empty directories.')]
1521
1496
aliases = ['rm', 'del']
1522
1497
encoding_type = 'replace'
1524
1499
def run(self, file_list, verbose=False, new=False,
1525
1500
file_deletion_strategy='safe'):
1526
if file_deletion_strategy == 'force':
1527
note("(The --force option is deprecated, rather use --no-backup "
1529
file_deletion_strategy = 'no-backup'
1531
1501
tree, file_list = WorkingTree.open_containing_paths(file_list)
1533
1503
if file_list is not None:
1716
1686
Option('append-revisions-only',
1717
1687
help='Never change revnos or the existing log.'
1718
' Append revisions to it only.'),
1720
'Create a branch without a working tree.')
1688
' Append revisions to it only.')
1722
1690
def run(self, location=None, format=None, append_revisions_only=False,
1723
create_prefix=False, no_tree=False):
1691
create_prefix=False):
1724
1692
if format is None:
1725
1693
format = bzrdir.format_registry.make_bzrdir('default')
1726
1694
if location is None:
3330
3271
class cmd_upgrade(Command):
3331
__doc__ = """Upgrade a repository, branch or working tree to a newer format.
3333
When the default format has changed after a major new release of
3334
Bazaar, you may be informed during certain operations that you
3335
should upgrade. Upgrading to a newer format may improve performance
3336
or make new features available. It may however limit interoperability
3337
with older repositories or with older versions of Bazaar.
3339
If you wish to upgrade to a particular format rather than the
3340
current default, that can be specified using the --format option.
3341
As a consequence, you can use the upgrade command this way to
3342
"downgrade" to an earlier format, though some conversions are
3343
a one way process (e.g. changing from the 1.x default to the
3344
2.x default) so downgrading is not always possible.
3346
A backup.bzr.~#~ directory is created at the start of the conversion
3347
process (where # is a number). By default, this is left there on
3348
completion. If the conversion fails, delete the new .bzr directory
3349
and rename this one back in its place. Use the --clean option to ask
3350
for the backup.bzr directory to be removed on successful conversion.
3351
Alternatively, you can delete it by hand if everything looks good
3354
If the location given is a shared repository, dependent branches
3355
are also converted provided the repository converts successfully.
3356
If the conversion of a branch fails, remaining branches are still
3359
For more information on upgrades, see the Bazaar Upgrade Guide,
3360
http://doc.bazaar.canonical.com/latest/en/upgrade-guide/.
3272
__doc__ = """Upgrade branch storage to current format.
3274
The check command or bzr developers may sometimes advise you to run
3275
this command. When the default format has changed you may also be warned
3276
during other operations to upgrade.
3363
_see_also = ['check', 'reconcile', 'formats']
3279
_see_also = ['check']
3364
3280
takes_args = ['url?']
3365
3281
takes_options = [
3366
RegistryOption('format',
3367
help='Upgrade to a specific format. See "bzr help'
3368
' formats" for details.',
3369
lazy_registry=('bzrlib.bzrdir', 'format_registry'),
3370
converter=lambda name: bzrdir.format_registry.make_bzrdir(name),
3371
value_switches=True, title='Branch format'),
3373
help='Remove the backup.bzr directory if successful.'),
3375
help="Show what would be done, but don't actually do anything."),
3282
RegistryOption('format',
3283
help='Upgrade to a specific format. See "bzr help'
3284
' formats" for details.',
3285
lazy_registry=('bzrlib.bzrdir', 'format_registry'),
3286
converter=lambda name: bzrdir.format_registry.make_bzrdir(name),
3287
value_switches=True, title='Branch format'),
3378
def run(self, url='.', format=None, clean=False, dry_run=False):
3290
def run(self, url='.', format=None):
3379
3291
from bzrlib.upgrade import upgrade
3380
exceptions = upgrade(url, format, clean_up=clean, dry_run=dry_run)
3382
if len(exceptions) == 1:
3383
# Compatibility with historical behavior
3292
upgrade(url, format)
3389
3295
class cmd_whoami(Command):
3667
3570
randomize=None, exclude=None, strict=False,
3668
3571
load_list=None, debugflag=None, starting_with=None, subunit=False,
3669
3572
parallel=None, lsprof_tests=False):
3670
from bzrlib import tests
3573
from bzrlib.tests import selftest
3575
# Make deprecation warnings visible, unless -Werror is set
3576
symbol_versioning.activate_deprecation_warnings(override=False)
3672
3578
if testspecs_list is not None:
3673
3579
pattern = '|'.join(testspecs_list)
3784
3683
with bzr send. If neither is specified, the default is the upstream branch
3785
3684
or the branch most recently merged using --remember.
3787
When merging from a branch, by default bzr will try to merge in all new
3788
work from the other branch, automatically determining an appropriate base
3789
revision. If this fails, you may need to give an explicit base.
3791
To pick a different ending revision, pass "--revision OTHER". bzr will
3792
try to merge in all new work up to and including revision OTHER.
3794
If you specify two values, "--revision BASE..OTHER", only revisions BASE
3795
through OTHER, excluding BASE but including OTHER, will be merged. If this
3796
causes some revisions to be skipped, i.e. if the destination branch does
3797
not already contain revision BASE, such a merge is commonly referred to as
3800
Revision numbers are always relative to the source branch.
3686
When merging a branch, by default the tip will be merged. To pick a different
3687
revision, pass --revision. If you specify two values, the first will be used as
3688
BASE and the second one as OTHER. Merging individual revisions, or a subset of
3689
available revisions, like this is commonly referred to as "cherrypicking".
3691
Revision numbers are always relative to the branch being merged.
3693
By default, bzr will try to merge in all new work from the other
3694
branch, automatically determining an appropriate base. If this
3695
fails, you may need to give an explicit base.
3802
3697
Merge will do its best to combine the changes in two branches, but there
3803
3698
are some kinds of problems only a human can fix. When it encounters those,
4067
3962
if ((remember or tree.branch.get_submit_branch() is None) and
4068
3963
user_location is not None):
4069
3964
tree.branch.set_submit_branch(other_branch.base)
4070
# Merge tags (but don't set them in the master branch yet, the user
4071
# might revert this merge). Commit will propagate them.
4072
_merge_tags_if_possible(other_branch, tree.branch, ignore_master=True)
3965
_merge_tags_if_possible(other_branch, tree.branch)
4073
3966
merger = _mod_merge.Merger.from_revision_ids(pb, tree,
4074
3967
other_revision_id, base_revision_id, other_branch, base_branch)
4075
3968
if other_path != '':
4243
4136
last committed revision is used.
4245
4138
To remove only some changes, without reverting to a prior version, use
4246
merge instead. For example, "merge . -r -2..-3" (don't forget the ".")
4247
will remove the changes introduced by the second last commit (-2), without
4248
affecting the changes introduced by the last commit (-1). To remove
4249
certain changes on a hunk-by-hunk basis, see the shelve command.
4139
merge instead. For example, "merge . --revision -2..-3" will remove the
4140
changes introduced by -2, without affecting the changes introduced by -1.
4141
Or to remove certain changes on a hunk-by-hunk basis, see the Shelf plugin.
4251
4143
By default, any files that have been manually changed will be backed up
4252
4144
first. (Files changed only by merge are not backed up.) Backup files have
4939
4828
takes_options = [
4940
4829
Option('config',
4941
4830
help='LOCATION is the directory where the config lock is.'),
4943
help='Do not ask for confirmation before breaking the lock.'),
4946
def run(self, location=None, config=False, force=False):
4833
def run(self, location=None, config=False):
4947
4834
if location is None:
4948
4835
location = u'.'
4950
ui.ui_factory = ui.ConfirmationUserInterfacePolicy(ui.ui_factory,
4952
{'bzrlib.lockdir.break': True})
4954
4837
conf = _mod_config.LockableConfig(file_name=location)
4955
4838
conf.break_lock()
5484
5367
help='Branch whose tags should be displayed.'),
5485
5368
RegistryOption.from_kwargs('sort',
5486
5369
'Sort tags by different criteria.', title='Sorting',
5487
natural='Sort numeric substrings as numbers:'
5488
' suitable for version numbers. (default)',
5489
alpha='Sort tags lexicographically.',
5370
alpha='Sort tags lexicographically (default).',
5490
5371
time='Sort tags chronologically.',
5514
5395
# only show revisions between revid1 and revid2 (inclusive)
5515
5396
tags = [(tag, revid) for tag, revid in tags if
5516
5397
graph.is_between(revid, revid1, revid2)]
5517
if sort == 'natural':
5518
def natural_sort_key(tag):
5519
return [f(s) for f,s in
5520
zip(itertools.cycle((unicode.lower,int)),
5521
re.split('([0-9]+)', tag[0]))]
5522
tags.sort(key=natural_sort_key)
5523
elif sort == 'alpha':
5525
5400
elif sort == 'time':
5526
5401
timestamps = {}
5962
5837
You can put multiple items on the shelf, and by default, 'unshelve' will
5963
5838
restore the most recently shelved changes.
5965
For complicated changes, it is possible to edit the changes in a separate
5966
editor program to decide what the file remaining in the working copy
5967
should look like. To do this, add the configuration option
5969
change_editor = PROGRAM @new_path @old_path
5971
where @new_path is replaced with the path of the new version of the
5972
file and @old_path is replaced with the path of the old version of
5973
the file. The PROGRAM should save the new file with the desired
5974
contents of the file in the working tree.
5978
5841
takes_args = ['file*']
5990
5853
Option('destroy',
5991
5854
help='Destroy removed changes instead of shelving them.'),
5993
_see_also = ['unshelve', 'configuration']
5856
_see_also = ['unshelve']
5995
5858
def run(self, revision=None, all=False, file_list=None, message=None,
5996
writer=None, list=False, destroy=False, directory=None):
5859
writer=None, list=False, destroy=False, directory=u'.'):
5998
return self.run_for_list(directory=directory)
5861
return self.run_for_list()
5999
5862
from bzrlib.shelf_ui import Shelver
6000
5863
if writer is None:
6001
5864
writer = bzrlib.option.diff_writer_registry.get()
6147
6008
# be only called once.
6148
6009
for (name, aliases, module_name) in [
6149
6010
('cmd_bundle_info', [], 'bzrlib.bundle.commands'),
6150
('cmd_config', [], 'bzrlib.config'),
6151
6011
('cmd_dpush', [], 'bzrlib.foreign'),
6152
6012
('cmd_version_info', [], 'bzrlib.cmd_version_info'),
6153
6013
('cmd_resolve', ['resolved'], 'bzrlib.conflicts'),
6154
6014
('cmd_conflicts', [], 'bzrlib.conflicts'),
6155
6015
('cmd_sign_my_commits', [], 'bzrlib.sign_my_commits'),
6156
('cmd_test_script', [], 'bzrlib.cmd_test_script'),
6158
6017
builtin_command_registry.register_lazy(name, aliases, module_name)