250
250
To skip the display of pending merge information altogether, use
251
251
the no-pending option or specify a file/directory.
253
To compare the working directory to a specific revision, pass a
254
single revision to the revision argument.
256
To see which files have changed in a specific revision, or between
257
two revisions, pass a revision range to the revision argument.
258
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.
261
257
# TODO: --no-recurse, --recurse options
927
923
"branch. Local pulls are not applied to "
928
924
"the master branch."
931
help="Show base revision text in conflicts.")
933
927
takes_args = ['location?']
934
928
encoding_type = 'replace'
936
930
def run(self, location=None, remember=False, overwrite=False,
937
931
revision=None, verbose=False,
938
directory=None, local=False,
932
directory=None, local=False):
940
933
# FIXME: too much stuff is in the command class
941
934
revision_id = None
1077
1063
def run(self, location=None, remember=False, overwrite=False,
1078
1064
create_prefix=False, verbose=False, revision=None,
1079
1065
use_existing_dir=False, directory=None, stacked_on=None,
1080
stacked=False, strict=None, no_tree=False):
1066
stacked=False, strict=None):
1081
1067
from bzrlib.push import _show_push_branch
1083
1069
if directory is None:
1129
1115
_show_push_branch(br_from, revision_id, location, self.outf,
1130
1116
verbose=verbose, overwrite=overwrite, remember=remember,
1131
1117
stacked_on=stacked_on, create_prefix=create_prefix,
1132
use_existing_dir=use_existing_dir, no_tree=no_tree)
1118
use_existing_dir=use_existing_dir)
1135
1121
class cmd_branch(Command):
1368
1354
If you want to discard your local changes, you can just do a
1369
1355
'bzr revert' instead of 'bzr commit' after the update.
1371
If you want to restore a file that has been removed locally, use
1372
'bzr revert' instead of 'bzr update'.
1374
1357
If the tree's branch is bound to a master branch, it will also update
1375
1358
the branch from the master.
1378
1361
_see_also = ['pull', 'working-trees', 'status-flags']
1379
1362
takes_args = ['dir?']
1380
takes_options = ['revision',
1382
help="Show base revision text in conflicts."),
1363
takes_options = ['revision']
1384
1364
aliases = ['up']
1386
def run(self, dir='.', revision=None, show_base=None):
1366
def run(self, dir='.', revision=None):
1387
1367
if revision is not None and len(revision) != 1:
1388
1368
raise errors.BzrCommandError(
1389
1369
"bzr update --revision takes exactly one revision")
1512
1491
title='Deletion Strategy', value_switches=True, enum_switch=False,
1513
1492
safe='Backup changed files (default).',
1514
1493
keep='Delete from bzr but leave the working copy.',
1515
no_backup='Don\'t backup changed files.',
1516
1494
force='Delete all the specified files, even if they can not be '
1517
'recovered and even if they are non-empty directories. '
1518
'(deprecated, use no-backup)')]
1495
'recovered and even if they are non-empty directories.')]
1519
1496
aliases = ['rm', 'del']
1520
1497
encoding_type = 'replace'
1522
1499
def run(self, file_list, verbose=False, new=False,
1523
1500
file_deletion_strategy='safe'):
1524
if file_deletion_strategy == 'force':
1525
note("(The --force option is deprecated, rather use --no-backup "
1527
file_deletion_strategy = 'no-backup'
1529
1501
tree, file_list = WorkingTree.open_containing_paths(file_list)
1531
1503
if file_list is not None:
1714
1686
Option('append-revisions-only',
1715
1687
help='Never change revnos or the existing log.'
1716
' Append revisions to it only.'),
1718
'Create a branch without a working tree.')
1688
' Append revisions to it only.')
1720
1690
def run(self, location=None, format=None, append_revisions_only=False,
1721
create_prefix=False, no_tree=False):
1691
create_prefix=False):
1722
1692
if format is None:
1723
1693
format = bzrdir.format_registry.make_bzrdir('default')
1724
1694
if location is None:
3328
3271
class cmd_upgrade(Command):
3329
__doc__ = """Upgrade a repository, branch or working tree to a newer format.
3331
When the default format has changed after a major new release of
3332
Bazaar, you may be informed during certain operations that you
3333
should upgrade. Upgrading to a newer format may improve performance
3334
or make new features available. It may however limit interoperability
3335
with older repositories or with older versions of Bazaar.
3337
If you wish to upgrade to a particular format rather than the
3338
current default, that can be specified using the --format option.
3339
As a consequence, you can use the upgrade command this way to
3340
"downgrade" to an earlier format, though some conversions are
3341
a one way process (e.g. changing from the 1.x default to the
3342
2.x default) so downgrading is not always possible.
3344
A backup.bzr.~#~ directory is created at the start of the conversion
3345
process (where # is a number). By default, this is left there on
3346
completion. If the conversion fails, delete the new .bzr directory
3347
and rename this one back in its place. Use the --clean option to ask
3348
for the backup.bzr directory to be removed on successful conversion.
3349
Alternatively, you can delete it by hand if everything looks good
3352
If the location given is a shared repository, dependent branches
3353
are also converted provided the repository converts successfully.
3354
If the conversion of a branch fails, remaining branches are still
3357
For more information on upgrades, see the Bazaar Upgrade Guide,
3358
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.
3361
_see_also = ['check', 'reconcile', 'formats']
3279
_see_also = ['check']
3362
3280
takes_args = ['url?']
3363
3281
takes_options = [
3364
RegistryOption('format',
3365
help='Upgrade to a specific format. See "bzr help'
3366
' formats" for details.',
3367
lazy_registry=('bzrlib.bzrdir', 'format_registry'),
3368
converter=lambda name: bzrdir.format_registry.make_bzrdir(name),
3369
value_switches=True, title='Branch format'),
3371
help='Remove the backup.bzr directory if successful.'),
3373
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'),
3376
def run(self, url='.', format=None, clean=False, dry_run=False):
3290
def run(self, url='.', format=None):
3377
3291
from bzrlib.upgrade import upgrade
3378
exceptions = upgrade(url, format, clean_up=clean, dry_run=dry_run)
3380
if len(exceptions) == 1:
3381
# Compatibility with historical behavior
3292
upgrade(url, format)
3387
3295
class cmd_whoami(Command):
3782
3687
with bzr send. If neither is specified, the default is the upstream branch
3783
3688
or the branch most recently merged using --remember.
3785
When merging from a branch, by default bzr will try to merge in all new
3786
work from the other branch, automatically determining an appropriate base
3787
revision. If this fails, you may need to give an explicit base.
3789
To pick a different ending revision, pass "--revision OTHER". bzr will
3790
try to merge in all new work up to and including revision OTHER.
3792
If you specify two values, "--revision BASE..OTHER", only revisions BASE
3793
through OTHER, excluding BASE but including OTHER, will be merged. If this
3794
causes some revisions to be skipped, i.e. if the destination branch does
3795
not already contain revision BASE, such a merge is commonly referred to as
3798
Revision numbers are always relative to the source branch.
3690
When merging a branch, by default the tip will be merged. To pick a different
3691
revision, pass --revision. If you specify two values, the first will be used as
3692
BASE and the second one as OTHER. Merging individual revisions, or a subset of
3693
available revisions, like this is commonly referred to as "cherrypicking".
3695
Revision numbers are always relative to the branch being merged.
3697
By default, bzr will try to merge in all new work from the other
3698
branch, automatically determining an appropriate base. If this
3699
fails, you may need to give an explicit base.
3800
3701
Merge will do its best to combine the changes in two branches, but there
3801
3702
are some kinds of problems only a human can fix. When it encounters those,
4065
3966
if ((remember or tree.branch.get_submit_branch() is None) and
4066
3967
user_location is not None):
4067
3968
tree.branch.set_submit_branch(other_branch.base)
4068
# Merge tags (but don't set them in the master branch yet, the user
4069
# might revert this merge). Commit will propagate them.
4070
_merge_tags_if_possible(other_branch, tree.branch, ignore_master=True)
3969
_merge_tags_if_possible(other_branch, tree.branch)
4071
3970
merger = _mod_merge.Merger.from_revision_ids(pb, tree,
4072
3971
other_revision_id, base_revision_id, other_branch, base_branch)
4073
3972
if other_path != '':
4241
4140
last committed revision is used.
4243
4142
To remove only some changes, without reverting to a prior version, use
4244
merge instead. For example, "merge . -r -2..-3" (don't forget the ".")
4245
will remove the changes introduced by the second last commit (-2), without
4246
affecting the changes introduced by the last commit (-1). To remove
4247
certain changes on a hunk-by-hunk basis, see the shelve command.
4143
merge instead. For example, "merge . --revision -2..-3" will remove the
4144
changes introduced by -2, without affecting the changes introduced by -1.
4145
Or to remove certain changes on a hunk-by-hunk basis, see the Shelf plugin.
4249
4147
By default, any files that have been manually changed will be backed up
4250
4148
first. (Files changed only by merge are not backed up.) Backup files have
4937
4832
takes_options = [
4938
4833
Option('config',
4939
4834
help='LOCATION is the directory where the config lock is.'),
4941
help='Do not ask for confirmation before breaking the lock.'),
4944
def run(self, location=None, config=False, force=False):
4837
def run(self, location=None, config=False):
4945
4838
if location is None:
4946
4839
location = u'.'
4948
ui.ui_factory = ui.ConfirmationUserInterfacePolicy(ui.ui_factory,
4950
{'bzrlib.lockdir.break': True})
4952
4841
conf = _mod_config.LockableConfig(file_name=location)
4953
4842
conf.break_lock()
5480
5369
takes_options = [
5481
5370
custom_help('directory',
5482
5371
help='Branch whose tags should be displayed.'),
5483
RegistryOption('sort',
5372
RegistryOption.from_kwargs('sort',
5484
5373
'Sort tags by different criteria.', title='Sorting',
5485
lazy_registry=('bzrlib.tag', 'tag_sort_methods')
5374
alpha='Sort tags lexicographically (default).',
5375
time='Sort tags chronologically.',
5491
5381
@display_command
5492
def run(self, directory='.', sort=None, show_ids=False, revision=None):
5493
from bzrlib.tag import tag_sort_methods
5494
5388
branch, relpath = Branch.open_containing(directory)
5496
5390
tags = branch.tags.get_tag_dict().items()
5505
5399
# only show revisions between revid1 and revid2 (inclusive)
5506
5400
tags = [(tag, revid) for tag, revid in tags if
5507
5401
graph.is_between(revid, revid1, revid2)]
5509
sort = tag_sort_methods.get()
5404
elif sort == 'time':
5406
for tag, revid in tags:
5408
revobj = branch.repository.get_revision(revid)
5409
except errors.NoSuchRevision:
5410
timestamp = sys.maxint # place them at the end
5412
timestamp = revobj.timestamp
5413
timestamps[revid] = timestamp
5414
tags.sort(key=lambda x: timestamps[x[1]])
5511
5415
if not show_ids:
5512
5416
# [ (tag, revid), ... ] -> [ (tag, dotted_revno), ... ]
5513
5417
for index, (tag, revid) in enumerate(tags):
5937
5841
You can put multiple items on the shelf, and by default, 'unshelve' will
5938
5842
restore the most recently shelved changes.
5940
For complicated changes, it is possible to edit the changes in a separate
5941
editor program to decide what the file remaining in the working copy
5942
should look like. To do this, add the configuration option
5944
change_editor = PROGRAM @new_path @old_path
5946
where @new_path is replaced with the path of the new version of the
5947
file and @old_path is replaced with the path of the old version of
5948
the file. The PROGRAM should save the new file with the desired
5949
contents of the file in the working tree.
5953
5845
takes_args = ['file*']
5965
5857
Option('destroy',
5966
5858
help='Destroy removed changes instead of shelving them.'),
5968
_see_also = ['unshelve', 'configuration']
5860
_see_also = ['unshelve']
5970
5862
def run(self, revision=None, all=False, file_list=None, message=None,
5971
writer=None, list=False, destroy=False, directory=None):
5863
writer=None, list=False, destroy=False, directory=u'.'):
5973
return self.run_for_list(directory=directory)
5865
return self.run_for_list()
5974
5866
from bzrlib.shelf_ui import Shelver
5975
5867
if writer is None:
5976
5868
writer = bzrlib.option.diff_writer_registry.get()
6122
6012
# be only called once.
6123
6013
for (name, aliases, module_name) in [
6124
6014
('cmd_bundle_info', [], 'bzrlib.bundle.commands'),
6125
('cmd_config', [], 'bzrlib.config'),
6126
6015
('cmd_dpush', [], 'bzrlib.foreign'),
6127
6016
('cmd_version_info', [], 'bzrlib.cmd_version_info'),
6128
6017
('cmd_resolve', ['resolved'], 'bzrlib.conflicts'),
6129
6018
('cmd_conflicts', [], 'bzrlib.conflicts'),
6130
6019
('cmd_sign_my_commits', [], 'bzrlib.sign_my_commits'),
6131
('cmd_test_script', [], 'bzrlib.cmd_test_script'),
6133
6021
builtin_command_registry.register_lazy(name, aliases, module_name)