65
63
from breezy.branch import Branch
66
from breezy.conflicts import ConflictList
67
64
from breezy.transport import memory
68
65
from breezy.smtp_connection import SMTPConnection
69
66
from breezy.workingtree import WorkingTree
221
212
if ref_branch is None or ref_branch.name:
222
213
if ref_branch is not None:
223
214
control_dir = ref_branch.controldir
224
for name, branch in viewitems(control_dir.get_branches()):
215
for name, branch in control_dir.get_branches().items():
225
216
yield name, branch
227
218
repo = ref_branch.controldir.find_repository()
404
395
from .status import show_tree_status
406
397
if revision and len(revision) > 2:
407
raise errors.BzrCommandError(
398
raise errors.CommandError(
408
399
gettext('brz status --revision takes exactly'
409
400
' one or two revision specifiers'))
450
441
def run(self, revision_id=None, revision=None, directory=u'.'):
451
442
if revision_id is not None and revision is not None:
452
raise errors.BzrCommandError(gettext('You can only supply one of'
443
raise errors.CommandError(gettext('You can only supply one of'
453
444
' revision_id or --revision'))
454
445
if revision_id is None and revision is None:
455
raise errors.BzrCommandError(
446
raise errors.CommandError(
456
447
gettext('You must supply either --revision or a revision_id'))
458
449
b = controldir.ControlDir.open_containing_tree_or_branch(directory)[1]
460
451
revisions = getattr(b.repository, "revisions", None)
461
452
if revisions is None:
462
raise errors.BzrCommandError(
453
raise errors.CommandError(
463
454
gettext('Repository %r does not support '
464
455
'access to raw revision texts') % b.repository)
474
465
"The repository {0} contains no revision {1}.").format(
475
466
b.repository.base, revision_id.decode('utf-8'))
476
raise errors.BzrCommandError(msg)
467
raise errors.CommandError(msg)
477
468
elif revision is not None:
478
469
for rev in revision:
480
raise errors.BzrCommandError(
471
raise errors.CommandError(
481
472
gettext('You cannot specify a NULL revision.'))
482
473
rev_id = rev.as_revision_id(b)
483
474
self.print_revision(revisions, rev_id)
510
501
working = d.open_workingtree()
511
502
except errors.NoWorkingTree:
512
raise errors.BzrCommandError(
503
raise errors.CommandError(
513
504
gettext("No working tree to remove"))
514
505
except errors.NotLocalUrl:
515
raise errors.BzrCommandError(
506
raise errors.CommandError(
516
507
gettext("You cannot remove the working tree"
517
508
" of a remote path"))
522
513
raise errors.ShelvedChanges(working)
524
515
if working.user_url != working.branch.user_url:
525
raise errors.BzrCommandError(
516
raise errors.CommandError(
526
517
gettext("You cannot remove the working tree"
527
518
" from a lightweight checkout"))
563
554
pass # There seems to be a real error here, so we'll reset
566
raise errors.BzrCommandError(gettext(
557
raise errors.CommandError(gettext(
567
558
'The tree does not appear to be corrupt. You probably'
568
559
' want "brz revert" instead. Use "--force" if you are'
569
560
' sure you want to reset the working tree.'))
600
591
def run(self, tree=False, location=u'.', revision=None):
601
592
if revision is not None and tree:
602
raise errors.BzrCommandError(
593
raise errors.CommandError(
603
594
gettext("--tree and --revision can not be used together"))
615
606
self.enter_context(b.lock_read())
617
608
if len(revision) != 1:
618
raise errors.BzrCommandError(gettext(
609
raise errors.CommandError(gettext(
619
610
"Revision numbers only make sense for single "
620
611
"revisions, not ranges"))
621
612
revid = revision[0].as_revision_id(b)
879
870
def run(self, revision=None, show_ids=False, kind=None, include_root=False,
881
872
if kind and kind not in ['file', 'directory', 'symlink']:
882
raise errors.BzrCommandError(
873
raise errors.CommandError(
883
874
gettext('invalid kind %r specified') % (kind,))
885
876
revision = _get_one_revision('inventory', revision)
942
933
if names_list is None:
944
935
if len(names_list) < 2:
945
raise errors.BzrCommandError(gettext("missing file argument"))
936
raise errors.CommandError(gettext("missing file argument"))
946
937
tree, rel_names = WorkingTree.open_containing_paths(
947
938
names_list, canonicalize=False)
948
939
for file_name in rel_names[0:-1]:
949
940
if file_name == '':
950
raise errors.BzrCommandError(
941
raise errors.CommandError(
951
942
gettext("can not copy root of branch"))
952
943
self.enter_context(tree.lock_tree_write())
953
944
into_existing = osutils.isdir(names_list[-1])
970
961
src_kind = tree.stored_kind(src)
971
962
except errors.NoSuchFile:
972
raise errors.BzrCommandError(
963
raise errors.CommandError(
973
964
gettext('Could not copy %s => %s: %s is not versioned.')
974
965
% (src, dst, src))
975
966
if src_kind is None:
976
raise errors.BzrCommandError(
967
raise errors.CommandError(
977
968
gettext('Could not copy %s => %s . %s is not versioned\\.'
978
969
% (src, dst, src)))
979
970
if src_kind == 'directory':
980
raise errors.BzrCommandError(
971
raise errors.CommandError(
981
972
gettext('Could not copy %s => %s . %s is a directory.'
982
973
% (src, dst, src)))
983
974
dst_parent = osutils.split(dst)[0]
986
977
dst_parent_kind = tree.stored_kind(dst_parent)
987
978
except errors.NoSuchFile:
988
raise errors.BzrCommandError(
979
raise errors.CommandError(
989
980
gettext('Could not copy %s => %s: %s is not versioned.')
990
981
% (src, dst, dst_parent))
991
982
if dst_parent_kind != 'directory':
992
raise errors.BzrCommandError(
983
raise errors.CommandError(
993
984
gettext('Could not copy to %s: %s is not a directory.')
994
985
% (dst_parent, dst_parent))
1032
1023
return self.run_auto(names_list, after, dry_run)
1034
raise errors.BzrCommandError(gettext('--dry-run requires --auto.'))
1025
raise errors.CommandError(gettext('--dry-run requires --auto.'))
1035
1026
if names_list is None:
1036
1027
names_list = []
1037
1028
if len(names_list) < 2:
1038
raise errors.BzrCommandError(gettext("missing file argument"))
1029
raise errors.CommandError(gettext("missing file argument"))
1039
1030
tree, rel_names = WorkingTree.open_containing_paths(
1040
1031
names_list, canonicalize=False)
1041
1032
for file_name in rel_names[0:-1]:
1042
1033
if file_name == '':
1043
raise errors.BzrCommandError(
1034
raise errors.CommandError(
1044
1035
gettext("can not move root of branch"))
1045
1036
self.enter_context(tree.lock_tree_write())
1046
1037
self._run(tree, names_list, rel_names, after)
1048
1039
def run_auto(self, names_list, after, dry_run):
1049
1040
if names_list is not None and len(names_list) > 1:
1050
raise errors.BzrCommandError(
1041
raise errors.CommandError(
1051
1042
gettext('Only one path may be specified to --auto.'))
1053
raise errors.BzrCommandError(
1044
raise errors.CommandError(
1054
1045
gettext('--after cannot be specified with --auto.'))
1055
1046
work_tree, file_list = WorkingTree.open_containing_paths(
1056
1047
names_list, default_directory='.')
1087
1078
self.outf.write("%s => %s\n" % (src, dest))
1089
1080
if len(names_list) != 2:
1090
raise errors.BzrCommandError(gettext('to mv multiple files the'
1081
raise errors.CommandError(gettext('to mv multiple files the'
1091
1082
' destination must be a versioned'
1230
1221
stored_loc = branch_to.get_parent()
1231
1222
if location is None:
1232
1223
if stored_loc is None:
1233
raise errors.BzrCommandError(gettext("No pull location known or"
1224
raise errors.CommandError(gettext("No pull location known or"
1234
1225
" specified."))
1236
1227
display_url = urlutils.unescape_for_display(stored_loc,
1243
1234
revision = _get_one_revision('pull', revision)
1244
1235
if mergeable is not None:
1245
1236
if revision is not None:
1246
raise errors.BzrCommandError(gettext(
1237
raise errors.CommandError(gettext(
1247
1238
'Cannot use -r with merge directives or bundles'))
1248
1239
mergeable.install_revisions(branch_to.repository)
1249
1240
base_revision_id, revision_id, verified = \
1336
1327
help='Create a stacked branch that refers to another branch '
1337
1328
'for the commit history. Only the work not present in the '
1338
1329
'referenced branch is included in the branch created.',
1340
1331
Option('strict',
1341
1332
help='Refuse to push if there are uncommitted changes in'
1342
1333
' the working tree, --no-strict disables the check.'),
1398
1389
# error by the feedback given to them. RBC 20080227.
1399
1390
stacked_on = parent_url
1400
1391
if not stacked_on:
1401
raise errors.BzrCommandError(gettext(
1392
raise errors.CommandError(gettext(
1402
1393
"Could not determine branch to refer to."))
1404
1395
# Get the destination location
1407
1398
if stored_loc is None:
1408
1399
parent_loc = br_from.get_parent()
1410
raise errors.BzrCommandError(gettext(
1401
raise errors.CommandError(gettext(
1411
1402
"No push location known or specified. To push to the "
1412
1403
"parent branch (at %s), use 'brz push :parent'." %
1413
1404
urlutils.unescape_for_display(parent_loc,
1414
1405
self.outf.encoding)))
1416
raise errors.BzrCommandError(gettext(
1407
raise errors.CommandError(gettext(
1417
1408
"No push location known or specified."))
1419
1410
display_url = urlutils.unescape_for_display(stored_loc,
1448
1439
takes_options = ['revision',
1450
1441
'hardlink', help='Hard-link working tree files where possible.'),
1451
Option('files-from', type=text_type,
1442
Option('files-from', type=str,
1452
1443
help="Get file contents from this tree."),
1453
1444
Option('no-tree',
1454
1445
help="Create a branch without a working-tree."),
1525
1516
raise errors.AlreadyBranchError(to_location)
1526
1517
except errors.NoSuchFile:
1527
raise errors.BzrCommandError(gettext('Parent of "%s" does not exist.')
1518
raise errors.CommandError(gettext('Parent of "%s" does not exist.')
1545
1536
to_transport.delete_tree('.')
1546
1537
msg = gettext("The branch {0} has no revision {1}.").format(
1547
1538
from_location, revision)
1548
raise errors.BzrCommandError(msg)
1539
raise errors.CommandError(msg)
1551
1542
to_repo = to_dir.open_repository()
1602
1593
t = transport.get_transport(location, purpose='read')
1603
1594
if not t.listable():
1604
raise errors.BzrCommandError(
1595
raise errors.CommandError(
1605
1596
"Can't scan this type of location.")
1606
1597
for b in controldir.ControlDir.find_branches(t):
1607
1598
self.outf.write("%s\n" % urlutils.unescape_for_display(
1622
1613
names[name] = active
1623
1614
# Only mention the current branch explicitly if it's not
1624
1615
# one of the colocated branches
1625
if not any(viewvalues(names)) and active_branch is not None:
1616
if not any(names.values()) and active_branch is not None:
1626
1617
self.outf.write("* %s\n" % gettext("(default)"))
1627
1618
for name in sorted(names):
1628
1619
active = names[name]
1633
self.outf.write("%s %s\n" % (
1634
prefix, (name if PY3 else name.encode(self.outf.encoding))))
1624
self.outf.write("%s %s\n" % (prefix, name))
1637
1627
class cmd_checkout(Command):
1665
1655
"common operations like diff and status without "
1666
1656
"such access, and also support local commits."
1668
Option('files-from', type=text_type,
1658
Option('files-from', type=str,
1669
1659
help="Get file contents from this tree."),
1670
1660
Option('hardlink',
1671
1661
help='Hard-link working tree files where possible.'
1808
1798
def run(self, dir=None, revision=None, show_base=None):
1809
1799
if revision is not None and len(revision) != 1:
1810
raise errors.BzrCommandError(gettext(
1800
raise errors.CommandError(gettext(
1811
1801
"brz update --revision takes exactly one revision"))
1812
1802
if dir is None:
1813
1803
tree = WorkingTree.open_containing('.')[0]
1815
1805
tree, relpath = WorkingTree.open_containing(dir)
1817
1807
# See bug 557886.
1818
raise errors.BzrCommandError(gettext(
1808
raise errors.CommandError(gettext(
1819
1809
"brz update can only update a whole tree, "
1820
1810
"not a file or subdirectory"))
1821
1811
branch = tree.branch
1861
1851
old_tip=old_tip,
1862
1852
show_base=show_base)
1863
1853
except errors.NoSuchRevision as e:
1864
raise errors.BzrCommandError(gettext(
1854
raise errors.CommandError(gettext(
1865
1855
"branch has no revision %s\n"
1866
1856
"brz update --revision only works"
1867
1857
" for a revision in the branch history")
1963
1953
specific_files=file_list).added
1964
1954
file_list = sorted([f.path[1] for f in added], reverse=True)
1965
1955
if len(file_list) == 0:
1966
raise errors.BzrCommandError(gettext('No matching files.'))
1956
raise errors.CommandError(gettext('No matching files.'))
1967
1957
elif file_list is None:
1968
1958
# missing files show up in iter_changes(basis) as
1969
1959
# versioned-with-no-kind.
2125
2115
to_transport.ensure_base()
2126
2116
except errors.NoSuchFile:
2127
2117
if not create_prefix:
2128
raise errors.BzrCommandError(gettext("Parent directory of %s"
2118
raise errors.CommandError(gettext("Parent directory of %s"
2129
2119
" does not exist."
2130
2120
"\nYou may supply --create-prefix to create all"
2131
2121
" leading parent directories.")
2161
2151
branch.set_append_revisions_only(True)
2162
2152
except errors.UpgradeRequired:
2163
raise errors.BzrCommandError(gettext('This branch format cannot be set'
2153
raise errors.CommandError(gettext('This branch format cannot be set'
2164
2154
' to append-revisions-only. Try --default.'))
2165
2155
if not is_quiet():
2166
2156
from .info import describe_layout, describe_format
2341
2331
_see_also = ['status']
2342
2332
takes_args = ['file*']
2343
2333
takes_options = [
2344
Option('diff-options', type=text_type,
2334
Option('diff-options', type=str,
2345
2335
help='Pass these options to the external diff program.'),
2346
Option('prefix', type=text_type,
2336
Option('prefix', type=str,
2347
2337
short_name='p',
2348
2338
help='Set prefixes added to old and new filenames, as '
2349
2339
'two values separated by a colon. (eg "old/:new/").'),
2351
2341
help='Branch/tree to compare from.',
2355
2345
help='Branch/tree to compare to.',
2360
2350
Option('using',
2361
2351
help='Use this command to compare files.',
2364
2354
RegistryOption('format',
2365
2355
short_name='F',
2404
2394
elif u':' in prefix:
2405
2395
old_label, new_label = prefix.split(u":")
2407
raise errors.BzrCommandError(gettext(
2397
raise errors.CommandError(gettext(
2408
2398
'--prefix expects two values separated by a colon'
2409
2399
' (eg "old/:new/")'))
2411
2401
if revision and len(revision) > 2:
2412
raise errors.BzrCommandError(gettext('brz diff --revision takes exactly'
2402
raise errors.CommandError(gettext('brz diff --revision takes exactly'
2413
2403
' one or two revision specifiers'))
2415
2405
if using is not None and format is not None:
2416
raise errors.BzrCommandError(gettext(
2406
raise errors.CommandError(gettext(
2417
2407
'{0} and {1} are mutually exclusive').format(
2418
2408
'--using', '--format'))
2760
2750
short_name='m',
2761
2751
help='Show revisions whose properties match this '
2764
2754
ListOption('match-message',
2765
2755
help='Show revisions whose message matches this '
2768
2758
ListOption('match-committer',
2769
2759
help='Show revisions whose committer matches this '
2772
2762
ListOption('match-author',
2773
2763
help='Show revisions whose authors match this '
2776
2766
ListOption('match-bugs',
2777
2767
help='Show revisions whose bugs match this '
2781
2771
encoding_type = 'replace'
2813
2803
include_merged = False
2814
2804
if (exclude_common_ancestry
2815
2805
and (revision is None or len(revision) != 2)):
2816
raise errors.BzrCommandError(gettext(
2806
raise errors.CommandError(gettext(
2817
2807
'--exclude-common-ancestry requires -r with two revisions'))
2818
2808
if include_merged:
2819
2809
if levels is None:
2822
raise errors.BzrCommandError(gettext(
2812
raise errors.CommandError(gettext(
2823
2813
'{0} and {1} are mutually exclusive').format(
2824
2814
'--levels', '--include-merged'))
2827
2817
if len(change) > 1:
2828
2818
raise errors.RangeInChangeOption()
2829
2819
if revision is not None:
2830
raise errors.BzrCommandError(gettext(
2820
raise errors.CommandError(gettext(
2831
2821
'{0} and {1} are mutually exclusive').format(
2832
2822
'--revision', '--change'))
2834
2824
revision = change
2837
2827
filter_by_dir = False
2839
2829
# find the file ids to log and check for directory filtering
2840
2830
b, file_info_list, rev1, rev2 = _get_info_for_log_files(
2841
2831
revision, file_list, self._exit_stack)
2842
for relpath, file_id, kind in file_info_list:
2844
raise errors.BzrCommandError(gettext(
2832
for relpath, kind in file_info_list:
2834
raise errors.CommandError(gettext(
2845
2835
"Path unknown at end or start of revision range: %s") %
2847
2837
# If the relpath is the top of the tree, we log everything
2848
2838
if relpath == '':
2852
file_ids.append(file_id)
2842
files.append(relpath)
2853
2843
filter_by_dir = filter_by_dir or (
2854
2844
kind in ['directory', 'tree-reference'])
2912
2902
# original algorithm - per-file-graph - for the "single
2913
2903
# file that isn't a directory without showing a delta" case.
2914
2904
partial_history = revision and b.repository._format.supports_chks
2915
match_using_deltas = (len(file_ids) != 1 or filter_by_dir
2905
match_using_deltas = (len(files) != 1 or filter_by_dir
2916
2906
or delta_type or partial_history)
2918
2908
match_dict = {}
2928
2918
match_dict['bugs'] = match_bugs
2930
2920
# Build the LogRequest and execute it
2931
if len(file_ids) == 0:
2933
2923
rqst = make_log_request_dict(
2934
direction=direction, specific_fileids=file_ids,
2924
direction=direction, specific_files=files,
2935
2925
start_revision=rev1, end_revision=rev2, limit=limit,
2936
2926
message_search=message, delta_type=delta_type,
2937
2927
diff_type=diff_type, _match_using_deltas=match_using_deltas,
2959
2949
# b is taken from revision[0].get_branch(), and
2960
2950
# show_log will use its revision_history. Having
2961
2951
# different branches will lead to weird behaviors.
2962
raise errors.BzrCommandError(gettext(
2952
raise errors.CommandError(gettext(
2963
2953
"brz %s doesn't accept two revisions in different"
2964
2954
" branches.") % command_name)
2965
2955
if start_spec.spec is None:
3042
3032
Option('kind', short_name='k',
3043
3033
help=('List entries of a particular kind: file, '
3044
3034
'directory, symlink, tree-reference.'),
3055
3045
null=False, kind=None, show_ids=False, path=None, directory=None):
3057
3047
if kind and kind not in ('file', 'directory', 'symlink', 'tree-reference'):
3058
raise errors.BzrCommandError(gettext('invalid kind specified'))
3048
raise errors.CommandError(gettext('invalid kind specified'))
3060
3050
if verbose and null:
3061
raise errors.BzrCommandError(
3051
raise errors.CommandError(
3062
3052
gettext('Cannot set both --verbose and --null'))
3063
3053
all = not (unknown or versioned or ignored)
3245
3235
self.outf.write("%s\n" % pattern)
3247
3237
if not name_pattern_list:
3248
raise errors.BzrCommandError(gettext("ignore requires at least one "
3238
raise errors.CommandError(gettext("ignore requires at least one "
3249
3239
"NAME_PATTERN or --default-rules."))
3250
3240
name_pattern_list = [globbing.normalize_pattern(p)
3251
3241
for p in name_pattern_list]
3264
3254
for name_pattern in name_pattern_list:
3265
3255
if (name_pattern[0] == '/' or
3266
3256
(len(name_pattern) > 1 and name_pattern[1] == ':')):
3267
raise errors.BzrCommandError(gettext(
3257
raise errors.CommandError(gettext(
3268
3258
"NAME_PATTERN should not be an absolute path"))
3269
3259
tree, relpath = WorkingTree.open_containing(directory)
3270
3260
ignores.tree_ignores_add_patterns(tree, name_pattern_list)
3326
3316
revno = int(revno)
3327
3317
except ValueError:
3328
raise errors.BzrCommandError(gettext("not a valid revision-number: %r")
3318
raise errors.CommandError(gettext("not a valid revision-number: %r")
3330
3320
revid = WorkingTree.open_containing(
3331
3321
directory)[0].branch.get_rev_id(revno)
3366
3356
takes_options = ['directory',
3367
3357
Option('format',
3368
3358
help="Type of file to export to.",
3371
3361
Option('filters', help='Apply content filters to export the '
3372
3362
'convenient form.'),
3375
3365
help="Name of the root directory inside the exported file."),
3376
3366
Option('per-file-timestamps',
3377
3367
help='Set modification time of files to that of the last '
3424
3414
export(export_tree, dest, format, root, subdir,
3425
3415
per_file_timestamps=per_file_timestamps)
3426
3416
except errors.NoSuchExportFormat as e:
3427
raise errors.BzrCommandError(
3417
raise errors.CommandError(
3428
3418
gettext('Unsupported export format: %s') % e.format)
3452
3442
def run(self, filename, revision=None, name_from_revision=False,
3453
3443
filters=False, directory=None):
3454
3444
if revision is not None and len(revision) != 1:
3455
raise errors.BzrCommandError(gettext("brz cat --revision takes exactly"
3445
raise errors.CommandError(gettext("brz cat --revision takes exactly"
3456
3446
" one revision specifier"))
3457
3447
tree, branch, relpath = \
3458
3448
_open_directory_or_containing_tree_or_branch(filename, directory)
3471
3461
if name_from_revision:
3472
3462
# Try in revision if requested
3473
3463
if not rev_tree.is_versioned(relpath):
3474
raise errors.BzrCommandError(gettext(
3464
raise errors.CommandError(gettext(
3475
3465
"{0!r} is not present in revision {1}").format(
3476
3466
filename, rev_tree.get_revision_id()))
3477
3467
rev_tree_path = relpath
3485
3475
if rev_tree_path is None:
3486
3476
# Path didn't exist in working tree
3487
3477
if not rev_tree.is_versioned(relpath):
3488
raise errors.BzrCommandError(gettext(
3478
raise errors.CommandError(gettext(
3489
3479
"{0!r} is not present in revision {1}").format(
3490
3480
filename, rev_tree.get_revision_id()))
3573
3563
takes_args = ['selected*']
3574
3564
takes_options = [
3576
'exclude', type=text_type, short_name='x',
3566
'exclude', type=str, short_name='x',
3577
3567
help="Do not consider changes made to a given path."),
3578
Option('message', type=text_type,
3568
Option('message', type=str,
3579
3569
short_name='m',
3580
3570
help="Description of the new revision."),
3582
3572
Option('unchanged',
3583
3573
help='Commit even if nothing has changed.'),
3584
Option('file', type=text_type,
3574
Option('file', type=str,
3585
3575
short_name='F',
3586
3576
argname='msgfile',
3587
3577
help='Take commit message from this file.'),
3588
3578
Option('strict',
3589
3579
help="Refuse to commit if there are unknown "
3590
3580
"files in the working tree."),
3591
Option('commit-time', type=text_type,
3581
Option('commit-time', type=str,
3592
3582
help="Manually set a commit time using commit date "
3593
3583
"format, e.g. '2009-10-10 08:00:00 +0100'."),
3595
'bugs', type=text_type,
3596
3586
help="Link to a related bug. (see \"brz help bugs\")."),
3598
'fixes', type=text_type,
3599
3589
help="Mark a bug as being fixed by this revision "
3600
3590
"(see \"brz help bugs\")."),
3602
'author', type=text_type,
3603
3593
help="Set the author's name, if it's different "
3604
3594
"from the committer."),
3605
3595
Option('local',
3628
3618
default_bugtracker = branch_config.get(
3630
3620
if default_bugtracker is None:
3631
raise errors.BzrCommandError(gettext(
3621
raise errors.CommandError(gettext(
3632
3622
"No tracker specified for bug %s. Use the form "
3633
3623
"'tracker:id' or specify a default bug tracker "
3634
3624
"using the `bugtracker` option.\nSee "
3637
3627
tag = default_bugtracker
3638
3628
bug_id = tokens[0]
3639
3629
elif len(tokens) != 2:
3640
raise errors.BzrCommandError(gettext(
3630
raise errors.CommandError(gettext(
3641
3631
"Invalid bug %s. Must be in the form of 'tracker:id'. "
3642
3632
"See \"brz help bugs\" for more information on this "
3643
3633
"feature.\nCommit refused.") % bug)
3647
3637
yield bugtracker.get_bug_url(tag, branch, bug_id), status
3648
3638
except bugtracker.UnknownBugTrackerAbbreviation:
3649
raise errors.BzrCommandError(gettext(
3639
raise errors.CommandError(gettext(
3650
3640
'Unrecognized bug %s. Commit refused.') % bug)
3651
3641
except bugtracker.MalformedBugIdentifier as e:
3652
raise errors.BzrCommandError(gettext(
3642
raise errors.CommandError(gettext(
3653
3643
u"%s\nCommit refused.") % (e,))
3655
3645
def run(self, message=None, file=None, verbose=False, selected_list=None,
3677
3667
commit_stamp, offset = timestamp.parse_patch_date(commit_time)
3678
3668
except ValueError as e:
3679
raise errors.BzrCommandError(gettext(
3669
raise errors.CommandError(gettext(
3680
3670
"Could not parse --commit-time: " + str(e)))
3682
3672
properties = {}
3720
3710
message = message.replace('\r\n', '\n')
3721
3711
message = message.replace('\r', '\n')
3723
raise errors.BzrCommandError(gettext(
3713
raise errors.CommandError(gettext(
3724
3714
"please specify either --message or --file"))
3726
3716
def get_message(commit_obj):
3751
3741
my_message = edit_commit_message_encoded(text,
3752
3742
start_message=start_message)
3753
3743
if my_message is None:
3754
raise errors.BzrCommandError(gettext("please specify a commit"
3744
raise errors.CommandError(gettext("please specify a commit"
3755
3745
" message with either --message or --file"))
3756
3746
if my_message == "":
3757
raise errors.BzrCommandError(gettext("Empty commit message specified."
3747
raise errors.CommandError(gettext("Empty commit message specified."
3758
3748
" Please specify a commit message with either"
3759
3749
" --message or --file or leave a blank message"
3760
3750
" with --message \"\"."))
3774
3764
exclude=tree.safe_relpath_files(exclude),
3776
3766
except PointlessCommit:
3777
raise errors.BzrCommandError(gettext("No changes to commit."
3767
raise errors.CommandError(gettext("No changes to commit."
3778
3768
" Please 'brz add' the files you want to commit, or use"
3779
3769
" --unchanged to force an empty commit."))
3780
3770
except ConflictsInTree:
3781
raise errors.BzrCommandError(gettext('Conflicts detected in working '
3771
raise errors.CommandError(gettext('Conflicts detected in working '
3782
3772
'tree. Use "brz conflicts" to list, "brz resolve FILE" to'
3784
3774
except StrictCommitFailed:
3785
raise errors.BzrCommandError(gettext("Commit refused because there are"
3775
raise errors.CommandError(gettext("Commit refused because there are"
3786
3776
" unknown files in the working tree."))
3787
3777
except errors.BoundBranchOutOfDate as e:
3788
3778
e.extra_help = (gettext("\n"
4055
4045
def remove_alias(self, alias_name):
4056
4046
if alias_name is None:
4057
raise errors.BzrCommandError(gettext(
4047
raise errors.CommandError(gettext(
4058
4048
'brz alias --remove expects an alias to remove.'))
4059
4049
# If alias is not found, print something like:
4060
4050
# unalias: foo: not found
4065
4055
def print_aliases(self):
4066
4056
"""Print out the defined aliases in a similar format to bash."""
4067
4057
aliases = _mod_config.GlobalConfig().get_aliases()
4068
for key, value in sorted(viewitems(aliases)):
4058
for key, value in sorted(aliases.items()):
4069
4059
self.outf.write('brz alias %s="%s"\n' % (key, value))
4071
4061
@display_command
4149
4139
return test_server.FakeNFSServer
4150
4140
msg = "No known transport type %s. Supported types are: sftp\n" %\
4152
raise errors.BzrCommandError(msg)
4142
raise errors.CommandError(msg)
4155
4145
takes_args = ['testspecs*']
4182
4172
'breezy.tests', 'parallel_registry'),
4183
4173
value_switches=False,
4185
Option('randomize', type=text_type, argname="SEED",
4175
Option('randomize', type=str, argname="SEED",
4186
4176
help='Randomize the order of tests using the given'
4187
4177
' seed or "now" for the current time.'),
4188
ListOption('exclude', type=text_type, argname="PATTERN",
4178
ListOption('exclude', type=str, argname="PATTERN",
4189
4179
short_name='x',
4190
4180
help='Exclude tests that match this regular'
4191
4181
' expression.'),
4195
4185
help='Output test progress via subunit v2.'),
4196
4186
Option('strict', help='Fail on missing dependencies or '
4197
4187
'known failures.'),
4198
Option('load-list', type=text_type, argname='TESTLISTFILE',
4188
Option('load-list', type=str, argname='TESTLISTFILE',
4199
4189
help='Load a test id list from a text file.'),
4200
ListOption('debugflag', type=text_type, short_name='E',
4190
ListOption('debugflag', type=str, short_name='E',
4201
4191
help='Turn on a selftest debug flag.'),
4202
ListOption('starting-with', type=text_type, argname='TESTID',
4192
ListOption('starting-with', type=str, argname='TESTID',
4203
4193
param_name='starting_with', short_name='s',
4204
4194
help='Load only the tests starting with TESTID.'),
4246
4236
from .tests import SubUnitBzrRunnerv1
4247
4237
except ImportError:
4248
raise errors.BzrCommandError(gettext(
4238
raise errors.CommandError(gettext(
4249
4239
"subunit not available. subunit needs to be installed "
4250
4240
"to use --subunit."))
4251
4241
self.additional_selftest_args['runner_class'] = SubUnitBzrRunnerv1
4263
4253
from .tests import SubUnitBzrRunnerv2
4264
4254
except ImportError:
4265
raise errors.BzrCommandError(gettext(
4255
raise errors.CommandError(gettext(
4266
4256
"subunit not available. subunit "
4267
4257
"needs to be installed to use --subunit2."))
4268
4258
self.additional_selftest_args['runner_class'] = SubUnitBzrRunnerv2
4271
4261
self.additional_selftest_args.setdefault(
4272
4262
'suite_decorators', []).append(parallel)
4274
raise errors.BzrCommandError(gettext(
4264
raise errors.CommandError(gettext(
4275
4265
"--benchmark is no longer supported from brz 2.2; "
4276
4266
"use bzr-usertest instead"))
4277
4267
test_suite_factory = None
4500
4490
tree = WorkingTree.open_containing(directory)[0]
4501
4491
if tree.branch.last_revision() == _mod_revision.NULL_REVISION:
4502
raise errors.BzrCommandError(gettext('Merging into empty branches not currently supported, '
4492
raise errors.CommandError(gettext('Merging into empty branches not currently supported, '
4503
4493
'https://bugs.launchpad.net/bzr/+bug/308562'))
4505
4495
# die as quickly as possible if there are uncommitted changes
4521
4511
mergeable = None
4523
4513
if uncommitted:
4524
raise errors.BzrCommandError(gettext('Cannot use --uncommitted'
4514
raise errors.CommandError(gettext('Cannot use --uncommitted'
4525
4515
' with bundles or merge directives.'))
4527
4517
if revision is not None:
4528
raise errors.BzrCommandError(gettext(
4518
raise errors.CommandError(gettext(
4529
4519
'Cannot use -r with merge directives or bundles'))
4530
4520
merger, verified = _mod_merge.Merger.from_mergeable(tree,
4533
4523
if merger is None and uncommitted:
4534
4524
if revision is not None and len(revision) > 0:
4535
raise errors.BzrCommandError(gettext('Cannot use --uncommitted and'
4525
raise errors.CommandError(gettext('Cannot use --uncommitted and'
4536
4526
' --revision at the same time.'))
4537
4527
merger = self.get_merger_from_uncommitted(tree, location, None)
4538
4528
allow_pending = False
4559
4549
if pull and not preview:
4560
4550
if merger.interesting_files is not None:
4561
raise errors.BzrCommandError(
4551
raise errors.CommandError(
4562
4552
gettext('Cannot pull individual files'))
4563
4553
if (merger.base_rev_id == tree.last_revision()):
4564
4554
result = tree.pull(merger.other_branch, False,
4566
4556
result.report(self.outf)
4568
4558
if merger.this_basis is None:
4569
raise errors.BzrCommandError(gettext(
4559
raise errors.CommandError(gettext(
4570
4560
"This branch has no commits."
4571
4561
" (perhaps you would prefer 'brz pull')"))
4625
4615
def sanity_check_merger(self, merger):
4626
4616
if (merger.show_base and
4627
4617
merger.merge_type is not _mod_merge.Merge3Merger):
4628
raise errors.BzrCommandError(gettext("Show-base is not supported for this"
4618
raise errors.CommandError(gettext("Show-base is not supported for this"
4629
4619
" merge type. %s") % merger.merge_type)
4630
4620
if merger.reprocess is None:
4631
4621
if merger.show_base:
4634
4624
# Use reprocess if the merger supports it
4635
4625
merger.reprocess = merger.merge_type.supports_reprocess
4636
4626
if merger.reprocess and not merger.merge_type.supports_reprocess:
4637
raise errors.BzrCommandError(gettext("Conflict reduction is not supported"
4627
raise errors.CommandError(gettext("Conflict reduction is not supported"
4638
4628
" for merge type %s.") %
4639
4629
merger.merge_type)
4640
4630
if merger.reprocess and merger.show_base:
4641
raise errors.BzrCommandError(gettext("Cannot do conflict reduction and"
4631
raise errors.CommandError(gettext("Cannot do conflict reduction and"
4642
4632
" show base."))
4644
4634
if (merger.merge_type.requires_file_merge_plan and
4646
4636
not getattr(merger.other_tree, 'plan_file_merge', None) or
4647
4637
(merger.base_tree is not None and
4648
4638
not getattr(merger.base_tree, 'plan_file_merge', None)))):
4649
raise errors.BzrCommandError(
4639
raise errors.CommandError(
4650
4640
gettext('Plan file merge unsupported: '
4651
4641
'Merge type incompatible with tree formats.'))
4757
4747
stored_location_type = "parent"
4758
4748
mutter("%s", stored_location)
4759
4749
if stored_location is None:
4760
raise errors.BzrCommandError(
4750
raise errors.CommandError(
4761
4751
gettext("No location specified or remembered"))
4762
4752
display_url = urlutils.unescape_for_display(stored_location, 'utf-8')
4763
4753
note(gettext("{0} remembered {1} location {2}").format(verb_string,
4804
4794
self.enter_context(tree.lock_write())
4805
4795
parents = tree.get_parent_ids()
4806
4796
if len(parents) != 2:
4807
raise errors.BzrCommandError(
4797
raise errors.CommandError(
4808
4798
gettext("Sorry, remerge only works after normal"
4809
4799
" merges. Not cherrypicking or multi-merges."))
4810
4800
interesting_files = None
4829
4819
restore_files = [c.path for c in conflicts
4830
4820
if c.typestring in allowed_conflicts]
4831
4821
_mod_merge.transform_tree(tree, tree.basis_tree(), interesting_files)
4832
tree.set_conflicts(ConflictList(new_conflicts))
4822
tree.set_conflicts(new_conflicts)
4833
4823
if file_list is not None:
4834
4824
restore_files = file_list
4835
4825
for filename in restore_files:
5328
5318
def run(self, revision_id_list=None, revision=None, directory=u'.'):
5329
5319
if revision_id_list is not None and revision is not None:
5330
raise errors.BzrCommandError(
5320
raise errors.CommandError(
5331
5321
gettext('You can only supply one of revision_id or --revision'))
5332
5322
if revision_id_list is None and revision is None:
5333
raise errors.BzrCommandError(
5323
raise errors.CommandError(
5334
5324
gettext('You must supply either --revision or a revision_id'))
5335
5325
b = WorkingTree.open_containing(directory)[0].branch
5336
5326
self.enter_context(b.lock_write())
5358
5348
if to_revid is None:
5359
5349
to_revno = b.revno()
5360
5350
if from_revno is None or to_revno is None:
5361
raise errors.BzrCommandError(
5351
raise errors.CommandError(
5362
5352
gettext('Cannot sign a range of non-revision-history revisions'))
5363
5353
with WriteGroup(b.repository):
5364
5354
for revno in range(from_revno, to_revno + 1):
5365
5355
b.repository.sign_revision(b.get_rev_id(revno),
5368
raise errors.BzrCommandError(
5358
raise errors.CommandError(
5369
5359
gettext('Please supply either one revision, or a range.'))
5392
5382
location = b.get_old_bound_location()
5393
5383
except errors.UpgradeRequired:
5394
raise errors.BzrCommandError(
5384
raise errors.CommandError(
5395
5385
gettext('No location supplied. '
5396
5386
'This format does not remember old locations.'))
5398
5388
if location is None:
5399
5389
if b.get_bound_location() is not None:
5400
raise errors.BzrCommandError(
5390
raise errors.CommandError(
5401
5391
gettext('Branch is already bound'))
5403
raise errors.BzrCommandError(
5393
raise errors.CommandError(
5404
5394
gettext('No location supplied'
5405
5395
' and no previous location known'))
5406
5396
b_other = Branch.open(location)
5408
5398
b.bind(b_other)
5409
5399
except errors.DivergedBranches:
5410
raise errors.BzrCommandError(
5400
raise errors.CommandError(
5411
5401
gettext('These branches have diverged.'
5412
5402
' Try merging, and then bind again.'))
5413
5403
if b.get_config().has_explicit_nickname():
5428
5418
def run(self, directory=u'.'):
5429
5419
b, relpath = Branch.open_containing(directory)
5430
5420
if not b.unbind():
5431
raise errors.BzrCommandError(gettext('Local branch is not bound'))
5421
raise errors.CommandError(gettext('Local branch is not bound'))
5434
5424
class cmd_uncommit(Command):
5687
5677
containing_tree = WorkingTree.open_containing(parent_dir)[0]
5688
5678
repo = containing_tree.branch.repository
5689
5679
if not repo.supports_rich_root():
5690
raise errors.BzrCommandError(gettext(
5680
raise errors.CommandError(gettext(
5691
5681
"Can't join trees because %s doesn't support rich root data.\n"
5692
5682
"You can use brz upgrade on the repository.")
5697
5687
except BadReferenceTarget as e:
5698
5688
# XXX: Would be better to just raise a nicely printable
5699
5689
# exception from the real origin. Also below. mbp 20070306
5700
raise errors.BzrCommandError(
5690
raise errors.CommandError(
5701
5691
gettext("Cannot join {0}. {1}").format(tree, e.reason))
5704
5694
containing_tree.subsume(sub_tree)
5705
5695
except errors.BadSubsumeSource as e:
5706
raise errors.BzrCommandError(
5696
raise errors.CommandError(
5707
5697
gettext("Cannot join {0}. {1}").format(tree, e.reason))
5767
5757
diff='Normal unified diff.',
5768
5758
plain='No patch, just directive.'),
5769
5759
Option('sign', help='GPG-sign the directive.'), 'revision',
5770
Option('mail-to', type=text_type,
5760
Option('mail-to', type=str,
5771
5761
help='Instead of printing the directive, email to this '
5773
Option('message', type=text_type, short_name='m',
5763
Option('message', type=str, short_name='m',
5774
5764
help='Message to use when committing this merge.')
5795
5785
if submit_branch is None:
5796
5786
submit_branch = branch.get_parent()
5797
5787
if submit_branch is None:
5798
raise errors.BzrCommandError(
5788
raise errors.CommandError(
5799
5789
gettext('No submit branch specified or known'))
5801
5791
stored_public_branch = branch.get_public_branch()
5805
5795
# FIXME: Should be done only if we succeed ? -- vila 2012-01-03
5806
5796
branch.set_public_branch(public_branch)
5807
5797
if not include_bundle and public_branch is None:
5808
raise errors.BzrCommandError(
5798
raise errors.CommandError(
5809
5799
gettext('No public branch specified or known'))
5810
5800
base_revision_id = None
5811
5801
if revision is not None:
5812
5802
if len(revision) > 2:
5813
raise errors.BzrCommandError(
5803
raise errors.CommandError(
5814
5804
gettext('brz merge-directive takes '
5815
5805
'at most two one revision identifiers'))
5816
5806
revision_id = revision[-1].as_revision_id(branch)
5820
5810
revision_id = branch.last_revision()
5821
5811
revision_id = ensure_null(revision_id)
5822
5812
if revision_id == NULL_REVISION:
5823
raise errors.BzrCommandError(gettext('No revisions to bundle.'))
5813
raise errors.CommandError(gettext('No revisions to bundle.'))
5824
5814
directive = merge_directive.MergeDirective2.from_objects(
5825
5815
branch.repository, revision_id, time.time(),
5826
5816
osutils.local_time_offset(), submit_branch,
5924
5914
help='Branch to generate the submission from, '
5925
5915
'rather than the one containing the working directory.',
5926
5916
short_name='f',
5928
5918
Option('output', short_name='o',
5929
5919
help='Write merge directive to this file or directory; '
5930
5920
'use - for stdout.',
5932
5922
Option('strict',
5933
5923
help='Refuse to send if there are uncommitted changes in'
5934
5924
' the working tree, --no-strict disables the check.'),
5935
5925
Option('mail-to', help='Mail the request to this address.',
5939
Option('body', help='Body for the email.', type=text_type),
5929
Option('body', help='Body for the email.', type=str),
5940
5930
RegistryOption('format',
5941
5931
help='Use the specified output format.',
5942
5932
lazy_registry=('breezy.send', 'format_registry')),
5992
5982
help='Branch to generate the submission from, '
5993
5983
'rather than the one containing the working directory.',
5994
5984
short_name='f',
5996
5986
Option('output', short_name='o', help='Write directive to this file.',
5998
5988
Option('strict',
5999
5989
help='Refuse to bundle revisions if there are uncommitted'
6000
5990
' changes in the working tree, --no-strict disables the check.'),
6067
6057
self.enter_context(branch.lock_write())
6069
6059
if tag_name is None:
6070
raise errors.BzrCommandError(
6060
raise errors.CommandError(
6071
6061
gettext("No tag specified to delete."))
6072
6062
branch.tags.delete_tag(tag_name)
6073
6063
note(gettext('Deleted tag %s.') % tag_name)
6076
6066
if len(revision) != 1:
6077
raise errors.BzrCommandError(gettext(
6067
raise errors.CommandError(gettext(
6078
6068
"Tags can only be placed on a single revision, "
6079
6069
"not on a range"))
6080
6070
revision_id = revision[0].as_revision_id(branch)
6083
6073
if tag_name is None:
6084
6074
tag_name = branch.automatic_tag_name(revision_id)
6085
6075
if tag_name is None:
6086
raise errors.BzrCommandError(gettext(
6076
raise errors.CommandError(gettext(
6087
6077
"Please specify a tag name."))
6089
6079
existing_target = branch.tags.lookup_tag(tag_name)
6124
6114
from .tag import tag_sort_methods
6125
6115
branch, relpath = Branch.open_containing(directory)
6127
tags = list(viewitems(branch.tags.get_tag_dict()))
6117
tags = list(branch.tags.get_tag_dict().items())
6228
6218
with_no_trees='Reconfigure repository to not create '
6229
6219
'working trees on branches by default.'
6231
Option('bind-to', help='Branch to bind checkout to.', type=text_type),
6221
Option('bind-to', help='Branch to bind checkout to.', type=str),
6232
6222
Option('force',
6233
6223
help='Perform reconfiguration even if local changes'
6234
6224
' will be lost.'),
6235
6225
Option('stacked-on',
6236
6226
help='Reconfigure a branch to be stacked on another branch.',
6239
6229
Option('unstacked',
6240
6230
help='Reconfigure a branch to be unstacked. This '
6247
6237
stacked_on=None, unstacked=None):
6248
6238
directory = controldir.ControlDir.open(location)
6249
6239
if stacked_on and unstacked:
6250
raise errors.BzrCommandError(
6240
raise errors.CommandError(
6251
6241
gettext("Can't use both --stacked-on and --unstacked"))
6252
6242
elif stacked_on is not None:
6253
6243
reconfigure.ReconfigureStackedOn().apply(directory, stacked_on)
6341
6331
possible_transports = [control_dir.root_transport]
6342
6332
if to_location is None:
6343
6333
if revision is None:
6344
raise errors.BzrCommandError(gettext('You must supply either a'
6334
raise errors.CommandError(gettext('You must supply either a'
6345
6335
' revision or a location'))
6346
6336
to_location = tree_location
6355
6345
possible_transports.append(branch.user_transport)
6356
6346
if create_branch:
6357
6347
if branch is None:
6358
raise errors.BzrCommandError(
6348
raise errors.CommandError(
6359
6349
gettext('cannot create branch without source branch'))
6360
6350
to_location = lookup_new_sibling_branch(
6361
6351
control_dir, to_location,
6383
6373
store_uncommitted=store,
6384
6374
possible_transports=possible_transports)
6385
6375
except controldir.BranchReferenceLoop:
6386
raise errors.BzrCommandError(
6376
raise errors.CommandError(
6387
6377
gettext('switching would create a branch reference loop. '
6388
6378
'Use the "bzr up" command to switch to a '
6389
6379
'different revision.'))
6495
6485
name = current_view
6498
raise errors.BzrCommandError(gettext(
6488
raise errors.CommandError(gettext(
6499
6489
"Both --delete and a file list specified"))
6501
raise errors.BzrCommandError(gettext(
6491
raise errors.CommandError(gettext(
6502
6492
"Both --delete and --switch specified"))
6504
6494
tree.views.set_view_info(None, {})
6505
6495
self.outf.write(gettext("Deleted all views.\n"))
6506
6496
elif name is None:
6507
raise errors.BzrCommandError(
6497
raise errors.CommandError(
6508
6498
gettext("No current view to delete"))
6510
6500
tree.views.delete_view(name)
6511
6501
self.outf.write(gettext("Deleted '%s' view.\n") % name)
6514
raise errors.BzrCommandError(gettext(
6504
raise errors.CommandError(gettext(
6515
6505
"Both --switch and a file list specified"))
6517
raise errors.BzrCommandError(gettext(
6507
raise errors.CommandError(gettext(
6518
6508
"Both --switch and --all specified"))
6519
6509
elif switch == 'off':
6520
6510
if current_view is None:
6521
raise errors.BzrCommandError(
6511
raise errors.CommandError(
6522
6512
gettext("No current view to disable"))
6523
6513
tree.views.set_view_info(None, view_dict)
6524
6514
self.outf.write(gettext("Disabled '%s' view.\n") %
6545
6535
# No name given and no current view set
6547
6537
elif name == 'off':
6548
raise errors.BzrCommandError(gettext(
6538
raise errors.CommandError(gettext(
6549
6539
"Cannot change the 'off' pseudo view"))
6550
6540
tree.views.set_view(name, sorted(file_list))
6551
6541
view_str = views.view_display_str(tree.views.lookup_view())
6612
6602
active_branch = None
6613
6603
if (active_branch is not None and
6614
6604
br.control_url == active_branch.control_url):
6615
raise errors.BzrCommandError(
6605
raise errors.CommandError(
6616
6606
gettext("Branch is active. Use --force to remove it."))
6617
6607
br.controldir.destroy_branch(br.name)
6827
6817
takes_options = [Option('plugin',
6828
6818
help='Export help text from named command '
6829
6819
'(defaults to all built in commands).',
6831
6821
Option('include-duplicates',
6832
6822
help='Output multiple copies of the same msgid '
6833
6823
'string if it appears more than once.'),
6933
6923
takes_options = [
6936
Option('color', type=text_type, argname='when',
6926
Option('color', type=str, argname='when',
6937
6927
help='Show match in color. WHEN is never, always or auto.'),
6938
6928
Option('diff', short_name='p',
6939
6929
help='Grep for pattern in changeset for each revision.'),
6940
ListOption('exclude', type=text_type, argname='glob', short_name='X',
6930
ListOption('exclude', type=str, argname='glob', short_name='X',
6941
6931
help="Skip files whose base name matches GLOB."),
6942
ListOption('include', type=text_type, argname='glob', short_name='I',
6932
ListOption('include', type=str, argname='glob', short_name='I',
6943
6933
help="Search only files whose base name matches GLOB."),
6944
6934
Option('files-with-matches', short_name='l',
6945
6935
help='Print only the name of each input file in '
6981
6971
path_list = ['.']
6984
raise errors.BzrCommandError(
6974
raise errors.CommandError(
6985
6975
'cannot specify both --from-root and PATH.')
6987
6977
if files_with_matches and files_without_match:
6988
raise errors.BzrCommandError(
6978
raise errors.CommandError(
6989
6979
'cannot specify both '
6990
6980
'-l/--files-with-matches and -L/--files-without-matches.')
6998
6988
color = 'never'
7000
6990
if color not in ['always', 'never', 'auto']:
7001
raise errors.BzrCommandError('Valid values for --color are '
6991
raise errors.CommandError('Valid values for --color are '
7002
6992
'"always", "never" or "auto".')
7004
6994
if levels is None: