239
239
# opens the branch?)
241
241
class cmd_status(Command):
242
"""Display status summary.
242
__doc__ = """Display status summary.
244
244
This reports on versioned and unknown files, reporting them
245
245
grouped by state. Possible states are:
334
334
class cmd_cat_revision(Command):
335
"""Write out metadata for a revision.
335
__doc__ = """Write out metadata for a revision.
337
337
The revision to print can either be specified by a specific
338
338
revision identifier, or you can use --revision.
392
392
class cmd_dump_btree(Command):
393
"""Dump the contents of a btree index file to stdout.
393
__doc__ = """Dump the contents of a btree index file to stdout.
395
395
PATH is a btree index file, it can be any URL. This includes things like
396
396
.bzr/repository/pack-names, or .bzr/repository/indices/a34b3a...ca4a4.iix
473
473
class cmd_remove_tree(Command):
474
"""Remove the working tree from a given branch/checkout.
474
__doc__ = """Remove the working tree from a given branch/checkout.
476
476
Since a lightweight checkout is little more than a working tree
477
477
this will refuse to run against one.
550
550
class cmd_revision_info(Command):
551
"""Show revision number and revision id for a given revision identifier.
551
__doc__ = """Show revision number and revision id for a given revision identifier.
554
554
takes_args = ['revision_info*']
612
612
class cmd_add(Command):
613
"""Add specified files or directories.
613
__doc__ = """Add specified files or directories.
615
615
In non-recursive mode, all the named items are added, regardless
616
616
of whether they were previously ignored. A warning is given if
735
735
class cmd_inventory(Command):
736
"""Show inventory of the current working copy or a revision.
736
__doc__ = """Show inventory of the current working copy or a revision.
738
738
It is possible to limit the output to a particular entry
739
739
type using the --kind option. For example: --kind file.
933
933
class cmd_pull(Command):
934
"""Turn this branch into a mirror of another branch.
934
__doc__ = """Turn this branch into a mirror of another branch.
936
936
By default, this command only works on branches that have not diverged.
937
937
Branches are considered diverged if the destination branch's most recent
1060
1060
class cmd_push(Command):
1061
"""Update a mirror of this branch.
1061
__doc__ = """Update a mirror of this branch.
1063
1063
The target branch will not have its working tree populated because this
1064
1064
is both expensive, and is not supported on remote file systems.
1173
1173
class cmd_branch(Command):
1174
"""Create a new branch that is a copy of an existing branch.
1174
__doc__ = """Create a new branch that is a copy of an existing branch.
1176
1176
If the TO_LOCATION is omitted, the last component of the FROM_LOCATION will
1177
1177
be used. In other words, "branch ../foo/bar" will attempt to create ./bar.
1286
1286
class cmd_checkout(Command):
1287
"""Create a new checkout of an existing branch.
1287
__doc__ = """Create a new checkout of an existing branch.
1289
1289
If BRANCH_LOCATION is omitted, checkout will reconstitute a working tree for
1290
1290
the branch found in '.'. This is useful if you have removed the working tree
1387
1387
class cmd_update(Command):
1388
"""Update a tree to have the latest code committed to its branch.
1388
__doc__ = """Update a tree to have the latest code committed to its branch.
1390
1390
This will perform a merge into the working tree, and may generate
1391
1391
conflicts. If you have any local changes, you will still
1473
1473
class cmd_info(Command):
1474
"""Show information about a working tree, branch or repository.
1474
__doc__ = """Show information about a working tree, branch or repository.
1476
1476
This command will show all known locations and formats associated to the
1477
1477
tree, branch or repository.
1517
1517
class cmd_remove(Command):
1518
"""Remove files or directories.
1518
__doc__ = """Remove files or directories.
1520
1520
This makes bzr stop tracking changes to the specified files. bzr will delete
1521
1521
them if they can easily be recovered using revert. If no options or
1571
1571
class cmd_file_id(Command):
1572
"""Print file_id of a particular file or directory.
1572
__doc__ = """Print file_id of a particular file or directory.
1574
1574
The file_id is assigned when the file is first added and remains the
1575
1575
same through all revisions where the file exists, even when it is
1593
1593
class cmd_file_path(Command):
1594
"""Print path of file_ids to a file or directory.
1594
__doc__ = """Print path of file_ids to a file or directory.
1596
1596
This prints one line for each directory down to the target,
1597
1597
starting at the branch root.
1615
1615
class cmd_reconcile(Command):
1616
"""Reconcile bzr metadata in a branch.
1616
__doc__ = """Reconcile bzr metadata in a branch.
1618
1618
This can correct data mismatches that may have been caused by
1619
1619
previous ghost operations or bzr upgrades. You should only
1659
1659
class cmd_ancestry(Command):
1660
"""List all revisions merged into this branch."""
1660
__doc__ = """List all revisions merged into this branch."""
1662
1662
_see_also = ['log', 'revision-history']
1663
1663
takes_args = ['location?']
1793
1793
class cmd_init_repository(Command):
1794
"""Create a shared repository for branches to share storage space.
1794
__doc__ = """Create a shared repository for branches to share storage space.
1796
1796
New branches created under the repository directory will store their
1797
1797
revisions in the repository, not in the branch directory. For branches
1853
1853
class cmd_diff(Command):
1854
"""Show differences in the working tree, between revisions or branches.
1854
__doc__ = """Show differences in the working tree, between revisions or branches.
1856
1856
If no arguments are given, all changes for the current tree are listed.
1857
1857
If files are given, only the changes in those files are listed.
1994
1994
class cmd_deleted(Command):
1995
"""List files deleted in the working tree.
1995
__doc__ = """List files deleted in the working tree.
1997
1997
# TODO: Show files deleted since a previous revision, or
1998
1998
# between two revisions.
2112
2112
class cmd_log(Command):
2113
"""Show historical log for a branch or subset of a branch.
2113
__doc__ = """Show historical log for a branch or subset of a branch.
2115
2115
log is bzr's default tool for exploring the history of a branch.
2116
2116
The branch to use is taken from the first parameter. If no parameters
2483
2483
class cmd_touching_revisions(Command):
2484
"""Return revision-ids which affected a particular file.
2484
__doc__ = """Return revision-ids which affected a particular file.
2486
2486
A more user-friendly interface is "bzr log FILE".
2647
2647
using this command or directly by using an editor, be sure to commit
2650
Bazaar also supports a global ignore file ~/.bazaar/ignore. On Windows
2651
the global ignore file can be found in the application data directory as
2652
C:\\Documents and Settings\\<user>\\Application Data\\Bazaar\\2.0\\ignore.
2653
Global ignores are not touched by this command. The global ignore file
2654
can be edited directly using an editor.
2650
2656
Patterns prefixed with '!' are exceptions to ignore patterns and take
2651
2657
precedence over regular ignores. Such exceptions are used to specify
2652
2658
files that should be versioned which would otherwise be ignored.
2693
2699
_see_also = ['status', 'ignored', 'patterns']
2694
2700
takes_args = ['name_pattern*']
2695
2701
takes_options = [
2696
Option('old-default-rules',
2697
help='Write out the ignore rules bzr < 0.9 always used.')
2702
Option('default-rules',
2703
help='Display the default ignore rules that bzr uses.')
2700
def run(self, name_pattern_list=None, old_default_rules=None):
2706
def run(self, name_pattern_list=None, default_rules=None):
2701
2707
from bzrlib import ignores
2702
if old_default_rules is not None:
2703
# dump the rules and exit
2704
for pattern in ignores.OLD_DEFAULTS:
2708
if default_rules is not None:
2709
# dump the default rules and exit
2710
for pattern in ignores.USER_DEFAULTS:
2705
2711
self.outf.write("%s\n" % pattern)
2707
2713
if not name_pattern_list:
2708
2714
raise errors.BzrCommandError("ignore requires at least one "
2709
"NAME_PATTERN or --old-default-rules")
2715
"NAME_PATTERN or --default-rules.")
2710
2716
name_pattern_list = [globbing.normalize_pattern(p)
2711
2717
for p in name_pattern_list]
2712
2718
for name_pattern in name_pattern_list:
2736
2742
class cmd_ignored(Command):
2737
"""List ignored files and the patterns that matched them.
2743
__doc__ = """List ignored files and the patterns that matched them.
2739
2745
List all the ignored files and the ignore pattern that caused the file to
2783
2789
class cmd_export(Command):
2784
"""Export current or past revision to a destination directory or archive.
2790
__doc__ = """Export current or past revision to a destination directory or archive.
2786
2792
If no revision is specified this exports the last committed revision.
2941
2947
class cmd_commit(Command):
2942
"""Commit changes into a new revision.
2948
__doc__ = """Commit changes into a new revision.
2944
2950
An explanatory message needs to be given for each commit. This is
2945
2951
often done by using the --message option (getting the message from the
3207
3213
class cmd_check(Command):
3208
"""Validate working tree structure, branch consistency and repository history.
3214
__doc__ = """Validate working tree structure, branch consistency and repository history.
3210
3216
This command checks various invariants about branch and repository storage
3211
3217
to detect data corruption or bzr bugs.
3277
3283
class cmd_upgrade(Command):
3278
"""Upgrade branch storage to current format.
3284
__doc__ = """Upgrade branch storage to current format.
3280
3286
The check command or bzr developers may sometimes advise you to run
3281
3287
this command. When the default format has changed you may also be warned
3351
3357
class cmd_nick(Command):
3352
"""Print or set the branch nickname.
3358
__doc__ = """Print or set the branch nickname.
3354
3360
If unset, the tree root directory name is used as the nickname.
3355
3361
To print the current nickname, execute with no argument.
3445
3451
class cmd_selftest(Command):
3446
"""Run internal test suite.
3452
__doc__ = """Run internal test suite.
3448
3454
If arguments are given, they are regular expressions that say which tests
3449
3455
should run. Tests matching any expression are run, and other tests are
3590
3596
raise errors.BzrCommandError("subunit not available. subunit "
3591
3597
"needs to be installed to use --subunit.")
3592
3598
self.additional_selftest_args['runner_class'] = SubUnitBzrRunner
3599
# On Windows, disable automatic conversion of '\n' to '\r\n' in
3600
# stdout, which would corrupt the subunit stream.
3601
if sys.platform == "win32" and sys.stdout.fileno() >= 0:
3603
msvcrt.setmode(sys.stdout.fileno(), os.O_BINARY)
3594
3605
self.additional_selftest_args.setdefault(
3595
3606
'suite_decorators', []).append(parallel)
3655
3666
class cmd_find_merge_base(Command):
3656
"""Find and print a base revision for merging two branches."""
3667
__doc__ = """Find and print a base revision for merging two branches."""
3657
3668
# TODO: Options to specify revisions on either side, as if
3658
3669
# merging only part of the history.
3659
3670
takes_args = ['branch', 'other']
3681
3692
class cmd_merge(Command):
3682
"""Perform a three-way merge.
3693
__doc__ = """Perform a three-way merge.
3684
3695
The source of the merge can be specified either in the form of a branch,
3685
3696
or in the form of a path to a file containing a merge directive generated
4042
4053
class cmd_remerge(Command):
4054
__doc__ = """Redo a merge.
4045
4056
Use this if you want to try a different merge technique while resolving
4046
4057
conflicts. Some merge techniques are better than others, and remerge
4137
4148
class cmd_revert(Command):
4138
"""Revert files to a previous revision.
4149
__doc__ = """Revert files to a previous revision.
4140
4151
Giving a list of files will revert only those files. Otherwise, all files
4141
4152
will be reverted. If the revision is not specified with '--revision', the
4192
4203
def run(self, revision=None, no_backup=False, file_list=None,
4193
4204
forget_merges=None):
4194
4205
tree, file_list = tree_files(file_list)
4206
tree.lock_tree_write()
4196
4207
self.add_cleanup(tree.unlock)
4197
4208
if forget_merges:
4198
4209
tree.set_parent_ids(tree.get_parent_ids()[:1])
4238
4249
class cmd_shell_complete(Command):
4239
"""Show appropriate completions for context.
4250
__doc__ = """Show appropriate completions for context.
4241
4252
For a list of all available commands, say 'bzr shell-complete'.
4426
4437
class cmd_pack(Command):
4427
"""Compress the data within a repository."""
4438
__doc__ = """Compress the data within a repository.
4440
This operation compresses the data within a bazaar repository. As
4441
bazaar supports automatic packing of repository, this operation is
4442
normally not required to be done manually.
4444
During the pack operation, bazaar takes a backup of existing repository
4445
data, i.e. pack files. This backup is eventually removed by bazaar
4446
automatically when it is safe to do so. To save disk space by removing
4447
the backed up pack files, the --clean-obsolete-packs option may be
4450
Warning: If you use --clean-obsolete-packs and your machine crashes
4451
during or immediately after repacking, you may be left with a state
4452
where the deletion has been written to disk but the new packs have not
4453
been. In this case the repository may be unusable.
4429
4456
_see_also = ['repositories']
4430
4457
takes_args = ['branch_or_repo?']
4459
Option('clean-obsolete-packs', 'Delete obsolete packs to save disk space.'),
4432
def run(self, branch_or_repo='.'):
4462
def run(self, branch_or_repo='.', clean_obsolete_packs=False):
4433
4463
dir = bzrdir.BzrDir.open_containing(branch_or_repo)[0]
4435
4465
branch = dir.open_branch()
4436
4466
repository = branch.repository
4437
4467
except errors.NotBranchError:
4438
4468
repository = dir.open_repository()
4469
repository.pack(clean_obsolete_packs=clean_obsolete_packs)
4442
4472
class cmd_plugins(Command):
4443
"""List the installed plugins.
4473
__doc__ = """List the installed plugins.
4445
4475
This command displays the list of installed plugins including
4446
4476
version of plugin and a short description of each.
4487
4517
class cmd_testament(Command):
4488
"""Show testament (signing-form) of a revision."""
4518
__doc__ = """Show testament (signing-form) of a revision."""
4489
4519
takes_options = [
4491
4521
Option('long', help='Produce long-format testament.'),
4519
4549
class cmd_annotate(Command):
4520
"""Show the origin of each line in a file.
4550
__doc__ = """Show the origin of each line in a file.
4522
4552
This prints out the given file with an annotation on the left side
4523
4553
indicating which revision, author and date introduced the change.
4572
4602
class cmd_re_sign(Command):
4573
"""Create a digital signature for an existing revision."""
4603
__doc__ = """Create a digital signature for an existing revision."""
4574
4604
# TODO be able to replace existing ones.
4576
4606
hidden = True # is this right ?
4638
4668
class cmd_bind(Command):
4639
"""Convert the current branch into a checkout of the supplied branch.
4669
__doc__ = """Convert the current branch into a checkout of the supplied branch.
4641
4671
Once converted into a checkout, commits must succeed on the master branch
4642
4672
before they will be applied to the local branch.
4678
4708
class cmd_unbind(Command):
4679
"""Convert the current checkout into a regular branch.
4709
__doc__ = """Convert the current checkout into a regular branch.
4681
4711
After unbinding, the local branch is considered independent and subsequent
4682
4712
commits will be local only.
4695
4725
class cmd_uncommit(Command):
4696
"""Remove the last committed revision.
4726
__doc__ = """Remove the last committed revision.
4698
4728
--verbose will print out what is being removed.
4699
4729
--dry-run will go through all the motions, but not actually
4803
4833
class cmd_break_lock(Command):
4804
"""Break a dead lock on a repository, branch or working directory.
4834
__doc__ = """Break a dead lock on a repository, branch or working directory.
4806
4836
CAUTION: Locks should only be broken when you are sure that the process
4807
4837
holding the lock has been stopped.
4828
4858
class cmd_wait_until_signalled(Command):
4829
"""Test helper for test_start_and_stop_bzr_subprocess_send_signal.
4859
__doc__ = """Test helper for test_start_and_stop_bzr_subprocess_send_signal.
4831
4861
This just prints a line to signal when it is ready, then blocks on stdin.
4954
4984
class cmd_split(Command):
4955
"""Split a subdirectory of a tree into a separate tree.
4985
__doc__ = """Split a subdirectory of a tree into a separate tree.
4957
4987
This command will produce a target tree in a format that supports
4958
4988
rich roots, like 'rich-root' or 'rich-root-pack'. These formats cannot be
4980
5010
class cmd_merge_directive(Command):
4981
"""Generate a merge directive for auto-merge tools.
5011
__doc__ = """Generate a merge directive for auto-merge tools.
4983
5013
A directive requests a merge to be performed, and also provides all the
4984
5014
information necessary to do so. This means it must either include a
5196
5226
class cmd_bundle_revisions(cmd_send):
5197
"""Create a merge-directive for submitting changes.
5227
__doc__ = """Create a merge-directive for submitting changes.
5199
5229
A merge directive provides many things needed for requesting merges:
5269
5299
class cmd_tag(Command):
5270
"""Create, remove or modify a tag naming a revision.
5300
__doc__ = """Create, remove or modify a tag naming a revision.
5272
5302
Tags give human-meaningful names to revisions. Commands that take a -r
5273
5303
(--revision) option can be given -rtag:X, where X is any previously
5507
5537
class cmd_switch(Command):
5508
"""Set the branch of a checkout and update.
5538
__doc__ = """Set the branch of a checkout and update.
5510
5540
For lightweight checkouts, this changes the branch being referenced.
5511
5541
For heavyweight checkouts, this checks that there are no local commits
5603
5633
class cmd_view(Command):
5604
"""Manage filtered views.
5634
__doc__ = """Manage filtered views.
5606
5636
Views provide a mask over the tree so that users can focus on
5607
5637
a subset of a tree when doing their work. After creating a view,
5802
5832
class cmd_shelve(Command):
5803
"""Temporarily set aside some changes from the current tree.
5833
__doc__ = """Temporarily set aside some changes from the current tree.
5805
5835
Shelve allows you to temporarily put changes you've made "on the shelf",
5806
5836
ie. out of the way, until a later time when you can bring them back from
5877
5907
class cmd_unshelve(Command):
5878
"""Restore shelved changes.
5908
__doc__ = """Restore shelved changes.
5880
5910
By default, the most recently shelved changes are restored. However if you
5881
5911
specify a shelf by id those changes will be restored instead. This works
5909
5939
class cmd_clean_tree(Command):
5910
"""Remove unwanted files from working tree.
5940
__doc__ = """Remove unwanted files from working tree.
5912
5942
By default, only unknown files, not ignored files, are deleted. Versioned
5913
5943
files are never deleted.
5943
5973
class cmd_reference(Command):
5944
"""list, view and set branch locations for nested trees.
5974
__doc__ = """list, view and set branch locations for nested trees.
5946
5976
If no arguments are provided, lists the branch locations for nested trees.
5947
5977
If one argument is provided, display the branch location for that tree.