14
14
# along with this program; if not, write to the Free Software
15
15
# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
17
"""builtin bzr commands"""
17
"""builtin brz commands"""
19
19
from __future__ import absolute_import
25
from bzrlib import lazy_import
25
from breezy import lazy_import
26
26
lazy_import.lazy_import(globals(), """
59
from bzrlib.branch import Branch
60
from bzrlib.conflicts import ConflictList
61
from bzrlib.transport import memory
62
from bzrlib.revisionspec import RevisionSpec, RevisionInfo
63
from bzrlib.smtp_connection import SMTPConnection
64
from bzrlib.workingtree import WorkingTree
65
from bzrlib.i18n import gettext, ngettext
59
from breezy.branch import Branch
60
from breezy.conflicts import ConflictList
61
from breezy.transport import memory
62
from breezy.revisionspec import RevisionSpec, RevisionInfo
63
from breezy.smtp_connection import SMTPConnection
64
from breezy.workingtree import WorkingTree
65
from breezy.i18n import gettext, ngettext
68
from bzrlib.commands import (
68
from breezy.commands import (
70
70
builtin_command_registry,
73
from bzrlib.option import (
73
from breezy.option import (
78
78
_parse_revision_str,
80
from bzrlib.trace import mutter, note, warning, is_quiet, get_verbosity_level
80
from breezy.trace import mutter, note, warning, is_quiet, get_verbosity_level
343
343
character: '/', '@' or '*' respectively. These decorations can be
344
344
disabled using the '--no-classify' option.
346
To see ignored files use 'bzr ignored'. For details on the
347
changes to file texts, use 'bzr diff'.
346
To see ignored files use 'brz ignored'. For details on the
347
changes to file texts, use 'brz diff'.
349
349
Note that --short or -S gives status flags for each item, similar
350
350
to Subversion's status command. To get output similar to svn -q,
353
353
If no arguments are specified, the status of the entire working
354
354
directory is shown. Otherwise, only the status of the specified
391
391
def run(self, show_ids=False, file_list=None, revision=None, short=False,
392
392
versioned=False, no_pending=False, verbose=False,
393
393
no_classify=False):
394
from bzrlib.status import show_tree_status
394
from breezy.status import show_tree_status
396
396
if revision and len(revision) > 2:
397
raise errors.BzrCommandError(gettext('bzr status --revision takes exactly'
397
raise errors.BzrCommandError(gettext('brz status --revision takes exactly'
398
398
' one or two revision specifiers'))
400
400
tree, relfile_list = WorkingTree.open_containing_paths(file_list)
563
563
Since a lightweight checkout is little more than a working tree
564
564
this will refuse to run against one.
566
To re-create the working tree, use "bzr checkout".
566
To re-create the working tree, use "brz checkout".
568
568
_see_also = ['checkout', 'working-trees']
569
569
takes_args = ['location*']
608
608
'known good' state. Any new modifications (adding a file, renaming, etc)
609
609
will be lost, though modified files will still be detected as such.
611
Most users will want something more like "bzr revert" or "bzr update"
611
Most users will want something more like "brz revert" or "brz update"
612
612
unless the state file has become corrupted.
614
614
By default this attempts to recover the current state by looking at the
830
830
base_tree = base_branch.basis_tree()
832
action = bzrlib.add.AddFromBaseAction(base_tree, base_path,
832
action = breezy.add.AddFromBaseAction(base_tree, base_path,
833
833
to_file=self.outf, should_print=(not is_quiet()))
835
action = bzrlib.add.AddWithSkipLargeAction(to_file=self.outf,
835
action = breezy.add.AddWithSkipLargeAction(to_file=self.outf,
836
836
should_print=(not is_quiet()))
996
996
takes_args = ['names*']
997
takes_options = [Option("after", help="Move only the bzr identifier"
997
takes_options = [Option("after", help="Move only the brz identifier"
998
998
" of the file, because the file has already been moved."),
999
999
Option('auto', help='Automatically guess renames.'),
1000
1000
Option('dry-run', help='Avoid making changes when guessing renames.'),
1269
1269
considered diverged if the destination branch's most recent commit is one
1270
1270
that has not been merged (directly or indirectly) by the source branch.
1272
If branches have diverged, you can use 'bzr push --overwrite' to replace
1272
If branches have diverged, you can use 'brz push --overwrite' to replace
1273
1273
the other branch completely, discarding its unmerged changes.
1275
1275
If you want to ensure you have the different changes in the other branch,
1276
do a merge (see bzr help merge) from the other branch, and commit that.
1276
do a merge (see brz help merge) from the other branch, and commit that.
1277
1277
After that you will be able to do a push without '--overwrite'.
1279
1279
If there is no default push location set, the first push will set it (use
1324
1324
use_existing_dir=False, directory=None, stacked_on=None,
1325
1325
stacked=False, strict=None, no_tree=False,
1326
1326
overwrite_tags=False):
1327
from bzrlib.push import _show_push_branch
1327
from breezy.push import _show_push_branch
1330
1330
overwrite = ["history", "tags"]
1440
1440
hardlink=False, stacked=False, standalone=False, no_tree=False,
1441
1441
use_existing_dir=False, switch=False, bind=False,
1442
1442
files_from=None):
1443
from bzrlib import switch as _mod_switch
1444
from bzrlib.tag import _merge_tags_if_possible
1443
from breezy import switch as _mod_switch
1444
from breezy.tag import _merge_tags_if_possible
1445
1445
if self.invoked_as in ['get', 'clone']:
1446
1446
ui.ui_factory.show_user_warning(
1447
1447
'deprecated_command',
1708
1708
If there are any uncommitted changes in the tree, they will be carried
1709
1709
across and remain as uncommitted changes after the update. To discard
1710
these changes, use 'bzr revert'. The uncommitted changes may conflict
1710
these changes, use 'brz revert'. The uncommitted changes may conflict
1711
1711
with the changes brought in by the change in basis revision.
1713
If the tree's branch is bound to a master branch, bzr will also update
1713
If the tree's branch is bound to a master branch, brz will also update
1714
1714
the branch from the master.
1716
1716
You cannot update just a single file or directory, because each Bazaar
1717
1717
working tree has just a single basis revision. If you want to restore a
1718
file that has been removed locally, use 'bzr revert' instead of 'bzr
1718
file that has been removed locally, use 'brz revert' instead of 'brz
1719
1719
update'. If you want to restore a file to its state in a previous
1720
revision, use 'bzr revert' with a '-r' option, or use 'bzr cat' to write
1720
revision, use 'brz revert' with a '-r' option, or use 'brz cat' to write
1721
1721
out the old content of that file to a new location.
1723
1723
The 'dir' argument, if given, must be the location of the root of a
1736
1736
def run(self, dir=None, revision=None, show_base=None):
1737
1737
if revision is not None and len(revision) != 1:
1738
raise errors.BzrCommandError(gettext(
1739
"bzr update --revision takes exactly one revision"))
1738
raise errors.brzCommandError(gettext(
1739
"brz update --revision takes exactly one revision"))
1740
1740
if dir is None:
1741
1741
tree = WorkingTree.open_containing('.')[0]
1792
1792
except errors.NoSuchRevision, e:
1793
1793
raise errors.BzrCommandError(gettext(
1794
1794
"branch has no revision %s\n"
1795
"bzr update --revision only works"
1795
"brz update --revision only works"
1796
1796
" for a revision in the branch history")
1797
1797
% (e.revision))
1798
1798
revno = tree.branch.revision_id_to_dotted_revno(
1826
1826
Display information on the format and related locations:
1830
1830
Display the above together with extended format information and
1831
1831
basic statistics (like the number of files in the working tree and
1832
1832
number of revisions in the branch and repository):
1836
1836
Display the above together with number of committers to the branch:
1840
1840
_see_also = ['revno', 'working-trees', 'repositories']
1841
1841
takes_args = ['location?']
1869
1869
'The file deletion mode to be used.',
1870
1870
title='Deletion Strategy', value_switches=True, enum_switch=False,
1871
1871
safe='Backup changed files (default).',
1872
keep='Delete from bzr but leave the working copy.',
1872
keep='Delete from brz but leave the working copy.',
1873
1873
no_backup='Don\'t backup changed files.'),
1875
1875
aliases = ['rm', 'del']
1954
1954
class cmd_reconcile(Command):
1955
__doc__ = """Reconcile bzr metadata in a branch.
1955
__doc__ = """Reconcile brz metadata in a branch.
1957
1957
This can correct data mismatches that may have been caused by
1958
previous ghost operations or bzr upgrades. You should only
1959
need to run this command if 'bzr check' or a bzr developer
1958
previous ghost operations or brz upgrades. You should only
1959
need to run this command if 'brz check' or a brz developer
1960
1960
advises you to run it.
1962
1962
If a second branch is provided, cross-branch reconciliation is
1963
1963
also attempted, which will check that data like the tree root
1964
id which was not present in very early bzr versions is represented
1964
id which was not present in very early brz versions is represented
1965
1965
correctly in both branches.
1967
1967
At the same time it is run it may recompress data resulting in
2046
2046
in the .bzr directory.
2048
2048
If there is already a branch at the location but it has no working tree,
2049
the tree can be populated with 'bzr checkout'.
2049
the tree can be populated with 'brz checkout'.
2051
2051
Recipe for importing a tree of files::
2057
bzr commit -m "imported project"
2057
brz commit -m "imported project"
2060
2060
_see_also = ['init-repository', 'branch', 'checkout']
2132
2132
raise errors.BzrCommandError(gettext('This branch format cannot be set'
2133
2133
' to append-revisions-only. Try --default.'))
2134
2134
if not is_quiet():
2135
from bzrlib.info import describe_layout, describe_format
2135
from breezy.info import describe_layout, describe_format
2137
2137
tree = a_bzrdir.open_workingtree(recommend_upgrade=False)
2138
2138
except (errors.NoWorkingTree, errors.NotLocalUrl):
2184
2184
takes_args = ["location"]
2185
2185
takes_options = [RegistryOption('format',
2186
2186
help='Specify a format for this repository. See'
2187
' "bzr help formats" for details.',
2188
lazy_registry=('bzrlib.controldir', 'format_registry'),
2187
' "brz help formats" for details.',
2188
lazy_registry=('breezy.controldir', 'format_registry'),
2189
2189
converter=lambda name: controldir.format_registry.make_bzrdir(name),
2190
2190
value_switches=True, title='Repository format'),
2191
2191
Option('no-trees',
2224
2224
the first argument, if any, or the current tree if no arguments are
2227
"bzr diff -p1" is equivalent to "bzr diff --prefix old/:new/", and
2227
"brz diff -p1" is equivalent to "brz diff --prefix old/:new/", and
2228
2228
produces patches suitable for "patch -p1".
2230
2230
Note that when using the -r argument with a range of revisions, the
2231
2231
differences are computed between the two specified revisions. That
2232
2232
is, the command does not show the changes introduced by the first
2233
2233
revision in the range. This differs from the interpretation of
2234
revision ranges used by "bzr log" which includes the first revision
2234
revision ranges used by "brz log" which includes the first revision
2244
2244
Shows the difference in the working tree versus the last commit::
2248
2248
Difference between the working tree and revision 1::
2252
2252
Difference between revision 3 and revision 1::
2256
2256
Difference between revision 3 and revision 1 for branch xxx::
2260
2260
The changes introduced by revision 2 (equivalent to -r1..2)::
2264
2264
To see the changes introduced by revision X::
2268
2268
Note that in the case of a merge, the -c option shows the changes
2269
2269
compared to the left hand parent. To see the changes against
2270
2270
another parent, use::
2272
bzr diff -r<chosen_parent>..X
2272
brz diff -r<chosen_parent>..X
2274
2274
The changes between the current revision and the previous revision
2275
2275
(equivalent to -c-1 and -r-2..-1)
2279
2279
Show just the differences for file NEWS::
2283
2283
Show the differences in working tree xxx for file NEWS::
2287
2287
Show the differences from branch xxx to this working tree:
2291
2291
Show the differences between two branches for file NEWS::
2293
bzr diff --old xxx --new yyy NEWS
2295
Same as 'bzr diff' but prefix paths with old/ and new/::
2297
bzr diff --prefix old/:new/
2293
brz diff --old xxx --new yyy NEWS
2295
Same as 'brz diff' but prefix paths with old/ and new/::
2297
brz diff --prefix old/:new/
2299
2299
Show the differences using a custom diff program with options::
2301
bzr diff --using /usr/bin/diff --diff-options -wu
2301
brz diff --using /usr/bin/diff --diff-options -wu
2303
2303
_see_also = ['status']
2304
2304
takes_args = ['file*']
2340
2340
def run(self, revision=None, file_list=None, diff_options=None,
2341
2341
prefix=None, old=None, new=None, using=None, format=None,
2343
from bzrlib.diff import (get_trees_and_branches_to_diff_locked,
2343
from breezy.diff import (get_trees_and_branches_to_diff_locked,
2344
2344
show_diff_trees)
2346
2346
if (prefix is None) or (prefix == '0'):
2492
2492
class cmd_log(Command):
2493
2493
__doc__ = """Show historical log for a branch or subset of a branch.
2495
log is bzr's default tool for exploring the history of a branch.
2495
log is brz's default tool for exploring the history of a branch.
2496
2496
The branch to use is taken from the first parameter. If no parameters
2497
2497
are given, the branch containing the working directory is logged.
2498
2498
Here are some simple examples::
2500
bzr log log the current branch
2501
bzr log foo.py log a file in its branch
2502
bzr log http://server/branch log a branch on a server
2500
brz log log the current branch
2501
brz log foo.py log a file in its branch
2502
brz log http://server/branch log a branch on a server
2504
2504
The filtering, ordering and information shown for each revision can
2505
2505
be controlled as explained below. By default, all revisions are
2513
2513
The log format controls how information about each revision is
2514
2514
displayed. The standard log formats are called ``long``, ``short``
2515
and ``line``. The default is long. See ``bzr help log-formats``
2515
and ``line``. The default is long. See ``brz help log-formats``
2516
2516
for more details on log formats.
2518
2518
The following options can be used to control what information is
2588
* ``bzr log guide.txt`` will log the file added in revision 1
2590
* ``bzr log tutorial.txt`` will log the new file added in revision 3
2592
* ``bzr log -r2 -p tutorial.txt`` will show the changes made to
2588
* ``brz log guide.txt`` will log the file added in revision 1
2590
* ``brz log tutorial.txt`` will log the new file added in revision 3
2592
* ``brz log -r2 -p tutorial.txt`` will show the changes made to
2593
2593
the original file in revision 2.
2595
* ``bzr log -r2 -p guide.txt`` will display an error message as there
2595
* ``brz log -r2 -p guide.txt`` will display an error message as there
2596
2596
was no file called guide.txt in revision 2.
2598
2598
Renames are always followed by log. By design, there is no need to
2612
2612
GUI tools and IDEs are often better at exploring history than command
2613
2613
line tools: you may prefer qlog or viz from qbzr or bzr-gtk, the
2614
bzr-explorer shell, or the Loggerhead web interface. See the Plugin
2615
Guide <http://doc.bazaar.canonical.com/plugins/en/> and
2614
bzr-explorer shell, or the Loggerhead web interface. See the Bazaar
2615
Plugin Guide <http://doc.bazaar.canonical.com/plugins/en/> and
2616
2616
<http://wiki.bazaar.canonical.com/IDEIntegration>.
2618
2618
You may find it useful to add the aliases below to ``bazaar.conf``::
2622
2622
top = log -l10 --line
2623
2623
show = log -v -p
2625
``bzr tip`` will then show the latest revision while ``bzr top``
2625
``brz tip`` will then show the latest revision while ``brz top``
2626
2626
will show the last 10 mainline revisions. To see the details of a
2627
particular revision X, ``bzr show -rX``.
2627
particular revision X, ``brz show -rX``.
2629
2629
If you are interested in looking deeper into a particular merge X,
2630
use ``bzr log -n0 -rX``.
2630
use ``brz log -n0 -rX``.
2632
``bzr log -v`` on a branch with lots of history is currently
2632
``brz log -v`` on a branch with lots of history is currently
2633
2633
very slow. A fix for this issue is currently under development.
2634
2634
With or without that fix, it is recommended that a revision range
2635
2635
be given when using the -v option.
2637
bzr has a generic full-text matching plugin, bzr-search, that can be
2637
brz has a generic full-text matching plugin, brz-search, that can be
2638
2638
used to find revisions matching user names, commit messages, etc.
2639
2639
Among other features, this plugin can find all revisions containing
2640
2640
a list of words but not others.
2663
2663
RegistryOption('authors',
2664
2664
'What names to list as authors - first, all or committer.',
2665
2665
title='Authors',
2666
lazy_registry=('bzrlib.log', 'author_list_registry'),
2666
lazy_registry=('breezy.log', 'author_list_registry'),
2668
2668
Option('levels',
2669
2669
short_name='n',
2912
2912
# show_log will use its revision_history. Having
2913
2913
# different branches will lead to weird behaviors.
2914
2914
raise errors.BzrCommandError(gettext(
2915
"bzr %s doesn't accept two revisions in different"
2915
"brz %s doesn't accept two revisions in different"
2916
2916
" branches.") % command_name)
2917
2917
if start_spec.spec is None:
2918
2918
# Avoid loading all the history.
3144
3144
Ignore the top level Makefile::
3146
bzr ignore ./Makefile
3146
brz ignore ./Makefile
3148
3148
Ignore .class files in all directories...::
3150
bzr ignore "*.class"
3150
brz ignore "*.class"
3152
3152
...but do not ignore "special.class"::
3154
bzr ignore "!special.class"
3154
brz ignore "!special.class"
3156
3156
Ignore files whose name begins with the "#" character::
3160
Ignore .o files under the lib directory::
3162
bzr ignore "lib/**/*.o"
3164
Ignore .o files under the lib directory::
3166
bzr ignore "RE:lib/.*\.o"
3160
Ignore .o files under the lib directory::
3162
brz ignore "lib/**/*.o"
3164
Ignore .o files under the lib directory::
3166
brz ignore "RE:lib/.*\.o"
3168
3168
Ignore everything but the "debian" toplevel directory::
3170
bzr ignore "RE:(?!debian/).*"
3170
brz ignore "RE:(?!debian/).*"
3172
3172
Ignore everything except the "local" toplevel directory,
3173
3173
but always ignore autosave files ending in ~, even under local/::
3176
bzr ignore "!./local"
3176
brz ignore "!./local"
3180
3180
_see_also = ['status', 'ignored', 'patterns']
3181
3181
takes_args = ['name_pattern*']
3182
3182
takes_options = ['directory',
3183
3183
Option('default-rules',
3184
help='Display the default ignore rules that bzr uses.')
3184
help='Display the default ignore rules that brz uses.')
3187
3187
def run(self, name_pattern_list=None, default_rules=None,
3188
3188
directory=u'.'):
3189
from bzrlib import ignores
3189
from breezy import ignores
3190
3190
if default_rules is not None:
3191
3191
# dump the default rules and exit
3192
3192
for pattern in ignores.USER_DEFAULTS:
3229
3229
self.outf.write(gettext("Warning: the following files are version "
3230
3230
"controlled and match your ignore pattern:\n%s"
3231
3231
"\nThese files will continue to be version controlled"
3232
" unless you 'bzr remove' them.\n") % ("\n".join(matches),))
3232
" unless you 'brz remove' them.\n") % ("\n".join(matches),))
3235
3235
class cmd_ignored(Command):
3330
3330
def run(self, dest, branch_or_subdir=None, revision=None, format=None,
3331
3331
root=None, filters=False, per_file_timestamps=False, uncommitted=False,
3332
3332
directory=u'.'):
3333
from bzrlib.export import export
3333
from breezy.export import export
3335
3335
if branch_or_subdir is None:
3336
3336
branch_or_subdir = directory
3378
3378
def run(self, filename, revision=None, name_from_revision=False,
3379
3379
filters=False, directory=None):
3380
3380
if revision is not None and len(revision) != 1:
3381
raise errors.BzrCommandError(gettext("bzr cat --revision takes exactly"
3381
raise errors.BzrCommandError(gettext("brz cat --revision takes exactly"
3382
3382
" one revision specifier"))
3383
3383
tree, branch, relpath = \
3384
3384
_open_directory_or_containing_tree_or_branch(filename, directory)
3418
3418
"{0!r} is not present in revision {1}").format(
3419
3419
filename, rev_tree.get_revision_id()))
3421
from bzrlib.filter_tree import ContentFilterTree
3421
from breezy.filter_tree import ContentFilterTree
3422
3422
filter_tree = ContentFilterTree(rev_tree,
3423
3423
rev_tree._content_filter_stack)
3424
3424
content = filter_tree.get_file_text(actual_file_id)
3479
3479
A common mistake is to forget to add a new file or directory before
3480
3480
running the commit command. The --strict option checks for unknown
3481
3481
files and aborts the commit if any are found. More advanced pre-commit
3482
checks can be implemented by defining hooks. See ``bzr help hooks``
3482
checks can be implemented by defining hooks. See ``brz help hooks``
3485
3485
:Things to note:
3487
3487
If you accidentially commit the wrong changes or make a spelling
3488
3488
mistake in the commit message say, you can use the uncommit command
3489
to undo it. See ``bzr help uncommit`` for details.
3489
to undo it. See ``brz help uncommit`` for details.
3491
3491
Hooks can also be configured to run after a commit. This allows you
3492
3492
to trigger updates to external systems like bug trackers. The --fixes
3493
3493
option can be used to record the association between a revision and
3494
one or more bugs. See ``bzr help bugs`` for details.
3494
one or more bugs. See ``brz help bugs`` for details.
3497
3497
_see_also = ['add', 'bugs', 'hooks', 'uncommit']
3517
3517
"format, e.g. '2009-10-10 08:00:00 +0100'."),
3518
3518
ListOption('fixes', type=str,
3519
3519
help="Mark a bug as being fixed by this revision "
3520
"(see \"bzr help bugs\")."),
3520
"(see \"brz help bugs\")."),
3521
3521
ListOption('author', type=unicode,
3522
3522
help="Set the author's name, if it's different "
3523
3523
"from the committer."),
3552
3552
"No tracker specified for bug %s. Use the form "
3553
3553
"'tracker:id' or specify a default bug tracker "
3554
3554
"using the `bugtracker` option.\nSee "
3555
"\"bzr help bugs\" for more information on this "
3555
"\"brz help bugs\" for more information on this "
3556
3556
"feature. Commit refused.") % fixed_bug)
3557
3557
tag = default_bugtracker
3558
3558
bug_id = tokens[0]
3559
3559
elif len(tokens) != 2:
3560
3560
raise errors.BzrCommandError(gettext(
3561
3561
"Invalid bug %s. Must be in the form of 'tracker:id'. "
3562
"See \"bzr help bugs\" for more information on this "
3562
"See \"brz help bugs\" for more information on this "
3563
3563
"feature.\nCommit refused.") % fixed_bug)
3565
3565
tag, bug_id = tokens
3576
3576
unchanged=False, strict=False, local=False, fixes=None,
3577
3577
author=None, show_diff=False, exclude=None, commit_time=None,
3579
from bzrlib.errors import (
3579
from breezy.errors import (
3580
3580
PointlessCommit,
3581
3581
ConflictsInTree,
3582
3582
StrictCommitFailed
3584
from bzrlib.msgeditor import (
3584
from breezy.msgeditor import (
3585
3585
edit_commit_message_encoded,
3586
3586
generate_commit_message_template,
3587
3587
make_commit_message_template_encoded,
3688
3688
except PointlessCommit:
3689
3689
raise errors.BzrCommandError(gettext("No changes to commit."
3690
" Please 'bzr add' the files you want to commit, or use"
3690
" Please 'brz add' the files you want to commit, or use"
3691
3691
" --unchanged to force an empty commit."))
3692
3692
except ConflictsInTree:
3693
3693
raise errors.BzrCommandError(gettext('Conflicts detected in working '
3694
'tree. Use "bzr conflicts" to list, "bzr resolve FILE" to'
3694
'tree. Use "brz conflicts" to list, "brz resolve FILE" to'
3696
3696
except StrictCommitFailed:
3697
3697
raise errors.BzrCommandError(gettext("Commit refused because there are"
3708
3708
__doc__ = """Validate working tree structure, branch consistency and repository history.
3710
3710
This command checks various invariants about branch and repository storage
3711
to detect data corruption or bzr bugs.
3711
to detect data corruption or brz bugs.
3713
3713
The working tree and branch checks will only give output if a problem is
3714
3714
detected. The output fields of the repository check are:
3811
3811
takes_args = ['url?']
3812
3812
takes_options = [
3813
3813
RegistryOption('format',
3814
help='Upgrade to a specific format. See "bzr help'
3814
help='Upgrade to a specific format. See "brz help'
3815
3815
' formats" for details.',
3816
lazy_registry=('bzrlib.controldir', 'format_registry'),
3816
lazy_registry=('breezy.controldir', 'format_registry'),
3817
3817
converter=lambda name: controldir.format_registry.make_bzrdir(name),
3818
3818
value_switches=True, title='Branch format'),
3819
3819
Option('clean',
3825
3825
def run(self, url='.', format=None, clean=False, dry_run=False):
3826
from bzrlib.upgrade import upgrade
3826
from breezy.upgrade import upgrade
3827
3827
exceptions = upgrade(url, format, clean_up=clean, dry_run=dry_run)
3829
3829
if len(exceptions) == 1:
3836
3836
class cmd_whoami(Command):
3837
__doc__ = """Show or set bzr user id.
3837
__doc__ = """Show or set brz user id.
3840
3840
Show the email of the current user::
3844
3844
Set the current user::
3846
bzr whoami "Frank Chu <fchu@example.com>"
3846
brz whoami "Frank Chu <fchu@example.com>"
3848
3848
takes_options = [ 'directory',
3849
3849
Option('email',
3965
3965
def remove_alias(self, alias_name):
3966
3966
if alias_name is None:
3967
3967
raise errors.BzrCommandError(gettext(
3968
'bzr alias --remove expects an alias to remove.'))
3968
'brz alias --remove expects an alias to remove.'))
3969
3969
# If alias is not found, print something like:
3970
3970
# unalias: foo: not found
3971
3971
c = _mod_config.GlobalConfig()
3976
3976
"""Print out the defined aliases in a similar format to bash."""
3977
3977
aliases = _mod_config.GlobalConfig().get_aliases()
3978
3978
for key, value in sorted(aliases.iteritems()):
3979
self.outf.write('bzr alias %s="%s"\n' % (key, value))
3979
self.outf.write('brz alias %s="%s"\n' % (key, value))
3981
3981
@display_command
3982
3982
def print_alias(self, alias_name):
3983
from bzrlib.commands import get_alias
3983
from breezy.commands import get_alias
3984
3984
alias = get_alias(alias_name)
3985
3985
if alias is None:
3986
self.outf.write("bzr alias: %s: not found\n" % alias_name)
3986
self.outf.write("brz alias: %s: not found\n" % alias_name)
3988
3988
self.outf.write(
3989
'bzr alias %s="%s"\n' % (alias_name, ' '.join(alias)))
3989
'brz alias %s="%s"\n' % (alias_name, ' '.join(alias)))
3991
3991
def set_alias(self, alias_name, alias_command):
3992
3992
"""Save the alias in the global config."""
4028
4028
Tests that need working space on disk use a common temporary directory,
4029
4029
typically inside $TMPDIR or /tmp.
4031
If you set BZR_TEST_PDB=1 when running selftest, failing tests will drop
4031
If you set BRZ_TEST_PDB=1 when running selftest, failing tests will drop
4032
4032
into a pdb postmortem session.
4034
4034
The --coverage=DIRNAME global option produces a report with covered code
4038
4038
Run only tests relating to 'ignore'::
4042
4042
Disable plugins and list tests as they're run::
4044
bzr --no-plugins selftest -v
4044
brz --no-plugins selftest -v
4046
4046
# NB: this is used from the class without creating an instance, which is
4047
4047
# why it does not have a self parameter.
4048
4048
def get_transport_type(typestring):
4049
4049
"""Parse and return a transport specifier."""
4050
4050
if typestring == "sftp":
4051
from bzrlib.tests import stub_sftp
4051
from breezy.tests import stub_sftp
4052
4052
return stub_sftp.SFTPAbsoluteServer
4053
4053
elif typestring == "memory":
4054
from bzrlib.tests import test_server
4054
from breezy.tests import test_server
4055
4055
return memory.MemoryServer
4056
4056
elif typestring == "fakenfs":
4057
from bzrlib.tests import test_server
4057
from breezy.tests import test_server
4058
4058
return test_server.FakeNFSServer
4059
4059
msg = "No known transport type %s. Supported types are: sftp\n" %\
4087
4087
help='List the tests instead of running them.'),
4088
4088
RegistryOption('parallel',
4089
4089
help="Run the test suite in parallel.",
4090
lazy_registry=('bzrlib.tests', 'parallel_registry'),
4090
lazy_registry=('breezy.tests', 'parallel_registry'),
4091
4091
value_switches=False,
4093
4093
Option('randomize', type=str, argname="SEED",
4266
4266
The source of the merge can be specified either in the form of a branch,
4267
4267
or in the form of a path to a file containing a merge directive generated
4268
with bzr send. If neither is specified, the default is the upstream branch
4268
with brz send. If neither is specified, the default is the upstream branch
4269
4269
or the branch most recently merged using --remember. The source of the
4270
4270
merge may also be specified in the form of a path to a file in another
4271
4271
branch: in this case, only the modifications to that file are merged into
4272
4272
the current working tree.
4274
When merging from a branch, by default bzr will try to merge in all new
4274
When merging from a branch, by default brz will try to merge in all new
4275
4275
work from the other branch, automatically determining an appropriate base
4276
4276
revision. If this fails, you may need to give an explicit base.
4278
To pick a different ending revision, pass "--revision OTHER". bzr will
4278
To pick a different ending revision, pass "--revision OTHER". brz will
4279
4279
try to merge in all new work up to and including revision OTHER.
4281
4281
If you specify two values, "--revision BASE..OTHER", only revisions BASE
4293
4293
it will mark a conflict. A conflict means that you need to fix something,
4294
4294
before you can commit.
4296
Use bzr resolve when you have fixed a problem. See also bzr conflicts.
4296
Use brz resolve when you have fixed a problem. See also brz conflicts.
4298
4298
If there is no default branch set, the first merge will set it (use
4299
4299
--no-remember to avoid setting it). After that, you can omit the branch
4301
4301
only be saved if the remote location can be accessed.
4303
4303
The results of the merge are placed into the destination working
4304
directory, where they can be reviewed (with bzr diff), tested, and then
4304
directory, where they can be reviewed (with brz diff), tested, and then
4305
4305
committed to record the result of the merge.
4307
4307
merge refuses to run if there are any uncommitted changes, unless
4318
4318
you to apply each diff hunk and file change, similar to "shelve".
4321
To merge all new revisions from bzr.dev::
4323
bzr merge ../bzr.dev
4325
To merge changes up to and including revision 82 from bzr.dev::
4327
bzr merge -r 82 ../bzr.dev
4321
To merge all new revisions from brz.dev::
4323
brz merge ../brz.dev
4325
To merge changes up to and including revision 82 from brz.dev::
4327
brz merge -r 82 ../brz.dev
4329
4329
To merge the changes introduced by 82, without previous changes::
4331
bzr merge -r 81..82 ../bzr.dev
4331
brz merge -r 81..82 ../brz.dev
4333
4333
To apply a merge directive contained in /tmp/merge::
4335
bzr merge /tmp/merge
4335
brz merge /tmp/merge
4337
4337
To create a merge revision with three parents from two branches
4338
4338
feature1a and feature1b:
4340
bzr merge ../feature1a
4341
bzr merge ../feature1b --force
4342
bzr commit -m 'revision with three parents'
4340
brz merge ../feature1a
4341
brz merge ../feature1b --force
4342
brz commit -m 'revision with three parents'
4345
4345
encoding_type = 'exact'
4478
4478
return result_tree
4480
4480
def _do_preview(self, merger):
4481
from bzrlib.diff import show_diff_trees
4481
from breezy.diff import show_diff_trees
4482
4482
result_tree = self._get_preview(merger)
4483
4483
path_encoding = osutils.get_diff_header_encoding()
4484
4484
show_diff_trees(merger.this_tree, result_tree, self.outf,
4504
4504
Shelver to selectively remove the differences between the working tree
4505
4505
and the preview tree.
4507
from bzrlib import shelf_ui
4507
from breezy import shelf_ui
4508
4508
result_tree = self._get_preview(merger)
4509
writer = bzrlib.option.diff_writer_registry.get()
4509
writer = breezy.option.diff_writer_registry.get()
4510
4510
shelver = shelf_ui.Shelver(merger.this_tree, result_tree, destroy=True,
4511
4511
reporter=shelf_ui.ApplyReporter(),
4512
4512
diff_writer=writer(sys.stdout))
4537
4537
def _get_merger_from_branch(self, tree, location, revision, remember,
4538
4538
possible_transports, pb):
4539
4539
"""Produce a merger from a location, assuming it refers to a branch."""
4540
from bzrlib.tag import _merge_tags_if_possible
4540
from breezy.tag import _merge_tags_if_possible
4541
4541
# find the branch locations
4542
4542
other_loc, user_location = self._select_branch_location(tree, location,
4664
4664
Re-do the merge of all conflicted files, and show the base text in
4665
4665
conflict regions, in addition to the usual THIS and OTHER texts::
4667
bzr remerge --show-base
4667
brz remerge --show-base
4669
4669
Re-do the merge of "foobar", using the weave merge algorithm, with
4670
4670
additional processing to reduce the size of conflict regions::
4672
bzr remerge --merge-type weave --reprocess foobar
4672
brz remerge --merge-type weave --reprocess foobar
4674
4674
takes_args = ['file*']
4675
4675
takes_options = [
4682
4682
def run(self, file_list=None, merge_type=None, show_base=False,
4683
4683
reprocess=False):
4684
from bzrlib.conflicts import restore
4684
from breezy.conflicts import restore
4685
4685
if merge_type is None:
4686
4686
merge_type = _mod_merge.Merge3Merger
4687
4687
tree, file_list = WorkingTree.open_containing_paths(file_list)
4782
4782
not yet committed. These revisions will be included as additional parents
4783
4783
of the next commit. Normally, using revert clears that list as well as
4784
4784
reverting the files. If any files are specified, revert leaves the list
4785
of uncommitted merges alone and reverts only the files. Use ``bzr revert
4785
of uncommitted merges alone and reverts only the files. Use ``brz revert
4786
4786
.`` in the tree root to revert all files but keep the recorded merges,
4787
and ``bzr revert --forget-merges`` to clear the pending merge list without
4787
and ``brz revert --forget-merges`` to clear the pending merge list without
4788
4788
reverting any files.
4790
Using "bzr revert --forget-merges", it is possible to apply all of the
4790
Using "brz revert --forget-merges", it is possible to apply all of the
4791
4791
changes from a branch in a single revision. To do this, perform the merge
4792
4792
as desired. Then doing revert with the "--forget-merges" option will keep
4793
4793
the content of the tree as it was, but it will clear the list of pending
4847
4847
@display_command
4848
4848
def run(self, topic=None, long=False):
4850
4850
if topic is None and long:
4851
4851
topic = "commands"
4852
bzrlib.help.help(topic)
4852
breezy.help.help(topic)
4855
4855
class cmd_shell_complete(Command):
4856
4856
__doc__ = """Show appropriate completions for context.
4858
For a list of all available commands, say 'bzr shell-complete'.
4858
For a list of all available commands, say 'brz shell-complete'.
4860
4860
takes_args = ['context?']
4861
4861
aliases = ['s-c']
4885
4885
Determine the missing revisions between this and the branch at the
4886
4886
remembered pull location::
4890
4890
Determine the missing revisions between this and another branch::
4892
bzr missing http://server/branch
4892
brz missing http://server/branch
4894
4894
Determine the missing revisions up to a specific revision on the other
4897
bzr missing -r ..-10
4897
brz missing -r ..-10
4899
4899
Determine the missing revisions up to a specific revision on this
4902
bzr missing --my-revision ..-10
4902
brz missing --my-revision ..-10
4905
4905
_see_also = ['merge', 'pull']
5234
5234
return self._run(b, revision_id_list, revision)
5236
5236
def _run(self, b, revision_id_list, revision):
5237
import bzrlib.gpg as gpg
5237
import breezy.gpg as gpg
5238
5238
gpg_strategy = gpg.GPGStrategy(b.get_config_stack())
5239
5239
if revision_id_list is not None:
5240
5240
b.repository.start_write_group()
5398
5398
def _run(self, b, tree, dry_run, verbose, revision, force, local,
5400
from bzrlib.log import log_formatter, show_log
5401
from bzrlib.uncommit import uncommit
5400
from breezy.log import log_formatter, show_log
5401
from breezy.uncommit import uncommit
5403
5403
last_revno, last_rev_id = b.last_revision_info()
5407
5407
revno = last_revno
5408
5408
rev_id = last_rev_id
5410
# 'bzr uncommit -r 10' actually means uncommit
5410
# 'brz uncommit -r 10' actually means uncommit
5411
5411
# so that the final tree is at revno 10.
5412
# but bzrlib.uncommit.uncommit() actually uncommits
5412
# but breezy.uncommit.uncommit() actually uncommits
5413
5413
# the revisions that are supplied.
5414
5414
# So we need to offset it by one
5415
5415
revno = revision[0].in_history(b).revno + 1
5450
5450
uncommit(b, tree=tree, dry_run=dry_run, verbose=verbose,
5451
5451
revno=revno, local=local, keep_tags=keep_tags)
5452
5452
self.outf.write(gettext('You can restore the old tip by running:\n'
5453
' bzr pull . -r revid:%s\n') % last_rev_id)
5453
' brz pull . -r revid:%s\n') % last_rev_id)
5456
5456
class cmd_break_lock(Command):
5462
5462
CAUTION: Locks should only be broken when you are sure that the process
5463
5463
holding the lock has been stopped.
5465
You can get information on what locks are open via the 'bzr info
5465
You can get information on what locks are open via the 'brz info
5466
5466
[location]' command.
5470
bzr break-lock bzr+ssh://example.com/bzr/foo
5471
bzr break-lock --conf ~/.bazaar
5470
brz break-lock brz+ssh://example.com/brz/foo
5471
brz break-lock --conf ~/.bazaar
5474
5474
takes_args = ['location?']
5521
5521
help='Serve on stdin/out for use from inetd or sshd.'),
5522
5522
RegistryOption('protocol',
5523
5523
help="Protocol to serve.",
5524
lazy_registry=('bzrlib.transport', 'transport_server_registry'),
5524
lazy_registry=('breezy.transport', 'transport_server_registry'),
5525
5525
value_switches=True),
5526
5526
Option('listen',
5527
5527
help='Listen for connections on nominated address.', type=str),
5535
5535
Option('allow-writes',
5536
5536
help='By default the server is a readonly server. Supplying '
5537
5537
'--allow-writes enables write access to the contents of '
5538
'the served directory and below. Note that ``bzr serve`` '
5538
'the served directory and below. Note that ``brz serve`` '
5539
5539
'does not perform authentication, so unless some form of '
5540
5540
'external authentication is arranged supplying this '
5541
5541
'option leads to global uncontrolled write access to your '
5548
5548
def run(self, listen=None, port=None, inet=False, directory=None,
5549
5549
allow_writes=False, protocol=None, client_timeout=None):
5550
from bzrlib import transport
5550
from breezy import transport
5551
5551
if directory is None:
5552
5552
directory = os.getcwd()
5553
5553
if protocol is None:
5565
5565
This command requires the target tree to be in a rich-root format.
5567
5567
The TREE argument should be an independent tree, inside another tree, but
5568
not part of it. (Such trees can be produced by "bzr split", but also by
5569
running "bzr branch" with the target inside a tree.)
5568
not part of it. (Such trees can be produced by "brz split", but also by
5569
running "brz branch" with the target inside a tree.)
5571
5571
The result is a combined tree, with the subtree no longer an independent
5572
5572
part. This is marked as a merge of the subtree into the containing tree,
5676
5676
def run(self, submit_branch=None, public_branch=None, patch_type='bundle',
5677
5677
sign=False, revision=None, mail_to=None, message=None,
5678
5678
directory=u'.'):
5679
from bzrlib.revision import ensure_null, NULL_REVISION
5679
from breezy.revision import ensure_null, NULL_REVISION
5680
5680
include_patch, include_bundle = {
5681
5681
'plain': (False, False),
5682
5682
'diff': (True, False),
5746
5746
directly from the merge directive, without retrieving data from a
5749
`bzr send` creates a compact data set that, when applied using bzr
5749
`brz send` creates a compact data set that, when applied using brz
5750
5750
merge, has the same effect as merging from the source branch.
5752
5752
By default the merge directive is self-contained and can be applied to any
5771
5771
omit the location to use the default. To change the default, use
5772
5772
--remember. The value will only be saved if the location can be accessed.
5774
In order to calculate those changes, bzr must analyse the submit branch.
5774
In order to calculate those changes, brz must analyse the submit branch.
5775
5775
Therefore it is most efficient for the submit branch to be a local mirror.
5776
5776
If a public location is known for the submit_branch, that location is used
5777
5777
in the merge directive.
5801
5801
default. "0.9" uses revision bundle format 0.9 and merge directive
5802
5802
format 1. It is compatible with Bazaar 0.12 - 0.18.
5804
The merge directives created by bzr send may be applied using bzr merge or
5805
bzr pull by specifying a file containing a merge directive as the location.
5804
The merge directives created by brz send may be applied using brz merge or
5805
brz pull by specifying a file containing a merge directive as the location.
5807
bzr send makes extensive use of public locations to map local locations into
5808
URLs that can be used by other people. See `bzr help configuration` to
5809
set them, and use `bzr info` to display them.
5807
brz send makes extensive use of public locations to map local locations into
5808
URLs that can be used by other people. See `brz help configuration` to
5809
set them, and use `brz info` to display them.
5812
5812
encoding_type = 'exact'
5841
5841
Option('body', help='Body for the email.', type=unicode),
5842
5842
RegistryOption('format',
5843
5843
help='Use the specified output format.',
5844
lazy_registry=('bzrlib.send', 'format_registry')),
5844
lazy_registry=('breezy.send', 'format_registry')),
5847
5847
def run(self, submit_branch=None, public_branch=None, no_bundle=False,
5848
5848
no_patch=False, revision=None, remember=None, output=None,
5849
5849
format=None, mail_to=None, message=None, body=None,
5850
5850
strict=None, **kwargs):
5851
from bzrlib.send import send
5851
from breezy.send import send
5852
5852
return send(submit_branch, revision, public_branch, remember,
5853
5853
format, no_bundle, no_patch, output,
5854
5854
kwargs.get('from', '.'), mail_to, message, body,
5922
5922
format=None, strict=None, **kwargs):
5923
5923
if output is None:
5925
from bzrlib.send import send
5925
from breezy.send import send
5926
5926
return send(submit_branch, revision, public_branch, remember,
5927
5927
format, no_bundle, no_patch, output,
5928
5928
kwargs.get('from', '.'), None, None, None,
5942
5942
It is an error to give a tag name that already exists unless you pass
5943
5943
--force, in which case the tag is moved to point to the new revision.
5945
To rename a tag (change the name but keep it on the same revsion), run ``bzr
5946
tag new-name -r tag:old-name`` and then ``bzr tag --delete oldname``.
5945
To rename a tag (change the name but keep it on the same revsion), run ``brz
5946
tag new-name -r tag:old-name`` and then ``brz tag --delete oldname``.
5948
5948
If no tag name is specified it will be determined through the
5949
5949
'automatic_tag_name' hook. This can e.g. be used to automatically tag
5950
upstream releases by reading configure.ac. See ``bzr help hooks`` for
5950
upstream releases by reading configure.ac. See ``brz help hooks`` for
6029
6029
@display_command
6030
6030
def run(self, directory='.', sort=None, show_ids=False, revision=None):
6031
from bzrlib.tag import tag_sort_methods
6031
from breezy.tag import tag_sort_methods
6032
6032
branch, relpath = Branch.open_containing(directory)
6034
6034
tags = branch.tags.get_tag_dict().items()
6240
6240
def run(self, to_location=None, force=False, create_branch=False,
6241
6241
revision=None, directory=u'.', store=False):
6242
from bzrlib import switch
6242
from breezy import switch
6243
6243
tree_location = directory
6244
6244
revision = _get_one_revision('switch', revision)
6245
6245
possible_transports = []
6309
6309
To define the current view::
6311
bzr view file1 dir1 ...
6311
brz view file1 dir1 ...
6313
6313
To list the current view::
6317
6317
To delete the current view::
6321
6321
To disable the current view without deleting it::
6323
bzr view --switch off
6323
brz view --switch off
6325
6325
To define a named view and switch to it::
6327
bzr view --name view-name file1 dir1 ...
6327
brz view --name view-name file1 dir1 ...
6329
6329
To list a named view::
6331
bzr view --name view-name
6331
brz view --name view-name
6333
6333
To delete a named view::
6335
bzr view --name view-name --delete
6335
brz view --name view-name --delete
6337
6337
To switch to a named view::
6339
bzr view --switch view-name
6339
brz view --switch view-name
6341
6341
To list all views defined::
6345
6345
To delete all views::
6347
bzr view --delete --all
6347
brz view --delete --all
6540
6540
Option('all', help='Shelve all changes.'),
6542
6542
RegistryOption('writer', 'Method to use for writing diffs.',
6543
bzrlib.option.diff_writer_registry,
6543
breezy.option.diff_writer_registry,
6544
6544
value_switches=True, enum_switch=False),
6546
6546
Option('list', help='List shelved changes.'),
6553
6553
writer=None, list=False, destroy=False, directory=None):
6555
6555
return self.run_for_list(directory=directory)
6556
from bzrlib.shelf_ui import Shelver
6556
from breezy.shelf_ui import Shelver
6557
6557
if writer is None:
6558
writer = bzrlib.option.diff_writer_registry.get()
6558
writer = breezy.option.diff_writer_registry.get()
6560
6560
shelver = Shelver.from_args(writer(sys.stdout), revision, all,
6561
6561
file_list, message, destroy=destroy, directory=directory)
6637
6637
Option('detritus', help='Delete conflict files, merge and revert'
6638
6638
' backups, and failed selftest dirs.'),
6639
6639
Option('unknown',
6640
help='Delete files unknown to bzr (default).'),
6640
help='Delete files unknown to brz (default).'),
6641
6641
Option('dry-run', help='Show files to delete instead of'
6642
6642
' deleting them.'),
6643
6643
Option('force', help='Do not prompt before deleting.')]
6644
6644
def run(self, unknown=False, ignored=False, detritus=False, dry_run=False,
6645
6645
force=False, directory=u'.'):
6646
from bzrlib.clean_tree import clean_tree
6646
from breezy.clean_tree import clean_tree
6647
6647
if not (unknown or ignored or detritus):
6721
6721
# register lazy builtins from other modules; called at startup and should
6722
6722
# be only called once.
6723
6723
for (name, aliases, module_name) in [
6724
('cmd_bundle_info', [], 'bzrlib.bundle.commands'),
6725
('cmd_config', [], 'bzrlib.config'),
6726
('cmd_dpush', [], 'bzrlib.foreign'),
6727
('cmd_version_info', [], 'bzrlib.cmd_version_info'),
6728
('cmd_resolve', ['resolved'], 'bzrlib.conflicts'),
6729
('cmd_conflicts', [], 'bzrlib.conflicts'),
6730
('cmd_ping', [], 'bzrlib.smart.ping'),
6731
('cmd_sign_my_commits', [], 'bzrlib.commit_signature_commands'),
6732
('cmd_verify_signatures', [], 'bzrlib.commit_signature_commands'),
6733
('cmd_test_script', [], 'bzrlib.cmd_test_script'),
6724
('cmd_bundle_info', [], 'breezy.bundle.commands'),
6725
('cmd_config', [], 'breezy.config'),
6726
('cmd_dpush', [], 'breezy.foreign'),
6727
('cmd_version_info', [], 'breezy.cmd_version_info'),
6728
('cmd_resolve', ['resolved'], 'breezy.conflicts'),
6729
('cmd_conflicts', [], 'breezy.conflicts'),
6730
('cmd_ping', [], 'breezy.smart.ping'),
6731
('cmd_sign_my_commits', [], 'breezy.commit_signature_commands'),
6732
('cmd_verify_signatures', [], 'breezy.commit_signature_commands'),
6733
('cmd_test_script', [], 'breezy.cmd_test_script'),
6735
6735
builtin_command_registry.register_lazy(name, aliases, module_name)