119
117
and the full URL to the actual branch
121
119
# This path is meant to be relative to the existing branch
122
this_url = _get_branch_location(control_dir,
123
possible_transports=possible_transports)
120
this_url = _get_branch_location(
121
control_dir, possible_transports=possible_transports)
124
122
# Perhaps the target control dir supports colocated branches?
126
root = controldir.ControlDir.open(this_url,
127
possible_transports=possible_transports)
124
root = controldir.ControlDir.open(
125
this_url, possible_transports=possible_transports)
128
126
except errors.NotBranchError:
129
127
return (False, this_url)
132
wt = control_dir.open_workingtree()
130
control_dir.open_workingtree()
133
131
except (errors.NoWorkingTree, errors.NotLocalUrl):
134
132
return (False, this_url)
188
186
if location is None:
191
return Branch.open(location,
192
possible_transports=possible_transports)
190
location, possible_transports=possible_transports)
193
191
except errors.NotBranchError:
195
cdir = controldir.ControlDir.open(near,
196
possible_transports=possible_transports)
197
return open_sibling_branch(cdir, location,
198
possible_transports=possible_transports)
193
cdir = controldir.ControlDir.open(
194
near, possible_transports=possible_transports)
195
return open_sibling_branch(
196
cdir, location, possible_transports=possible_transports)
201
199
def iter_sibling_branches(control_dir, possible_transports=None):
449
446
def run(self, revision_id=None, revision=None, directory=u'.'):
450
447
if revision_id is not None and revision is not None:
451
448
raise errors.BzrCommandError(gettext('You can only supply one of'
452
' revision_id or --revision'))
449
' revision_id or --revision'))
453
450
if revision_id is None and revision is None:
454
raise errors.BzrCommandError(gettext('You must supply either'
455
' --revision or a revision_id'))
451
raise errors.BzrCommandError(
452
gettext('You must supply either --revision or a revision_id'))
457
454
b = controldir.ControlDir.open_containing_tree_or_branch(directory)[1]
459
456
revisions = b.repository.revisions
460
457
if revisions is None:
461
raise errors.BzrCommandError(gettext('Repository %r does not support '
462
'access to raw revision texts'))
458
raise errors.BzrCommandError(
459
gettext('Repository %r does not support '
460
'access to raw revision texts'))
464
462
with b.repository.lock_read():
465
463
# TODO: jam 20060112 should cat-revision always output utf-8?
746
751
if file_ids_from is not None:
748
753
base_tree, base_path = WorkingTree.open_containing(
750
755
except errors.NoWorkingTree:
751
756
base_branch, base_path = Branch.open_containing(
753
758
base_tree = base_branch.basis_tree()
755
action = breezy.add.AddFromBaseAction(base_tree, base_path,
756
to_file=self.outf, should_print=(not is_quiet()))
758
action = breezy.add.AddWithSkipLargeAction(to_file=self.outf,
760
action = breezy.add.AddFromBaseAction(
761
base_tree, base_path, to_file=self.outf,
759
762
should_print=(not is_quiet()))
764
action = breezy.add.AddWithSkipLargeAction(
765
to_file=self.outf, should_print=(not is_quiet()))
762
768
self.add_cleanup(base_tree.lock_read().unlock)
763
769
tree, file_list = tree_files_for_add(file_list)
764
added, ignored = tree.smart_add(file_list, not
765
no_recurse, action=action, save=not dry_run)
770
added, ignored = tree.smart_add(
771
file_list, not no_recurse, action=action, save=not dry_run)
766
772
self.cleanup_now()
767
773
if len(ignored) > 0:
769
775
for glob in sorted(ignored):
770
776
for path in ignored[glob]:
772
gettext("ignored {0} matching \"{1}\"\n").format(
778
gettext("ignored {0} matching \"{1}\"\n").format(
776
782
class cmd_mkdir(Command):
917
926
encoding_type = 'replace'
919
928
def run(self, names_list):
921
929
if names_list is None:
923
931
if len(names_list) < 2:
924
932
raise errors.BzrCommandError(gettext("missing file argument"))
925
tree, rel_names = WorkingTree.open_containing_paths(names_list, canonicalize=False)
933
tree, rel_names = WorkingTree.open_containing_paths(
934
names_list, canonicalize=False)
926
935
for file_name in rel_names[0:-1]:
927
936
if file_name == '':
928
raise errors.BzrCommandError(gettext("can not copy root of branch"))
937
raise errors.BzrCommandError(
938
gettext("can not copy root of branch"))
929
939
self.add_cleanup(tree.lock_tree_write().unlock)
930
940
into_existing = osutils.isdir(names_list[-1])
931
941
if not into_existing:
933
943
(src, dst) = rel_names
934
944
except IndexError:
935
raise errors.BzrCommandError(gettext('to copy multiple files the'
936
' destination must be a versioned'
945
raise errors.BzrCommandError(
946
gettext('to copy multiple files the'
947
' destination must be a versioned'
938
949
pairs = [(src, dst)]
940
pairs = [(n, osutils.joinpath([rel_names[-1], osutils.basename(n)]))
941
for n in rel_names[:-1]]
952
(n, osutils.joinpath([rel_names[-1], osutils.basename(n)]))
953
for n in rel_names[:-1]]
943
955
for src, dst in pairs:
945
957
src_kind = tree.stored_kind(src)
946
958
except errors.NoSuchFile:
947
959
raise errors.BzrCommandError(
948
gettext('Could not copy %s => %s: %s is not versioned.')
960
gettext('Could not copy %s => %s: %s is not versioned.')
950
962
if src_kind is None:
951
963
raise errors.BzrCommandError(
952
964
gettext('Could not copy %s => %s . %s is not versioned\\.'
954
966
if src_kind == 'directory':
955
967
raise errors.BzrCommandError(
956
968
gettext('Could not copy %s => %s . %s is a directory.'
958
970
dst_parent = osutils.split(dst)[0]
959
971
if dst_parent != '':
961
973
dst_parent_kind = tree.stored_kind(dst_parent)
962
974
except errors.NoSuchFile:
963
975
raise errors.BzrCommandError(
964
gettext('Could not copy %s => %s: %s is not versioned.')
965
% (src, dst, dst_parent))
976
gettext('Could not copy %s => %s: %s is not versioned.')
977
% (src, dst, dst_parent))
966
978
if dst_parent_kind != 'directory':
967
979
raise errors.BzrCommandError(
968
gettext('Could not copy to %s: %s is not a directory.')
969
% (dst_parent, dst_parent))
980
gettext('Could not copy to %s: %s is not a directory.')
981
% (dst_parent, dst_parent))
971
983
tree.copy_one(src, dst)
995
1007
takes_args = ['names*']
996
1008
takes_options = [Option("after", help="Move only the brz identifier"
997
" of the file, because the file has already been moved."),
998
Option('auto', help='Automatically guess renames.'),
999
Option('dry-run', help='Avoid making changes when guessing renames.'),
1009
" of the file, because the file has already been moved."),
1010
Option('auto', help='Automatically guess renames.'),
1012
'dry-run', help='Avoid making changes when guessing renames.'),
1001
1014
aliases = ['move', 'rename']
1002
1015
encoding_type = 'replace'
1010
1023
names_list = []
1011
1024
if len(names_list) < 2:
1012
1025
raise errors.BzrCommandError(gettext("missing file argument"))
1013
tree, rel_names = WorkingTree.open_containing_paths(names_list, canonicalize=False)
1026
tree, rel_names = WorkingTree.open_containing_paths(
1027
names_list, canonicalize=False)
1014
1028
for file_name in rel_names[0:-1]:
1015
1029
if file_name == '':
1016
raise errors.BzrCommandError(gettext("can not move root of branch"))
1030
raise errors.BzrCommandError(
1031
gettext("can not move root of branch"))
1017
1032
self.add_cleanup(tree.lock_tree_write().unlock)
1018
1033
self._run(tree, names_list, rel_names, after)
1020
1035
def run_auto(self, names_list, after, dry_run):
1021
1036
if names_list is not None and len(names_list) > 1:
1022
raise errors.BzrCommandError(gettext('Only one path may be specified to'
1037
raise errors.BzrCommandError(
1038
gettext('Only one path may be specified to --auto.'))
1025
raise errors.BzrCommandError(gettext('--after cannot be specified with'
1040
raise errors.BzrCommandError(
1041
gettext('--after cannot be specified with --auto.'))
1027
1042
work_tree, file_list = WorkingTree.open_containing_paths(
1028
1043
names_list, default_directory='.')
1029
1044
self.add_cleanup(work_tree.lock_tree_write().unlock)
1030
1045
rename_map.RenameMap.guess_renames(
1031
work_tree.basis_tree(), work_tree, dry_run)
1046
work_tree.basis_tree(), work_tree, dry_run)
1033
1048
def _run(self, tree, names_list, rel_names, after):
1034
1049
into_existing = osutils.isdir(names_list[-1])
1143
1159
_see_also = ['push', 'update', 'status-flags', 'send']
1144
1160
takes_options = ['remember', 'overwrite', 'revision',
1145
custom_help('verbose',
1146
help='Show logs of pulled revisions.'),
1147
custom_help('directory',
1148
help='Branch to pull into, '
1149
'rather than the one containing the working directory.'),
1151
help="Perform a local pull in a bound "
1152
"branch. Local pulls are not applied to "
1153
"the master branch."
1156
help="Show base revision text in conflicts."),
1157
Option('overwrite-tags',
1158
help="Overwrite tags only."),
1161
custom_help('verbose',
1162
help='Show logs of pulled revisions.'),
1163
custom_help('directory',
1164
help='Branch to pull into, '
1165
'rather than the one containing the working directory.'),
1167
help="Perform a local pull in a bound "
1168
"branch. Local pulls are not applied to "
1169
"the master branch."
1172
help="Show base revision text in conflicts."),
1173
Option('overwrite-tags',
1174
help="Overwrite tags only."),
1160
1176
takes_args = ['location?']
1161
1177
encoding_type = 'replace'
1289
1306
_see_also = ['pull', 'update', 'working-trees']
1290
1307
takes_options = ['remember', 'overwrite', 'verbose', 'revision',
1291
Option('create-prefix',
1292
help='Create the path leading up to the branch '
1293
'if it does not already exist.'),
1294
custom_help('directory',
1295
help='Branch to push from, '
1296
'rather than the one containing the working directory.'),
1297
Option('use-existing-dir',
1298
help='By default push will fail if the target'
1299
' directory exists, but does not already'
1300
' have a control directory. This flag will'
1301
' allow push to proceed.'),
1303
help='Create a stacked branch that references the public location '
1304
'of the parent branch.'),
1305
Option('stacked-on',
1306
help='Create a stacked branch that refers to another branch '
1307
'for the commit history. Only the work not present in the '
1308
'referenced branch is included in the branch created.',
1311
help='Refuse to push if there are uncommitted changes in'
1312
' the working tree, --no-strict disables the check.'),
1314
help="Don't populate the working tree, even for protocols"
1315
" that support it."),
1316
Option('overwrite-tags',
1317
help="Overwrite tags only."),
1318
Option('lossy', help="Allow lossy push, i.e. dropping metadata "
1319
"that can't be represented in the target.")
1308
Option('create-prefix',
1309
help='Create the path leading up to the branch '
1310
'if it does not already exist.'),
1311
custom_help('directory',
1312
help='Branch to push from, '
1313
'rather than the one containing the working directory.'),
1314
Option('use-existing-dir',
1315
help='By default push will fail if the target'
1316
' directory exists, but does not already'
1317
' have a control directory. This flag will'
1318
' allow push to proceed.'),
1320
help='Create a stacked branch that references the public location '
1321
'of the parent branch.'),
1322
Option('stacked-on',
1323
help='Create a stacked branch that refers to another branch '
1324
'for the commit history. Only the work not present in the '
1325
'referenced branch is included in the branch created.',
1328
help='Refuse to push if there are uncommitted changes in'
1329
' the working tree, --no-strict disables the check.'),
1331
help="Don't populate the working tree, even for protocols"
1332
" that support it."),
1333
Option('overwrite-tags',
1334
help="Overwrite tags only."),
1335
Option('lossy', help="Allow lossy push, i.e. dropping metadata "
1336
"that can't be represented in the target.")
1321
1338
takes_args = ['location?']
1322
1339
encoding_type = 'replace'
1324
1341
def run(self, location=None, remember=None, overwrite=False,
1325
create_prefix=False, verbose=False, revision=None,
1326
use_existing_dir=False, directory=None, stacked_on=None,
1327
stacked=False, strict=None, no_tree=False,
1328
overwrite_tags=False, lossy=False):
1342
create_prefix=False, verbose=False, revision=None,
1343
use_existing_dir=False, directory=None, stacked_on=None,
1344
stacked=False, strict=None, no_tree=False,
1345
overwrite_tags=False, lossy=False):
1329
1346
from .push import _show_push_branch
1379
1396
"No push location known or specified. To push to the "
1380
1397
"parent branch (at %s), use 'brz push :parent'." %
1381
1398
urlutils.unescape_for_display(parent_loc,
1382
self.outf.encoding)))
1399
self.outf.encoding)))
1384
1401
raise errors.BzrCommandError(gettext(
1385
1402
"No push location known or specified."))
1387
1404
display_url = urlutils.unescape_for_display(stored_loc,
1389
1406
note(gettext("Using saved push location: %s") % display_url)
1390
1407
location = stored_loc
1392
1409
_show_push_branch(br_from, revision_id, location, self.outf,
1393
verbose=verbose, overwrite=overwrite, remember=remember,
1394
stacked_on=stacked_on, create_prefix=create_prefix,
1395
use_existing_dir=use_existing_dir, no_tree=no_tree,
1410
verbose=verbose, overwrite=overwrite, remember=remember,
1411
stacked_on=stacked_on, create_prefix=create_prefix,
1412
use_existing_dir=use_existing_dir, no_tree=no_tree,
1399
1416
class cmd_branch(Command):
1413
1430
_see_also = ['checkout']
1414
1431
takes_args = ['from_location', 'to_location?']
1415
1432
takes_options = ['revision',
1416
Option('hardlink', help='Hard-link working tree files where possible.'),
1417
Option('files-from', type=text_type,
1418
help="Get file contents from this tree."),
1420
help="Create a branch without a working-tree."),
1422
help="Switch the checkout in the current directory "
1423
"to the new branch."),
1425
help='Create a stacked branch referring to the source branch. '
1426
'The new branch will depend on the availability of the source '
1427
'branch for all operations.'),
1428
Option('standalone',
1429
help='Do not use a shared repository, even if available.'),
1430
Option('use-existing-dir',
1431
help='By default branch will fail if the target'
1432
' directory exists, but does not already'
1433
' have a control directory. This flag will'
1434
' allow branch to proceed.'),
1436
help="Bind new branch to from location."),
1434
'hardlink', help='Hard-link working tree files where possible.'),
1435
Option('files-from', type=text_type,
1436
help="Get file contents from this tree."),
1438
help="Create a branch without a working-tree."),
1440
help="Switch the checkout in the current directory "
1441
"to the new branch."),
1443
help='Create a stacked branch referring to the source branch. '
1444
'The new branch will depend on the availability of the source '
1445
'branch for all operations.'),
1446
Option('standalone',
1447
help='Do not use a shared repository, even if available.'),
1448
Option('use-existing-dir',
1449
help='By default branch will fail if the target'
1450
' directory exists, but does not already'
1451
' have a control directory. This flag will'
1452
' allow branch to proceed.'),
1454
help="Bind new branch to from location."),
1439
1457
def run(self, from_location, to_location=None, revision=None,
1440
1458
hardlink=False, stacked=False, standalone=False, no_tree=False,
1517
1535
# We therefore need a try/except here and not just 'if stacked:'
1519
1537
note(gettext('Created new stacked branch referring to %s.') %
1520
branch.get_stacked_on_url())
1538
branch.get_stacked_on_url())
1521
1539
except (errors.NotStacked, _mod_branch.UnstackableBranchFormat,
1522
errors.UnstackableRepositoryFormat) as e:
1523
note(ngettext('Branched %d revision.', 'Branched %d revisions.', branch.revno()) % branch.revno())
1540
errors.UnstackableRepositoryFormat) as e:
1541
revno = branch.revno()
1542
if revno is not None:
1543
note(ngettext('Branched %d revision.',
1544
'Branched %d revisions.',
1545
branch.revno()) % revno)
1547
note(gettext('Created new branch.'))
1525
1549
# Bind to the parent
1526
1550
parent_branch = Branch.open(from_location)
1587
1611
class cmd_checkout(Command):
1588
1612
__doc__ = """Create a new checkout of an existing branch.
1590
If BRANCH_LOCATION is omitted, checkout will reconstitute a working tree for
1591
the branch found in '.'. This is useful if you have removed the working tree
1592
or if it was never created - i.e. if you pushed the branch to its current
1593
location using SFTP.
1614
If BRANCH_LOCATION is omitted, checkout will reconstitute a working tree
1615
for the branch found in '.'. This is useful if you have removed the working
1616
tree or if it was never created - i.e. if you pushed the branch to its
1617
current location using SFTP.
1595
If the TO_LOCATION is omitted, the last component of the BRANCH_LOCATION will
1596
be used. In other words, "checkout ../foo/bar" will attempt to create ./bar.
1597
If the BRANCH_LOCATION has no / or path separator embedded, the TO_LOCATION
1598
is derived from the BRANCH_LOCATION by stripping a leading scheme or drive
1599
identifier, if any. For example, "checkout lp:foo-bar" will attempt to
1619
If the TO_LOCATION is omitted, the last component of the BRANCH_LOCATION
1620
will be used. In other words, "checkout ../foo/bar" will attempt to create
1621
./bar. If the BRANCH_LOCATION has no / or path separator embedded, the
1622
TO_LOCATION is derived from the BRANCH_LOCATION by stripping a leading
1623
scheme or drive identifier, if any. For example, "checkout lp:foo-bar" will
1624
attempt to create ./foo-bar.
1602
1626
To retrieve the branch as of a particular revision, supply the --revision
1603
parameter, as in "checkout foo/bar -r 5". Note that this will be immediately
1604
out of date [so you cannot commit] but it may be useful (i.e. to examine old
1627
parameter, as in "checkout foo/bar -r 5". Note that this will be
1628
immediately out of date [so you cannot commit] but it may be useful (i.e.
1629
to examine old code.)
1608
1632
_see_also = ['checkouts', 'branch', 'working-trees', 'remove-tree']
1856
1879
takes_args = ['file*']
1857
1880
takes_options = ['verbose',
1858
Option('new', help='Only remove files that have never been committed.'),
1859
RegistryOption.from_kwargs('file-deletion-strategy',
1860
'The file deletion mode to be used.',
1861
title='Deletion Strategy', value_switches=True, enum_switch=False,
1862
safe='Backup changed files (default).',
1863
keep='Delete from brz but leave the working copy.',
1864
no_backup='Don\'t backup changed files.'),
1882
'new', help='Only remove files that have never been committed.'),
1883
RegistryOption.from_kwargs('file-deletion-strategy',
1884
'The file deletion mode to be used.',
1885
title='Deletion Strategy', value_switches=True, enum_switch=False,
1886
safe='Backup changed files (default).',
1887
keep='Delete from brz but leave the working copy.',
1888
no_backup='Don\'t backup changed files.'),
1866
1890
aliases = ['rm', 'del']
1867
1891
encoding_type = 'replace'
1869
1893
def run(self, file_list, verbose=False, new=False,
1870
file_deletion_strategy='safe'):
1894
file_deletion_strategy='safe'):
1872
1896
tree, file_list = WorkingTree.open_containing_paths(file_list)
2054
2078
Option('create-prefix',
2055
2079
help='Create the path leading up to the branch '
2056
2080
'if it does not already exist.'),
2057
RegistryOption('format',
2058
help='Specify a format for this branch. '
2059
'See "help formats" for a full list.',
2060
lazy_registry=('breezy.controldir', 'format_registry'),
2061
converter=lambda name: controldir.format_registry.make_controldir(name),
2062
value_switches=True,
2063
title="Branch format",
2065
Option('append-revisions-only',
2066
help='Never change revnos or the existing log.'
2067
' Append revisions to it only.'),
2069
'Create a branch without a working tree.')
2081
RegistryOption('format',
2082
help='Specify a format for this branch. '
2083
'See "help formats" for a full list.',
2084
lazy_registry=('breezy.controldir', 'format_registry'),
2085
converter=lambda name: controldir.format_registry.make_controldir(
2087
value_switches=True,
2088
title="Branch format",
2090
Option('append-revisions-only',
2091
help='Never change revnos or the existing log.'
2092
' Append revisions to it only.'),
2094
'Create a branch without a working tree.')
2071
2097
def run(self, location=None, format=None, append_revisions_only=False,
2072
2098
create_prefix=False, no_tree=False):
2073
2099
if format is None:
2149
2176
New branches created under the repository directory will store their
2150
2177
revisions in the repository, not in the branch directory. For branches
2151
with shared history, this reduces the amount of storage needed and
2178
with shared history, this reduces the amount of storage needed and
2152
2179
speeds up the creation of new branches.
2154
2181
If the --no-trees option is given then the branches in the repository
2155
will not have working trees by default. They will still exist as
2156
directories on disk, but they will not have separate copies of the
2182
will not have working trees by default. They will still exist as
2183
directories on disk, but they will not have separate copies of the
2157
2184
files at a certain revision. This can be useful for repositories that
2158
2185
store branches which are interacted with through checkouts or remote
2159
2186
branches, such as on a server.
2174
2201
_see_also = ['init', 'branch', 'checkout', 'repositories']
2175
2202
takes_args = ["location"]
2176
2203
takes_options = [RegistryOption('format',
2177
help='Specify a format for this repository. See'
2178
' "brz help formats" for details.',
2179
lazy_registry=('breezy.controldir', 'format_registry'),
2180
converter=lambda name: controldir.format_registry.make_controldir(name),
2181
value_switches=True, title='Repository format'),
2204
help='Specify a format for this repository. See'
2205
' "brz help formats" for details.',
2207
'breezy.controldir', 'format_registry'),
2208
converter=lambda name: controldir.format_registry.make_controldir(
2210
value_switches=True, title='Repository format'),
2182
2211
Option('no-trees',
2183
help='Branches in the repository will default to'
2184
' not having a working tree.'),
2212
help='Branches in the repository will default to'
2213
' not having a working tree.'),
2186
2215
aliases = ["init-repo"]
2188
2217
def run(self, location, format=None, no_trees=False):
2202
2231
(repo, newdir, require_stacking, repository_policy) = (
2203
2232
format.initialize_on_transport_ex(to_transport,
2204
create_prefix=True, make_working_trees=not no_trees,
2205
shared_repo=True, force_new_repo=True,
2206
use_existing_dir=True,
2207
repo_format_name=repo_format_name))
2233
create_prefix=True, make_working_trees=not no_trees,
2234
shared_repo=True, force_new_repo=True,
2235
use_existing_dir=True,
2236
repo_format_name=repo_format_name))
2208
2237
if not is_quiet():
2209
2238
from .info import show_bzrdir_info
2210
2239
show_bzrdir_info(newdir, verbose=0, outfile=self.outf)
2306
2335
help='Set prefixes added to old and new filenames, as '
2307
2336
'two values separated by a colon. (eg "old/:new/").'),
2309
help='Branch/tree to compare from.',
2338
help='Branch/tree to compare from.',
2313
help='Branch/tree to compare to.',
2342
help='Branch/tree to compare to.',
2318
2347
Option('using',
2319
help='Use this command to compare files.',
2348
help='Use this command to compare files.',
2322
2351
RegistryOption('format',
2324
help='Diff format to use.',
2325
lazy_registry=('breezy.diff', 'format_registry'),
2326
title='Diff format'),
2353
help='Diff format to use.',
2354
lazy_registry=('breezy.diff', 'format_registry'),
2355
title='Diff format'),
2327
2356
Option('context',
2328
help='How many lines of context to show.',
2357
help='How many lines of context to show.',
2332
2361
aliases = ['di', 'dif']
2333
2362
encoding_type = 'exact'
2642
2671
takes_args = ['file*']
2643
2672
_see_also = ['log-formats', 'revisionspec']
2644
2673
takes_options = [
2646
help='Show from oldest to newest.'),
2648
custom_help('verbose',
2649
help='Show files changed in each revision.'),
2653
type=breezy.option._parse_revision_str,
2655
help='Show just the specified revision.'
2656
' See also "help revisionspec".'),
2658
RegistryOption('authors',
2659
'What names to list as authors - first, all or committer.',
2661
lazy_registry=('breezy.log', 'author_list_registry'),
2665
help='Number of levels to display - 0 for all, 1 for flat.',
2667
type=_parse_levels),
2669
help='Show revisions whose message matches this '
2670
'regular expression.',
2675
help='Limit the output to the first N revisions.',
2680
help='Show changes made in each revision as a patch.'),
2681
Option('include-merged',
2682
help='Show merged revisions like --levels 0 does.'),
2683
Option('include-merges', hidden=True,
2684
help='Historical alias for --include-merged.'),
2685
Option('omit-merges',
2686
help='Do not report commits with more than one parent.'),
2687
Option('exclude-common-ancestry',
2688
help='Display only the revisions that are not part'
2689
' of both ancestries (require -rX..Y).'
2691
Option('signatures',
2692
help='Show digital signature validity.'),
2695
help='Show revisions whose properties match this '
2698
ListOption('match-message',
2699
help='Show revisions whose message matches this '
2702
ListOption('match-committer',
2675
help='Show from oldest to newest.'),
2677
custom_help('verbose',
2678
help='Show files changed in each revision.'),
2682
type=breezy.option._parse_revision_str,
2684
help='Show just the specified revision.'
2685
' See also "help revisionspec".'),
2687
RegistryOption('authors',
2688
'What names to list as authors - first, all or committer.',
2691
'breezy.log', 'author_list_registry'),
2695
help='Number of levels to display - 0 for all, 1 for flat.',
2697
type=_parse_levels),
2699
help='Show revisions whose message matches this '
2700
'regular expression.',
2705
help='Limit the output to the first N revisions.',
2710
help='Show changes made in each revision as a patch.'),
2711
Option('include-merged',
2712
help='Show merged revisions like --levels 0 does.'),
2713
Option('include-merges', hidden=True,
2714
help='Historical alias for --include-merged.'),
2715
Option('omit-merges',
2716
help='Do not report commits with more than one parent.'),
2717
Option('exclude-common-ancestry',
2718
help='Display only the revisions that are not part'
2719
' of both ancestries (require -rX..Y).'
2721
Option('signatures',
2722
help='Show digital signature validity.'),
2725
help='Show revisions whose properties match this '
2728
ListOption('match-message',
2729
help='Show revisions whose message matches this '
2732
ListOption('match-committer',
2703
2733
help='Show revisions whose committer matches this '
2706
ListOption('match-author',
2736
ListOption('match-author',
2707
2737
help='Show revisions whose authors match this '
2710
ListOption('match-bugs',
2740
ListOption('match-bugs',
2711
2741
help='Show revisions whose bugs match this '
2715
2745
encoding_type = 'replace'
2717
2747
@display_command
2959
2991
_see_also = ['status', 'cat']
2960
2992
takes_args = ['path?']
2961
2993
takes_options = [
2964
Option('recursive', short_name='R',
2965
help='Recurse into subdirectories.'),
2967
help='Print paths relative to the root of the branch.'),
2968
Option('unknown', short_name='u',
2969
help='Print unknown files.'),
2970
Option('versioned', help='Print versioned files.',
2972
Option('ignored', short_name='i',
2973
help='Print ignored files.'),
2974
Option('kind', short_name='k',
2975
help=('List entries of a particular kind: file, '
2976
'directory, symlink, tree-reference.'),
2996
Option('recursive', short_name='R',
2997
help='Recurse into subdirectories.'),
2999
help='Print paths relative to the root of the branch.'),
3000
Option('unknown', short_name='u',
3001
help='Print unknown files.'),
3002
Option('versioned', help='Print versioned files.',
3004
Option('ignored', short_name='i',
3005
help='Print ignored files.'),
3006
Option('kind', short_name='k',
3007
help=('List entries of a particular kind: file, '
3008
'directory, symlink, tree-reference.'),
2982
3015
@display_command
2983
3016
def run(self, revision=None, verbose=False,
2984
3017
recursive=False, from_root=False,
3185
3219
bad_patterns_count += 1
3186
3220
bad_patterns += ('\n %s' % p)
3187
3221
if bad_patterns:
3188
msg = (ngettext('Invalid ignore pattern found. %s',
3222
msg = (ngettext('Invalid ignore pattern found. %s',
3189
3223
'Invalid ignore patterns found. %s',
3190
3224
bad_patterns_count) % bad_patterns)
3191
3225
ui.ui_factory.show_error(msg)
3192
3226
raise lazy_regex.InvalidPattern('')
3193
3227
for name_pattern in name_pattern_list:
3194
3228
if (name_pattern[0] == '/' or
3195
(len(name_pattern) > 1 and name_pattern[1] == ':')):
3229
(len(name_pattern) > 1 and name_pattern[1] == ':')):
3196
3230
raise errors.BzrCommandError(gettext(
3197
3231
"NAME_PATTERN should not be an absolute path"))
3198
3232
tree, relpath = WorkingTree.open_containing(directory)
3293
3328
encoding_type = 'exact'
3294
3329
takes_args = ['dest', 'branch_or_subdir?']
3295
3330
takes_options = ['directory',
3297
help="Type of file to export to.",
3300
Option('filters', help='Apply content filters to export the '
3301
'convenient form.'),
3304
help="Name of the root directory inside the exported file."),
3305
Option('per-file-timestamps',
3306
help='Set modification time of files to that of the last '
3307
'revision in which it was changed.'),
3308
Option('uncommitted',
3309
help='Export the working tree contents rather than that of the '
3332
help="Type of file to export to.",
3335
Option('filters', help='Apply content filters to export the '
3336
'convenient form.'),
3339
help="Name of the root directory inside the exported file."),
3340
Option('per-file-timestamps',
3341
help='Set modification time of files to that of the last '
3342
'revision in which it was changed.'),
3343
Option('uncommitted',
3344
help='Export the working tree contents rather than that of the '
3312
3348
def run(self, dest, branch_or_subdir=None, revision=None, format=None,
3313
root=None, filters=False, per_file_timestamps=False, uncommitted=False,
3349
root=None, filters=False, per_file_timestamps=False, uncommitted=False,
3315
3351
from .export import export, guess_format, get_root_name
3317
3353
if branch_or_subdir is None:
3500
3537
_see_also = ['add', 'bugs', 'hooks', 'uncommit']
3501
3538
takes_args = ['selected*']
3502
3539
takes_options = [
3503
ListOption('exclude', type=text_type, short_name='x',
3504
help="Do not consider changes made to a given path."),
3505
Option('message', type=text_type,
3507
help="Description of the new revision."),
3510
help='Commit even if nothing has changed.'),
3511
Option('file', type=text_type,
3514
help='Take commit message from this file.'),
3516
help="Refuse to commit if there are unknown "
3517
"files in the working tree."),
3518
Option('commit-time', type=text_type,
3519
help="Manually set a commit time using commit date "
3520
"format, e.g. '2009-10-10 08:00:00 +0100'."),
3521
ListOption('fixes', type=text_type,
3522
help="Mark a bug as being fixed by this revision "
3523
"(see \"brz help bugs\")."),
3524
ListOption('author', type=text_type,
3525
help="Set the author's name, if it's different "
3526
"from the committer."),
3528
help="Perform a local commit in a bound "
3529
"branch. Local commits are not pushed to "
3530
"the master branch until a normal commit "
3533
Option('show-diff', short_name='p',
3534
help='When no message is supplied, show the diff along'
3535
' with the status summary in the message editor.'),
3537
help='When committing to a foreign version control '
3538
'system do not push data that can not be natively '
3541
'exclude', type=text_type, short_name='x',
3542
help="Do not consider changes made to a given path."),
3543
Option('message', type=text_type,
3545
help="Description of the new revision."),
3548
help='Commit even if nothing has changed.'),
3549
Option('file', type=text_type,
3552
help='Take commit message from this file.'),
3554
help="Refuse to commit if there are unknown "
3555
"files in the working tree."),
3556
Option('commit-time', type=text_type,
3557
help="Manually set a commit time using commit date "
3558
"format, e.g. '2009-10-10 08:00:00 +0100'."),
3560
'bugs', type=text_type,
3561
help="Link to a related bug. (see \"brz help bugs\")."),
3563
'fixes', type=text_type,
3564
help="Mark a bug as being fixed by this revision "
3565
"(see \"brz help bugs\")."),
3567
'author', type=text_type,
3568
help="Set the author's name, if it's different "
3569
"from the committer."),
3571
help="Perform a local commit in a bound "
3572
"branch. Local commits are not pushed to "
3573
"the master branch until a normal commit "
3576
Option('show-diff', short_name='p',
3577
help='When no message is supplied, show the diff along'
3578
' with the status summary in the message editor.'),
3580
help='When committing to a foreign version control '
3581
'system do not push data that can not be natively '
3541
3583
aliases = ['ci', 'checkin']
3543
def _iter_bug_fix_urls(self, fixes, branch):
3544
default_bugtracker = None
3585
def _iter_bug_urls(self, bugs, branch, status):
3586
default_bugtracker = None
3545
3587
# Configure the properties for bug fixing attributes.
3546
for fixed_bug in fixes:
3547
tokens = fixed_bug.split(':')
3589
tokens = bug.split(':')
3548
3590
if len(tokens) == 1:
3549
3591
if default_bugtracker is None:
3550
3592
branch_config = branch.get_config_stack()
3556
3598
"'tracker:id' or specify a default bug tracker "
3557
3599
"using the `bugtracker` option.\nSee "
3558
3600
"\"brz help bugs\" for more information on this "
3559
"feature. Commit refused.") % fixed_bug)
3601
"feature. Commit refused.") % bug)
3560
3602
tag = default_bugtracker
3561
3603
bug_id = tokens[0]
3562
3604
elif len(tokens) != 2:
3563
3605
raise errors.BzrCommandError(gettext(
3564
3606
"Invalid bug %s. Must be in the form of 'tracker:id'. "
3565
3607
"See \"brz help bugs\" for more information on this "
3566
"feature.\nCommit refused.") % fixed_bug)
3608
"feature.\nCommit refused.") % bug)
3568
3610
tag, bug_id = tokens
3570
yield bugtracker.get_bug_url(tag, branch, bug_id)
3612
yield bugtracker.get_bug_url(tag, branch, bug_id), status
3571
3613
except bugtracker.UnknownBugTrackerAbbreviation:
3572
3614
raise errors.BzrCommandError(gettext(
3573
'Unrecognized bug %s. Commit refused.') % fixed_bug)
3615
'Unrecognized bug %s. Commit refused.') % bug)
3574
3616
except bugtracker.MalformedBugIdentifier as e:
3575
3617
raise errors.BzrCommandError(gettext(
3576
3618
u"%s\nCommit refused.") % (e,))
3578
3620
def run(self, message=None, file=None, verbose=False, selected_list=None,
3579
unchanged=False, strict=False, local=False, fixes=None,
3621
unchanged=False, strict=False, local=False, fixes=None, bugs=None,
3580
3622
author=None, show_diff=False, exclude=None, commit_time=None,
3582
3625
from .commit import (
3583
3626
PointlessCommit,
3662
3709
my_message = set_commit_message(commit_obj)
3663
3710
if my_message is None:
3664
start_message = generate_commit_message_template(commit_obj)
3711
start_message = generate_commit_message_template(
3665
3713
if start_message is not None:
3666
3714
start_message = start_message.encode(
3667
osutils.get_user_encoding())
3715
osutils.get_user_encoding())
3668
3716
my_message = edit_commit_message_encoded(text,
3669
start_message=start_message)
3717
start_message=start_message)
3670
3718
if my_message is None:
3671
3719
raise errors.BzrCommandError(gettext("please specify a commit"
3672
" message with either --message or --file"))
3720
" message with either --message or --file"))
3673
3721
if my_message == "":
3674
3722
raise errors.BzrCommandError(gettext("Empty commit message specified."
3675
" Please specify a commit message with either"
3676
" --message or --file or leave a blank message"
3677
" with --message \"\"."))
3723
" Please specify a commit message with either"
3724
" --message or --file or leave a blank message"
3725
" with --message \"\"."))
3678
3726
return my_message
3680
3728
# The API permits a commit with a filter of [] to mean 'select nothing'
3693
3741
except PointlessCommit:
3694
3742
raise errors.BzrCommandError(gettext("No changes to commit."
3695
" Please 'brz add' the files you want to commit, or use"
3696
" --unchanged to force an empty commit."))
3743
" Please 'brz add' the files you want to commit, or use"
3744
" --unchanged to force an empty commit."))
3697
3745
except ConflictsInTree:
3698
3746
raise errors.BzrCommandError(gettext('Conflicts detected in working '
3699
'tree. Use "brz conflicts" to list, "brz resolve FILE" to'
3747
'tree. Use "brz conflicts" to list, "brz resolve FILE" to'
3701
3749
except StrictCommitFailed:
3702
3750
raise errors.BzrCommandError(gettext("Commit refused because there are"
3703
" unknown files in the working tree."))
3751
" unknown files in the working tree."))
3704
3752
except errors.BoundBranchOutOfDate as e:
3705
3753
e.extra_help = (gettext("\n"
3706
'To commit to master branch, run update and then commit.\n'
3707
'You can also pass --local to commit to continue working '
3754
'To commit to master branch, run update and then commit.\n'
3755
'You can also pass --local to commit to continue working '
3816
3864
takes_args = ['url?']
3817
3865
takes_options = [
3818
3866
RegistryOption('format',
3819
help='Upgrade to a specific format. See "brz help'
3820
' formats" for details.',
3821
lazy_registry=('breezy.controldir', 'format_registry'),
3822
converter=lambda name: controldir.format_registry.make_controldir(name),
3823
value_switches=True, title='Branch format'),
3867
help='Upgrade to a specific format. See "brz help'
3868
' formats" for details.',
3869
lazy_registry=('breezy.controldir', 'format_registry'),
3870
converter=lambda name: controldir.format_registry.make_controldir(
3872
value_switches=True, title='Branch format'),
3824
3873
Option('clean',
3825
help='Remove the backup.bzr directory if successful.'),
3874
help='Remove the backup.bzr directory if successful.'),
3826
3875
Option('dry-run',
3827
help="Show what would be done, but don't actually do anything."),
3876
help="Show what would be done, but don't actually do anything."),
3830
3879
def run(self, url='.', format=None, clean=False, dry_run=False):
4091
4142
Option('list-only',
4092
4143
help='List the tests instead of running them.'),
4093
4144
RegistryOption('parallel',
4094
help="Run the test suite in parallel.",
4095
lazy_registry=('breezy.tests', 'parallel_registry'),
4096
value_switches=False,
4145
help="Run the test suite in parallel.",
4147
'breezy.tests', 'parallel_registry'),
4148
value_switches=False,
4098
4150
Option('randomize', type=text_type, argname="SEED",
4099
4151
help='Randomize the order of tests using the given'
4100
4152
' seed or "now" for the current time.'),
4197
4248
self._disable_fsync()
4198
4249
selftest_kwargs = {"verbose": verbose,
4200
"stop_on_failure": one,
4201
"transport": transport,
4202
"test_suite_factory": test_suite_factory,
4203
"lsprof_timed": lsprof_timed,
4204
"lsprof_tests": lsprof_tests,
4205
"matching_tests_first": first,
4206
"list_only": list_only,
4207
"random_seed": randomize,
4208
"exclude_pattern": exclude_pattern,
4210
"load_list": load_list,
4211
"debug_flags": debugflag,
4212
"starting_with": starting_with
4251
"stop_on_failure": one,
4252
"transport": transport,
4253
"test_suite_factory": test_suite_factory,
4254
"lsprof_timed": lsprof_timed,
4255
"lsprof_tests": lsprof_tests,
4256
"matching_tests_first": first,
4257
"list_only": list_only,
4258
"random_seed": randomize,
4259
"exclude_pattern": exclude_pattern,
4261
"load_list": load_list,
4262
"debug_flags": debugflag,
4263
"starting_with": starting_with
4214
4265
selftest_kwargs.update(self.additional_selftest_args)
4216
4267
# Make deprecation warnings visible, unless -Werror is set
4382
4433
Option('uncommitted', help='Apply uncommitted changes'
4383
4434
' from a working copy, instead of branch changes.'),
4384
4435
Option('pull', help='If the destination is already'
4385
' completely merged into the source, pull from the'
4386
' source rather than merging. When this happens,'
4387
' you do not need to commit the result.'),
4436
' completely merged into the source, pull from the'
4437
' source rather than merging. When this happens,'
4438
' you do not need to commit the result.'),
4388
4439
custom_help('directory',
4389
help='Branch to merge into, '
4440
help='Branch to merge into, '
4390
4441
'rather than the one containing the working directory.'),
4391
4442
Option('preview', help='Instead of merging, show a diff of the'
4393
4444
Option('interactive', help='Select changes interactively.',
4397
4448
def run(self, location=None, revision=None, force=False,
4429
4481
if location is not None:
4431
4483
mergeable = bundle.read_mergeable_from_url(location,
4432
possible_transports=possible_transports)
4484
possible_transports=possible_transports)
4433
4485
except errors.NotABundle:
4434
4486
mergeable = None
4436
4488
if uncommitted:
4437
4489
raise errors.BzrCommandError(gettext('Cannot use --uncommitted'
4438
' with bundles or merge directives.'))
4490
' with bundles or merge directives.'))
4440
4492
if revision is not None:
4441
4493
raise errors.BzrCommandError(gettext(
4442
4494
'Cannot use -r with merge directives or bundles'))
4443
4495
merger, verified = _mod_merge.Merger.from_mergeable(tree,
4446
4498
if merger is None and uncommitted:
4447
4499
if revision is not None and len(revision) > 0:
4448
4500
raise errors.BzrCommandError(gettext('Cannot use --uncommitted and'
4449
' --revision at the same time.'))
4501
' --revision at the same time.'))
4450
4502
merger = self.get_merger_from_uncommitted(tree, location, None)
4451
4503
allow_pending = False
4453
4505
if merger is None:
4454
4506
merger, allow_pending = self._get_merger_from_branch(tree,
4455
location, revision, remember, possible_transports, None)
4507
location, revision, remember, possible_transports, None)
4457
4509
merger.merge_type = merge_type
4458
4510
merger.reprocess = reprocess
4459
4511
merger.show_base = show_base
4460
4512
self.sanity_check_merger(merger)
4461
4513
if (merger.base_rev_id == merger.other_rev_id and
4462
merger.other_rev_id is not None):
4514
merger.other_rev_id is not None):
4463
4515
# check if location is a nonexistent file (and not a branch) to
4464
4516
# disambiguate the 'Nothing to do'
4465
4517
if merger.interesting_files:
4466
4518
if not merger.other_tree.has_filename(
4467
merger.interesting_files[0]):
4519
merger.interesting_files[0]):
4468
4520
note(gettext("merger: ") + str(merger))
4469
4521
raise errors.PathsDoNotExist([location])
4470
4522
note(gettext('Nothing to do.'))
4472
4524
if pull and not preview:
4473
4525
if merger.interesting_files is not None:
4474
raise errors.BzrCommandError(gettext('Cannot pull individual files'))
4526
raise errors.BzrCommandError(
4527
gettext('Cannot pull individual files'))
4475
4528
if (merger.base_rev_id == tree.last_revision()):
4476
4529
result = tree.pull(merger.other_branch, False,
4477
4530
merger.other_rev_id)
4559
4612
(merger.base_tree is not None and
4560
4613
not getattr(merger.base_tree, 'plan_file_merge', None)))):
4561
4614
raise errors.BzrCommandError(
4562
gettext('Plan file merge unsupported: '
4563
'Merge type incompatible with tree formats.'))
4615
gettext('Plan file merge unsupported: '
4616
'Merge type incompatible with tree formats.'))
4565
4618
def _get_merger_from_branch(self, tree, location, revision, remember,
4566
4619
possible_transports, pb):
4567
4620
"""Produce a merger from a location, assuming it refers to a branch."""
4568
4621
# find the branch locations
4569
4622
other_loc, user_location = self._select_branch_location(tree, location,
4571
4624
if revision is not None and len(revision) == 2:
4572
4625
base_loc, _unused = self._select_branch_location(tree,
4573
location, revision, 0)
4626
location, revision, 0)
4575
4628
base_loc = other_loc
4576
4629
# Open the branches
4577
4630
other_branch, other_path = Branch.open_containing(other_loc,
4578
possible_transports)
4631
possible_transports)
4579
4632
if base_loc == other_loc:
4580
4633
base_branch = other_branch
4582
4635
base_branch, base_path = Branch.open_containing(base_loc,
4583
possible_transports)
4636
possible_transports)
4584
4637
# Find the revision ids
4585
4638
other_revision_id = None
4586
4639
base_revision_id = None
4598
4651
# - user ask to remember or there is no previous location set to merge
4599
4652
# from and user didn't ask to *not* remember
4600
4653
if (user_location is not None
4602
or (remember is None
4603
and tree.branch.get_submit_branch() is None)))):
4655
(remember is None and
4656
tree.branch.get_submit_branch() is None)))):
4604
4657
tree.branch.set_submit_branch(other_branch.base)
4605
4658
# Merge tags (but don't set them in the master branch yet, the user
4606
4659
# might revert this merge). Commit will propagate them.
4607
4660
other_branch.tags.merge_to(tree.branch.tags, ignore_master=True)
4608
4661
merger = _mod_merge.Merger.from_revision_ids(tree,
4609
other_revision_id, base_revision_id, other_branch, base_branch)
4662
other_revision_id, base_revision_id, other_branch, base_branch)
4610
4663
if other_path != '':
4611
4664
allow_pending = False
4612
4665
merger.interesting_files = [other_path]
4944
4998
custom_help('revision',
4945
help='Filter on other branch revisions (inclusive). '
4946
'See "help revisionspec" for details.'),
4999
help='Filter on other branch revisions (inclusive). '
5000
'See "help revisionspec" for details.'),
4947
5001
Option('my-revision',
4948
type=_parse_revision_str,
4949
help='Filter on local branch revisions (inclusive). '
4950
'See "help revisionspec" for details.'),
5002
type=_parse_revision_str,
5003
help='Filter on local branch revisions (inclusive). '
5004
'See "help revisionspec" for details.'),
4951
5005
Option('include-merged',
4952
5006
'Show all revisions in addition to the mainline ones.'),
4953
5007
Option('include-merges', hidden=True,
5221
5278
# If there is a tree and we're not annotating historical
5222
5279
# versions, annotate the working tree's content.
5223
5280
annotate_file_tree(wt, relpath, self.outf, long, all,
5224
show_ids=show_ids, file_id=file_id)
5226
5283
annotate_file_tree(tree, relpath, self.outf, long, all,
5227
show_ids=show_ids, branch=branch, file_id=file_id)
5284
show_ids=show_ids, branch=branch)
5230
5287
class cmd_re_sign(Command):
5231
5288
__doc__ = """Create a digital signature for an existing revision."""
5232
5289
# TODO be able to replace existing ones.
5234
hidden = True # is this right ?
5291
hidden = True # is this right ?
5235
5292
takes_args = ['revision_id*']
5236
5293
takes_options = ['directory', 'revision']
5238
5295
def run(self, revision_id_list=None, revision=None, directory=u'.'):
5239
5296
if revision_id_list is not None and revision is not None:
5240
raise errors.BzrCommandError(gettext('You can only supply one of revision_id or --revision'))
5297
raise errors.BzrCommandError(
5298
gettext('You can only supply one of revision_id or --revision'))
5241
5299
if revision_id_list is None and revision is None:
5242
raise errors.BzrCommandError(gettext('You must supply either --revision or a revision_id'))
5300
raise errors.BzrCommandError(
5301
gettext('You must supply either --revision or a revision_id'))
5243
5302
b = WorkingTree.open_containing(directory)[0].branch
5244
5303
self.add_cleanup(b.lock_write().unlock)
5245
5304
return self._run(b, revision_id_list, revision)
5277
5336
if to_revid is None:
5278
5337
to_revno = b.revno()
5279
5338
if from_revno is None or to_revno is None:
5280
raise errors.BzrCommandError(gettext('Cannot sign a range of non-revision-history revisions'))
5339
raise errors.BzrCommandError(
5340
gettext('Cannot sign a range of non-revision-history revisions'))
5281
5341
b.repository.start_write_group()
5283
5343
for revno in range(from_revno, to_revno + 1):
5284
5344
b.repository.sign_revision(b.get_rev_id(revno),
5346
except BaseException:
5287
5347
b.repository.abort_write_group()
5290
5350
b.repository.commit_write_group()
5292
raise errors.BzrCommandError(gettext('Please supply either one revision, or a range.'))
5352
raise errors.BzrCommandError(
5353
gettext('Please supply either one revision, or a range.'))
5295
5356
class cmd_bind(Command):
5374
5437
# information in shared branches as well.
5375
5438
_see_also = ['commit']
5376
5439
takes_options = ['verbose', 'revision',
5377
Option('dry-run', help='Don\'t actually make changes.'),
5378
Option('force', help='Say yes to all questions.'),
5380
help='Keep tags that point to removed revisions.'),
5382
help="Only remove the commits from the local branch"
5383
" when in a checkout."
5440
Option('dry-run', help='Don\'t actually make changes.'),
5441
Option('force', help='Say yes to all questions.'),
5443
help='Keep tags that point to removed revisions.'),
5445
help="Only remove the commits from the local "
5446
"branch when in a checkout."
5386
5449
takes_args = ['location?']
5388
5451
encoding_type = 'replace'
5532
5598
help='Serve on stdin/out for use from inetd or sshd.'),
5533
5599
RegistryOption('protocol',
5534
help="Protocol to serve.",
5535
lazy_registry=('breezy.transport', 'transport_server_registry'),
5536
value_switches=True),
5600
help="Protocol to serve.",
5601
lazy_registry=('breezy.transport',
5602
'transport_server_registry'),
5603
value_switches=True),
5537
5604
Option('listen',
5538
help='Listen for connections on nominated address.', type=text_type),
5605
help='Listen for connections on nominated address.',
5540
5608
help='Listen for connections on nominated port. Passing 0 as '
5541
5609
'the port number will result in a dynamically allocated '
5542
5610
'port. The default port depends on the protocol.',
5544
5612
custom_help('directory',
5545
help='Serve contents of this directory.'),
5613
help='Serve contents of this directory.'),
5546
5614
Option('allow-writes',
5547
5615
help='By default the server is a readonly server. Supplying '
5548
5616
'--allow-writes enables write access to the contents of '
5796
5867
If the preferred client can't be found (or used), your editor will be used.
5798
5869
To use a specific mail program, set the mail_client configuration option.
5799
(For Thunderbird 1.5, this works around some bugs.) Supported values for
5800
specific clients are "claws", "evolution", "kmail", "mail.app" (MacOS X's
5801
Mail.app), "mutt", and "thunderbird"; generic options are "default",
5802
"editor", "emacsclient", "mapi", and "xdg-email". Plugins may also add
5870
Supported values for specific clients are "claws", "evolution", "kmail",
5871
"mail.app" (MacOS X's Mail.app), "mutt", and "thunderbird"; generic options
5872
are "default", "editor", "emacsclient", "mapi", and "xdg-email". Plugins
5873
may also add supported clients.
5805
5875
If mail is being sent, a to address is required. This can be supplied
5806
5876
either on the commandline, by setting the submit_to configuration
5807
5877
option in the branch itself or the child_submit_to configuration option
5808
5878
in the submit branch.
5810
Two formats are currently supported: "4" uses revision bundle format 4 and
5811
merge directive format 2. It is significantly faster and smaller than
5812
older formats. It is compatible with Bazaar 0.19 and later. It is the
5813
default. "0.9" uses revision bundle format 0.9 and merge directive
5814
format 1. It is compatible with Bazaar 0.12 - 0.18.
5816
5880
The merge directives created by brz send may be applied using brz merge or
5817
5881
brz pull by specifying a file containing a merge directive as the location.
5937
5995
from .send import send
5938
5996
return send(submit_branch, revision, public_branch, remember,
5939
format, no_bundle, no_patch, output,
5940
kwargs.get('from', '.'), None, None, None,
5941
self.outf, strict=strict)
5997
format, no_bundle, no_patch, output,
5998
kwargs.get('from', '.'), None, None, None,
5999
self.outf, strict=strict)
5944
6002
class cmd_tag(Command):
6144
6202
help='Whether new branches in the repository have trees.',
6145
6203
value_switches=True, enum_switch=False,
6146
6204
with_trees='Reconfigure repository to create '
6147
'working trees on branches by default.',
6205
'working trees on branches by default.',
6148
6206
with_no_trees='Reconfigure repository to not create '
6149
'working trees on branches by default.'
6207
'working trees on branches by default.'
6151
6209
Option('bind-to', help='Branch to bind checkout to.', type=text_type),
6152
6210
Option('force',
6153
help='Perform reconfiguration even if local changes'
6211
help='Perform reconfiguration even if local changes'
6155
6213
Option('stacked-on',
6156
help='Reconfigure a branch to be stacked on another branch.',
6214
help='Reconfigure a branch to be stacked on another branch.',
6159
6217
Option('unstacked',
6160
help='Reconfigure a branch to be unstacked. This '
6161
'may require copying substantial data into it.',
6218
help='Reconfigure a branch to be unstacked. This '
6219
'may require copying substantial data into it.',
6165
6223
def run(self, location=None, bind_to=None, force=False,
6241
6300
takes_args = ['to_location?']
6242
6301
takes_options = ['directory',
6243
6302
Option('force',
6244
help='Switch even if local commits will be lost.'),
6303
help='Switch even if local commits will be lost.'),
6246
6305
Option('create-branch', short_name='b',
6247
help='Create the target branch from this one before'
6248
' switching to it.'),
6306
help='Create the target branch from this one before'
6307
' switching to it.'),
6249
6308
Option('store',
6250
help='Store and restore uncommitted changes in the'
6309
help='Store and restore uncommitted changes in the'
6254
6313
def run(self, to_location=None, force=False, create_branch=False,
6255
6314
revision=None, directory=u'.', store=False):
6275
6334
if branch is None:
6276
6335
raise errors.BzrCommandError(
6277
6336
gettext('cannot create branch without source branch'))
6278
to_location = lookup_new_sibling_branch(control_dir, to_location,
6279
possible_transports=possible_transports)
6280
to_branch = branch.controldir.sprout(to_location,
6281
possible_transports=possible_transports,
6282
source_branch=branch).open_branch()
6337
to_location = lookup_new_sibling_branch(
6338
control_dir, to_location,
6339
possible_transports=possible_transports)
6340
if revision is not None:
6341
revision = revision.as_revision_id(branch)
6342
to_branch = branch.controldir.sprout(
6344
possible_transports=possible_transports,
6345
revision_id=revision,
6346
source_branch=branch).open_branch()
6285
6349
to_branch = Branch.open(to_location,
6286
possible_transports=possible_transports)
6350
possible_transports=possible_transports)
6287
6351
except errors.NotBranchError:
6288
to_branch = open_sibling_branch(control_dir, to_location,
6352
to_branch = open_sibling_branch(
6353
control_dir, to_location,
6289
6354
possible_transports=possible_transports)
6290
if revision is not None:
6291
revision = revision.as_revision_id(to_branch)
6355
if revision is not None:
6356
revision = revision.as_revision_id(to_branch)
6293
6358
switch.switch(control_dir, to_branch, force, revision_id=revision,
6294
6359
store_uncommitted=store)
6295
6360
except controldir.BranchReferenceLoop:
6296
6361
raise errors.BzrCommandError(
6297
gettext('switching would create a branch reference loop. '
6298
'Use the "bzr up" command to switch to a '
6299
'different revision.'))
6362
gettext('switching would create a branch reference loop. '
6363
'Use the "bzr up" command to switch to a '
6364
'different revision.'))
6300
6365
if had_explicit_nick:
6301
branch = control_dir.open_branch() #get the new branch!
6366
branch = control_dir.open_branch() # get the new branch!
6302
6367
branch.nick = to_branch.nick
6303
6368
note(gettext('Switched to branch: %s'),
6304
urlutils.unescape_for_display(to_branch.base, 'utf-8'))
6369
urlutils.unescape_for_display(to_branch.base, 'utf-8'))
6308
6372
class cmd_view(Command):
6421
6486
"Both --switch and --all specified"))
6422
6487
elif switch == 'off':
6423
6488
if current_view is None:
6424
raise errors.BzrCommandError(gettext("No current view to disable"))
6489
raise errors.BzrCommandError(
6490
gettext("No current view to disable"))
6425
6491
tree.views.set_view_info(None, view_dict)
6426
self.outf.write(gettext("Disabled '%s' view.\n") % (current_view))
6492
self.outf.write(gettext("Disabled '%s' view.\n") %
6428
6495
tree.views.set_view_info(switch, view_dict)
6429
6496
view_str = views.view_display_str(tree.views.lookup_view())
6430
self.outf.write(gettext("Using '{0}' view: {1}\n").format(switch, view_str))
6498
gettext("Using '{0}' view: {1}\n").format(switch, view_str))
6433
6501
self.outf.write(gettext('Views defined:\n'))
6804
6875
# register lazy builtins from other modules; called at startup and should
6805
6876
# be only called once.
6806
6877
for (name, aliases, module_name) in [
6807
('cmd_bisect', [], 'breezy.bisect'),
6808
('cmd_bundle_info', [], 'breezy.bundle.commands'),
6809
('cmd_config', [], 'breezy.config'),
6810
('cmd_dump_btree', [], 'breezy.bzr.debug_commands'),
6811
('cmd_version_info', [], 'breezy.cmd_version_info'),
6812
('cmd_resolve', ['resolved'], 'breezy.conflicts'),
6813
('cmd_conflicts', [], 'breezy.conflicts'),
6814
('cmd_ping', [], 'breezy.bzr.smart.ping'),
6815
('cmd_sign_my_commits', [], 'breezy.commit_signature_commands'),
6816
('cmd_verify_signatures', [], 'breezy.commit_signature_commands'),
6817
('cmd_test_script', [], 'breezy.cmd_test_script'),
6878
('cmd_bisect', [], 'breezy.bisect'),
6879
('cmd_bundle_info', [], 'breezy.bundle.commands'),
6880
('cmd_config', [], 'breezy.config'),
6881
('cmd_dump_btree', [], 'breezy.bzr.debug_commands'),
6882
('cmd_version_info', [], 'breezy.cmd_version_info'),
6883
('cmd_resolve', ['resolved'], 'breezy.conflicts'),
6884
('cmd_conflicts', [], 'breezy.conflicts'),
6885
('cmd_ping', [], 'breezy.bzr.smart.ping'),
6886
('cmd_sign_my_commits', [], 'breezy.commit_signature_commands'),
6887
('cmd_verify_signatures', [], 'breezy.commit_signature_commands'),
6888
('cmd_test_script', [], 'breezy.cmd_test_script'),
6819
6890
builtin_command_registry.register_lazy(name, aliases, module_name)