258
260
Not versioned and not matching an ignore pattern.
262
Additionally for directories, symlinks and files with an executable
263
bit, Bazaar indicates their type using a trailing character: '/', '@'
260
266
To see ignored files use 'bzr ignored'. For details on the
261
267
changes to file texts, use 'bzr diff'.
431
437
for node in bt.iter_all_entries():
432
438
# Node is made up of:
433
439
# (index, key, value, [references])
434
self.outf.write('%s\n' % (node[1:],))
440
refs_as_tuples = static_tuple.as_tuples(node[3])
441
as_tuple = (tuple(node[1]), node[2], refs_as_tuples)
442
self.outf.write('%s\n' % (as_tuple,))
437
445
class cmd_remove_tree(Command):
461
469
raise errors.BzrCommandError("You cannot remove the working tree"
462
470
" of a remote path")
464
# XXX: What about pending merges ? -- vila 20090629
465
if working.has_changes(working.basis_tree()):
472
if (working.has_changes()):
466
473
raise errors.UncommittedChanges(working)
468
475
working_path = working.bzrdir.root_transport.base
654
661
base_tree.lock_read()
656
file_list = self._maybe_expand_globs(file_list)
657
663
tree, file_list = tree_files_for_add(file_list)
658
664
added, ignored = tree.smart_add(file_list, not
659
665
no_recurse, action=action, save=not dry_run)
848
854
# All entries reference existing inventory items, so fix them up
849
855
# for cicp file-systems.
850
856
rel_names = tree.get_canonical_inventory_paths(rel_names)
851
for pair in tree.move(rel_names[:-1], rel_names[-1], after=after):
852
self.outf.write("%s => %s\n" % pair)
857
for src, dest in tree.move(rel_names[:-1], rel_names[-1], after=after):
859
self.outf.write("%s => %s\n" % (src, dest))
854
861
if len(names_list) != 2:
855
862
raise errors.BzrCommandError('to mv multiple files the'
899
906
dest = osutils.pathjoin(dest_parent, dest_tail)
900
907
mutter("attempting to move %s => %s", src, dest)
901
908
tree.rename_one(src, dest, after=after)
902
self.outf.write("%s => %s\n" % (src, dest))
910
self.outf.write("%s => %s\n" % (src, dest))
905
913
class cmd_pull(Command):
906
914
"""Turn this branch into a mirror of another branch.
908
This command only works on branches that have not diverged. Branches are
909
considered diverged if the destination branch's most recent commit is one
910
that has not been merged (directly or indirectly) into the parent.
916
By default, this command only works on branches that have not diverged.
917
Branches are considered diverged if the destination branch's most recent
918
commit is one that has not been merged (directly or indirectly) into the
912
921
If branches have diverged, you can use 'bzr merge' to integrate the changes
913
922
from one into the other. Once one branch has merged, the other should
914
923
be able to pull it again.
916
If you want to forget your local changes and just update your branch to
917
match the remote one, use pull --overwrite.
925
If you want to replace your local changes and just want your branch to
926
match the remote one, use pull --overwrite. This will work even if the two
927
branches have diverged.
919
929
If there is no default location set, the first pull will set it. After
920
930
that, you can omit the location to use the default. To change the
1110
1120
revision_id = None
1111
1121
if strict and tree is not None and revision_id is None:
1112
if (tree.has_changes(tree.basis_tree())
1113
or len(tree.get_parent_ids()) > 1):
1122
if (tree.has_changes()):
1114
1123
raise errors.UncommittedChanges(
1115
1124
tree, more='Use --no-strict to force the push.')
1116
1125
if tree.last_revision() != tree.branch.last_revision():
1200
1209
from bzrlib.tag import _merge_tags_if_possible
1201
1210
accelerator_tree, br_from = bzrdir.BzrDir.open_tree_or_branch(
1203
if (accelerator_tree is not None and
1204
accelerator_tree.supports_content_filtering()):
1205
accelerator_tree = None
1206
1212
revision = _get_one_revision('branch', revision)
1207
1213
br_from.lock_read()
1750
1756
class cmd_init_repository(Command):
1751
"""Create a shared repository to hold branches.
1757
"""Create a shared repository for branches to share storage space.
1753
1759
New branches created under the repository directory will store their
1754
revisions in the repository, not in the branch directory.
1760
revisions in the repository, not in the branch directory. For branches
1761
with shared history, this reduces the amount of storage needed and
1762
speeds up the creation of new branches.
1756
If the --no-trees option is used then the branches in the repository
1757
will not have working trees by default.
1764
If the --no-trees option is given then the branches in the repository
1765
will not have working trees by default. They will still exist as
1766
directories on disk, but they will not have separate copies of the
1767
files at a certain revision. This can be useful for repositories that
1768
store branches which are interacted with through checkouts or remote
1769
branches, such as on a server.
1760
Create a shared repositories holding just branches::
1772
Create a shared repository holding just branches::
1762
1774
bzr init-repo --no-trees repo
1763
1775
bzr init repo/trunk
1832
Difference between revision 2 and revision 1::
1836
Difference between revision 2 and revision 1 for branch xxx::
1844
Difference between revision 3 and revision 1::
1848
Difference between revision 3 and revision 1 for branch xxx::
1852
To see the changes introduced in revision X::
1856
Note that in the case of a merge, the -c option shows the changes
1857
compared to the left hand parent. To see the changes against
1858
another parent, use::
1860
bzr diff -r<chosen_parent>..X
1862
The changes introduced by revision 2 (equivalent to -r1..2)::
1840
1866
Show just the differences for file NEWS::
1887
1913
@display_command
1888
1914
def run(self, revision=None, file_list=None, diff_options=None,
1889
1915
prefix=None, old=None, new=None, using=None):
1890
from bzrlib.diff import _get_trees_to_diff, show_diff_trees
1916
from bzrlib.diff import get_trees_and_branches_to_diff, show_diff_trees
1892
1918
if (prefix is None) or (prefix == '0'):
1893
1919
# diff -p0 format
1907
1933
raise errors.BzrCommandError('bzr diff --revision takes exactly'
1908
1934
' one or two revision specifiers')
1910
old_tree, new_tree, specific_files, extra_trees = \
1911
_get_trees_to_diff(file_list, revision, old, new,
1936
(old_tree, new_tree,
1937
old_branch, new_branch,
1938
specific_files, extra_trees) = get_trees_and_branches_to_diff(
1939
file_list, revision, old, new, apply_view=True)
1913
1940
return show_diff_trees(old_tree, new_tree, sys.stdout,
1914
1941
specific_files=specific_files,
1915
1942
external_diff_options=diff_options,
2322
2349
# Build the log formatter
2323
2350
if log_format is None:
2324
2351
log_format = log.log_formatter_registry.get_default(b)
2352
# Make a non-encoding output to include the diffs - bug 328007
2353
unencoded_output = ui.ui_factory.make_output_stream(encoding_type='exact')
2325
2354
lf = log_format(show_ids=show_ids, to_file=self.outf,
2355
to_exact_file=unencoded_output,
2326
2356
show_timezone=timezone,
2327
2357
delta_format=get_verbosity_level(),
2574
2604
See ``bzr help patterns`` for details on the syntax of patterns.
2606
If a .bzrignore file does not exist, the ignore command
2607
will create one and add the specified files or patterns to the newly
2608
created file. The ignore command will also automatically add the
2609
.bzrignore file to be versioned. Creating a .bzrignore file without
2610
the use of the ignore command will require an explicit add command.
2576
2612
To remove patterns from the ignore list, edit the .bzrignore file.
2577
2613
After adding, editing or deleting that file either indirectly by
2578
2614
using this command or directly by using an editor, be sure to commit
2946
2982
Option('strict',
2947
2983
help="Refuse to commit if there are unknown "
2948
2984
"files in the working tree."),
2985
Option('commit-time', type=str,
2986
help="Manually set a commit time using commit date "
2987
"format, e.g. '2009-10-10 08:00:00 +0100'."),
2949
2988
ListOption('fixes', type=str,
2950
2989
help="Mark a bug as being fixed by this revision "
2951
2990
"(see \"bzr help bugs\")."),
2958
2997
"the master branch until a normal commit "
2959
2998
"is performed."
2962
help='When no message is supplied, show the diff along'
2963
' with the status summary in the message editor.'),
3001
help='When no message is supplied, show the diff along'
3002
' with the status summary in the message editor.'),
2965
3004
aliases = ['ci', 'checkin']
2986
3025
def run(self, message=None, file=None, verbose=False, selected_list=None,
2987
3026
unchanged=False, strict=False, local=False, fixes=None,
2988
author=None, show_diff=False, exclude=None):
3027
author=None, show_diff=False, exclude=None, commit_time=None):
2989
3028
from bzrlib.errors import (
2990
3029
PointlessCommit,
2991
3030
ConflictsInTree,
2997
3036
make_commit_message_template_encoded
3039
commit_stamp = offset = None
3040
if commit_time is not None:
3042
commit_stamp, offset = timestamp.parse_patch_date(commit_time)
3043
except ValueError, e:
3044
raise errors.BzrCommandError(
3045
"Could not parse --commit-time: " + str(e))
3000
3047
# TODO: Need a blackbox test for invoking the external editor; may be
3001
3048
# slightly problematic to run this cross-platform.
3022
3069
if local and not tree.branch.get_bound_location():
3023
3070
raise errors.LocalRequiresBoundBranch()
3072
if message is not None:
3074
file_exists = osutils.lexists(message)
3075
except UnicodeError:
3076
# The commit message contains unicode characters that can't be
3077
# represented in the filesystem encoding, so that can't be a
3082
'The commit message is a file name: "%(f)s".\n'
3083
'(use --file "%(f)s" to take commit message from that file)'
3085
ui.ui_factory.show_warning(warning_msg)
3025
3087
def get_message(commit_obj):
3026
3088
"""Callback to get commit message"""
3027
3089
my_message = message
3090
if my_message is not None and '\r' in my_message:
3091
my_message = my_message.replace('\r\n', '\n')
3092
my_message = my_message.replace('\r', '\n')
3028
3093
if my_message is None and not file:
3029
3094
t = make_commit_message_template_encoded(tree,
3030
3095
selected_list, diff=show_diff,
3054
3119
specific_files=selected_list,
3055
3120
allow_pointless=unchanged, strict=strict, local=local,
3056
3121
reporter=None, verbose=verbose, revprops=properties,
3122
authors=author, timestamp=commit_stamp,
3058
3124
exclude=safe_relpath_files(tree, exclude))
3059
3125
except PointlessCommit:
3060
3126
# FIXME: This should really happen before the file is read in;
3347
3413
Tests that need working space on disk use a common temporary directory,
3348
3414
typically inside $TMPDIR or /tmp.
3416
If you set BZR_TEST_PDB=1 when running selftest, failing tests will drop
3417
into a pdb postmortem session.
3351
3420
Run only tests relating to 'ignore'::
3389
3458
Option('lsprof-timed',
3390
3459
help='Generate lsprof output for benchmarked'
3391
3460
' sections of code.'),
3461
Option('lsprof-tests',
3462
help='Generate lsprof output for each test.'),
3392
3463
Option('cache-dir', type=str,
3393
3464
help='Cache intermediate benchmark output in this '
3435
3506
first=False, list_only=False,
3436
3507
randomize=None, exclude=None, strict=False,
3437
3508
load_list=None, debugflag=None, starting_with=None, subunit=False,
3509
parallel=None, lsprof_tests=False):
3439
3510
from bzrlib.tests import selftest
3440
3511
import bzrlib.benchmarks as benchmarks
3441
3512
from bzrlib.benchmarks import tree_creator
3475
3546
"transport": transport,
3476
3547
"test_suite_factory": test_suite_factory,
3477
3548
"lsprof_timed": lsprof_timed,
3549
"lsprof_tests": lsprof_tests,
3478
3550
"bench_history": benchfile,
3479
3551
"matching_tests_first": first,
3480
3552
"list_only": list_only,
3657
3729
verified = 'inapplicable'
3658
3730
tree = WorkingTree.open_containing(directory)[0]
3660
# die as quickly as possible if there are uncommitted changes
3662
3733
basis_tree = tree.revision_tree(tree.last_revision())
3663
3734
except errors.NoSuchRevision:
3664
3735
basis_tree = tree.basis_tree()
3737
# die as quickly as possible if there are uncommitted changes
3666
if tree.has_changes(basis_tree):
3739
if tree.has_changes():
3667
3740
raise errors.UncommittedChanges(tree)
3669
3742
view_info = _get_view_info_for_change_reporter(tree)
3720
3793
merger.other_rev_id)
3721
3794
result.report(self.outf)
3723
merger.check_basis(False)
3796
if merger.this_basis is None:
3797
raise errors.BzrCommandError(
3798
"This branch has no commits."
3799
" (perhaps you would prefer 'bzr pull')")
3725
3801
return self._do_preview(merger, cleanups)
3726
3802
elif interactive:
3770
3846
shelver = shelf_ui.Shelver(merger.this_tree, result_tree, destroy=True,
3771
3847
reporter=shelf_ui.ApplyReporter(),
3772
3848
diff_writer=writer(sys.stdout))
3775
3854
def sanity_check_merger(self, merger):
3776
3855
if (merger.show_base and
4020
4099
name. If you name a directory, all the contents of that directory will be
4023
Any files that have been newly added since that revision will be deleted,
4024
with a backup kept if appropriate. Directories containing unknown files
4025
will not be deleted.
4102
If you have newly added files since the target revision, they will be
4103
removed. If the files to be removed have been changed, backups will be
4104
created as above. Directories containing unknown files will not be
4027
4107
The working tree contains a list of pending merged revisions, which will
4028
4108
be included as parents in the next commit. Normally, revert clears that
4031
4111
revert ." in the tree root to revert all files but keep the merge record,
4032
4112
and "bzr revert --forget-merges" to clear the pending merge list without
4033
4113
reverting any files.
4115
Using "bzr revert --forget-merges", it is possible to apply the changes
4116
from an arbitrary merge as a single revision. To do this, perform the
4117
merge as desired. Then doing revert with the "--forget-merges" option will
4118
keep the content of the tree as it was, but it will clear the list of
4119
pending merges. The next commit will then contain all of the changes that
4120
would have been in the merge, but without any mention of the other parent
4121
revisions. Because this technique forgets where these changes originated,
4122
it may cause additional conflicts on later merges involving the source and
4036
4126
_see_also = ['cat', 'export']
4506
4600
before they will be applied to the local branch.
4508
4602
Bound branches use the nickname of its master branch unless it is set
4509
locally, in which case binding will update the the local nickname to be
4603
locally, in which case binding will update the local nickname to be
4510
4604
that of the master.
4712
4806
takes_options = [
4714
4808
help='Serve on stdin/out for use from inetd or sshd.'),
4715
RegistryOption('protocol',
4716
help="Protocol to serve.",
4809
RegistryOption('protocol',
4810
help="Protocol to serve.",
4717
4811
lazy_registry=('bzrlib.transport', 'transport_server_registry'),
4718
4812
value_switches=True),
4728
4822
Option('allow-writes',
4729
4823
help='By default the server is a readonly server. Supplying '
4730
4824
'--allow-writes enables write access to the contents of '
4731
'the served directory and below.'
4825
'the served directory and below. Note that ``bzr serve`` '
4826
'does not perform authentication, so unless some form of '
4827
'external authentication is arranged supplying this '
4828
'option leads to global uncontrolled write access to your '
4970
5068
To use a specific mail program, set the mail_client configuration option.
4971
5069
(For Thunderbird 1.5, this works around some bugs.) Supported values for
4972
specific clients are "claws", "evolution", "kmail", "mutt", and
4973
"thunderbird"; generic options are "default", "editor", "emacsclient",
4974
"mapi", and "xdg-email". Plugins may also add supported clients.
5070
specific clients are "claws", "evolution", "kmail", "mail.app" (MacOS X's
5071
Mail.app), "mutt", and "thunderbird"; generic options are "default",
5072
"editor", "emacsclient", "mapi", and "xdg-email". Plugins may also add
4976
5075
If mail is being sent, a to address is required. This can be supplied
4977
5076
either on the commandline, by setting the submit_to configuration
5356
5455
/path/to/newbranch.
5358
5457
Bound branches use the nickname of its master branch unless it is set
5359
locally, in which case switching will update the the local nickname to be
5458
locally, in which case switching will update the local nickname to be
5360
5459
that of the master.