~bzr-pqm/bzr/bzr.dev

« back to all changes in this revision

Viewing changes to bzrlib/builtins.py

  • Committer: Martin von Gagern
  • Date: 2011-06-01 12:53:56 UTC
  • mto: This revision was merged to the branch mainline in revision 6009.
  • Revision ID: martin.vgagern@gmx.net-20110601125356-lwozv2vecea6hxfz
Change from no_decorate to classify as name for the argument.

The command line switch remains as --no-classify, to keep backwards
compatibility.  Users are free to include --no-classify in an alias, and
still use --classify to change back.

Show diffs side-by-side

added added

removed removed

Lines of Context:
49
49
    ui,
50
50
    urlutils,
51
51
    views,
52
 
    gpg,
53
52
    )
54
53
from bzrlib.branch import Branch
55
54
from bzrlib.conflicts import ConflictList
57
56
from bzrlib.revisionspec import RevisionSpec, RevisionInfo
58
57
from bzrlib.smtp_connection import SMTPConnection
59
58
from bzrlib.workingtree import WorkingTree
60
 
from bzrlib.i18n import gettext, ngettext
61
59
""")
62
60
 
63
61
from bzrlib.commands import (
113
111
            if view_files:
114
112
                file_list = view_files
115
113
                view_str = views.view_display_str(view_files)
116
 
                note(gettext("Ignoring files outside view. View is %s") % view_str)
 
114
                note("Ignoring files outside view. View is %s" % view_str)
117
115
    return tree, file_list
118
116
 
119
117
 
121
119
    if revisions is None:
122
120
        return None
123
121
    if len(revisions) != 1:
124
 
        raise errors.BzrCommandError(gettext(
125
 
            'bzr %s --revision takes exactly one revision identifier') % (
 
122
        raise errors.BzrCommandError(
 
123
            'bzr %s --revision takes exactly one revision identifier' % (
126
124
                command_name,))
127
125
    return revisions[0]
128
126
 
289
287
        from bzrlib.status import show_tree_status
290
288
 
291
289
        if revision and len(revision) > 2:
292
 
            raise errors.BzrCommandError(gettext('bzr status --revision takes exactly'
293
 
                                         ' one or two revision specifiers'))
 
290
            raise errors.BzrCommandError('bzr status --revision takes exactly'
 
291
                                         ' one or two revision specifiers')
294
292
 
295
293
        tree, relfile_list = WorkingTree.open_containing_paths(file_list)
296
294
        # Avoid asking for specific files when that is not needed.
333
331
    @display_command
334
332
    def run(self, revision_id=None, revision=None, directory=u'.'):
335
333
        if revision_id is not None and revision is not None:
336
 
            raise errors.BzrCommandError(gettext('You can only supply one of'
337
 
                                         ' revision_id or --revision'))
 
334
            raise errors.BzrCommandError('You can only supply one of'
 
335
                                         ' revision_id or --revision')
338
336
        if revision_id is None and revision is None:
339
 
            raise errors.BzrCommandError(gettext('You must supply either'
340
 
                                         ' --revision or a revision_id'))
 
337
            raise errors.BzrCommandError('You must supply either'
 
338
                                         ' --revision or a revision_id')
341
339
 
342
340
        b = bzrdir.BzrDir.open_containing_tree_or_branch(directory)[1]
343
341
 
344
342
        revisions = b.repository.revisions
345
343
        if revisions is None:
346
 
            raise errors.BzrCommandError(gettext('Repository %r does not support '
347
 
                'access to raw revision texts'))
 
344
            raise errors.BzrCommandError('Repository %r does not support '
 
345
                'access to raw revision texts')
348
346
 
349
347
        b.repository.lock_read()
350
348
        try:
354
352
                try:
355
353
                    self.print_revision(revisions, revision_id)
356
354
                except errors.NoSuchRevision:
357
 
                    msg = gettext("The repository {0} contains no revision {1}.").format(
 
355
                    msg = "The repository %s contains no revision %s." % (
358
356
                        b.repository.base, revision_id)
359
357
                    raise errors.BzrCommandError(msg)
360
358
            elif revision is not None:
361
359
                for rev in revision:
362
360
                    if rev is None:
363
361
                        raise errors.BzrCommandError(
364
 
                            gettext('You cannot specify a NULL revision.'))
 
362
                            'You cannot specify a NULL revision.')
365
363
                    rev_id = rev.as_revision_id(b)
366
364
                    self.print_revision(revisions, rev_id)
367
365
        finally:
478
476
            try:
479
477
                working = d.open_workingtree()
480
478
            except errors.NoWorkingTree:
481
 
                raise errors.BzrCommandError(gettext("No working tree to remove"))
 
479
                raise errors.BzrCommandError("No working tree to remove")
482
480
            except errors.NotLocalUrl:
483
 
                raise errors.BzrCommandError(gettext("You cannot remove the working tree"
484
 
                                             " of a remote path"))
 
481
                raise errors.BzrCommandError("You cannot remove the working tree"
 
482
                                             " of a remote path")
485
483
            if not force:
486
484
                if (working.has_changes()):
487
485
                    raise errors.UncommittedChanges(working)
489
487
                    raise errors.ShelvedChanges(working)
490
488
 
491
489
            if working.user_url != working.branch.user_url:
492
 
                raise errors.BzrCommandError(gettext("You cannot remove the working tree"
493
 
                                             " from a lightweight checkout"))
 
490
                raise errors.BzrCommandError("You cannot remove the working tree"
 
491
                                             " from a lightweight checkout")
494
492
 
495
493
            d.destroy_workingtree()
496
494
 
528
526
                pass # There seems to be a real error here, so we'll reset
529
527
            else:
530
528
                # Refuse
531
 
                raise errors.BzrCommandError(gettext(
 
529
                raise errors.BzrCommandError(
532
530
                    'The tree does not appear to be corrupt. You probably'
533
531
                    ' want "bzr revert" instead. Use "--force" if you are'
534
 
                    ' sure you want to reset the working tree.'))
 
532
                    ' sure you want to reset the working tree.')
535
533
        if revision is None:
536
534
            revision_ids = None
537
535
        else:
540
538
            tree.reset_state(revision_ids)
541
539
        except errors.BzrError, e:
542
540
            if revision_ids is None:
543
 
                extra = (gettext(', the header appears corrupt, try passing -r -1'
544
 
                         ' to set the state to the last commit'))
 
541
                extra = (', the header appears corrupt, try passing -r -1'
 
542
                         ' to set the state to the last commit')
545
543
            else:
546
544
                extra = ''
547
 
            raise errors.BzrCommandError(gettext('failed to reset the tree state{0}').format(extra))
 
545
            raise errors.BzrCommandError('failed to reset the tree state'
 
546
                                         + extra)
548
547
 
549
548
 
550
549
class cmd_revno(Command):
653
652
    are added.  This search proceeds recursively into versioned
654
653
    directories.  If no names are given '.' is assumed.
655
654
 
656
 
    A warning will be printed when nested trees are encountered,
657
 
    unless they are explicitly ignored.
658
 
 
659
655
    Therefore simply saying 'bzr add' will version all files that
660
656
    are currently unknown.
661
657
 
677
673
    
678
674
    Any files matching patterns in the ignore list will not be added
679
675
    unless they are explicitly mentioned.
680
 
    
681
 
    In recursive mode, files larger than the configuration option 
682
 
    add.maximum_file_size will be skipped. Named items are never skipped due
683
 
    to file size.
684
676
    """
685
677
    takes_args = ['file*']
686
678
    takes_options = [
713
705
            action = bzrlib.add.AddFromBaseAction(base_tree, base_path,
714
706
                          to_file=self.outf, should_print=(not is_quiet()))
715
707
        else:
716
 
            action = bzrlib.add.AddWithSkipLargeAction(to_file=self.outf,
 
708
            action = bzrlib.add.AddAction(to_file=self.outf,
717
709
                should_print=(not is_quiet()))
718
710
 
719
711
        if base_tree:
726
718
            if verbose:
727
719
                for glob in sorted(ignored.keys()):
728
720
                    for path in ignored[glob]:
729
 
                        self.outf.write(
730
 
                         gettext("ignored {0} matching \"{1}\"\n").format(
731
 
                         path, glob))
 
721
                        self.outf.write("ignored %s matching \"%s\"\n"
 
722
                                        % (path, glob))
732
723
 
733
724
 
734
725
class cmd_mkdir(Command):
748
739
            if id != None:
749
740
                os.mkdir(d)
750
741
                wt.add([dd])
751
 
                self.outf.write(gettext('added %s\n') % d)
 
742
                self.outf.write('added %s\n' % d)
752
743
            else:
753
744
                raise errors.NotVersionedError(path=base)
754
745
 
792
783
    @display_command
793
784
    def run(self, revision=None, show_ids=False, kind=None, file_list=None):
794
785
        if kind and kind not in ['file', 'directory', 'symlink']:
795
 
            raise errors.BzrCommandError(gettext('invalid kind %r specified') % (kind,))
 
786
            raise errors.BzrCommandError('invalid kind %r specified' % (kind,))
796
787
 
797
788
        revision = _get_one_revision('inventory', revision)
798
789
        work_tree, file_list = WorkingTree.open_containing_paths(file_list)
811
802
                                      require_versioned=True)
812
803
            # find_ids_across_trees may include some paths that don't
813
804
            # exist in 'tree'.
814
 
            entries = sorted(
815
 
                (tree.id2path(file_id), tree.inventory[file_id])
816
 
                for file_id in file_ids if tree.has_id(file_id))
 
805
            entries = sorted((tree.id2path(file_id), tree.inventory[file_id])
 
806
                             for file_id in file_ids if file_id in tree)
817
807
        else:
818
808
            entries = tree.inventory.entries()
819
809
 
862
852
        if auto:
863
853
            return self.run_auto(names_list, after, dry_run)
864
854
        elif dry_run:
865
 
            raise errors.BzrCommandError(gettext('--dry-run requires --auto.'))
 
855
            raise errors.BzrCommandError('--dry-run requires --auto.')
866
856
        if names_list is None:
867
857
            names_list = []
868
858
        if len(names_list) < 2:
869
 
            raise errors.BzrCommandError(gettext("missing file argument"))
 
859
            raise errors.BzrCommandError("missing file argument")
870
860
        tree, rel_names = WorkingTree.open_containing_paths(names_list, canonicalize=False)
871
861
        self.add_cleanup(tree.lock_tree_write().unlock)
872
862
        self._run(tree, names_list, rel_names, after)
873
863
 
874
864
    def run_auto(self, names_list, after, dry_run):
875
865
        if names_list is not None and len(names_list) > 1:
876
 
            raise errors.BzrCommandError(gettext('Only one path may be specified to'
877
 
                                         ' --auto.'))
 
866
            raise errors.BzrCommandError('Only one path may be specified to'
 
867
                                         ' --auto.')
878
868
        if after:
879
 
            raise errors.BzrCommandError(gettext('--after cannot be specified with'
880
 
                                         ' --auto.'))
 
869
            raise errors.BzrCommandError('--after cannot be specified with'
 
870
                                         ' --auto.')
881
871
        work_tree, file_list = WorkingTree.open_containing_paths(
882
872
            names_list, default_directory='.')
883
873
        self.add_cleanup(work_tree.lock_tree_write().unlock)
913
903
                    self.outf.write("%s => %s\n" % (src, dest))
914
904
        else:
915
905
            if len(names_list) != 2:
916
 
                raise errors.BzrCommandError(gettext('to mv multiple files the'
 
906
                raise errors.BzrCommandError('to mv multiple files the'
917
907
                                             ' destination must be a versioned'
918
 
                                             ' directory'))
 
908
                                             ' directory')
919
909
 
920
910
            # for cicp file-systems: the src references an existing inventory
921
911
            # item:
981
971
    branches have diverged.
982
972
 
983
973
    If there is no default location set, the first pull will set it (use
984
 
    --no-remember to avoid setting it). After that, you can omit the
 
974
    --no-remember to avoid settting it). After that, you can omit the
985
975
    location to use the default.  To change the default, use --remember. The
986
976
    value will only be saved if the remote location can be accessed.
987
977
 
1027
1017
            self.add_cleanup(branch_to.lock_write().unlock)
1028
1018
 
1029
1019
        if tree_to is None and show_base:
1030
 
            raise errors.BzrCommandError(gettext("Need working tree for --show-base."))
 
1020
            raise errors.BzrCommandError("Need working tree for --show-base.")
1031
1021
 
1032
1022
        if local and not branch_to.get_bound_location():
1033
1023
            raise errors.LocalRequiresBoundBranch()
1043
1033
        stored_loc = branch_to.get_parent()
1044
1034
        if location is None:
1045
1035
            if stored_loc is None:
1046
 
                raise errors.BzrCommandError(gettext("No pull location known or"
1047
 
                                             " specified."))
 
1036
                raise errors.BzrCommandError("No pull location known or"
 
1037
                                             " specified.")
1048
1038
            else:
1049
1039
                display_url = urlutils.unescape_for_display(stored_loc,
1050
1040
                        self.outf.encoding)
1051
1041
                if not is_quiet():
1052
 
                    self.outf.write(gettext("Using saved parent location: %s\n") % display_url)
 
1042
                    self.outf.write("Using saved parent location: %s\n" % display_url)
1053
1043
                location = stored_loc
1054
1044
 
1055
1045
        revision = _get_one_revision('pull', revision)
1056
1046
        if mergeable is not None:
1057
1047
            if revision is not None:
1058
 
                raise errors.BzrCommandError(gettext(
1059
 
                    'Cannot use -r with merge directives or bundles'))
 
1048
                raise errors.BzrCommandError(
 
1049
                    'Cannot use -r with merge directives or bundles')
1060
1050
            mergeable.install_revisions(branch_to.repository)
1061
1051
            base_revision_id, revision_id, verified = \
1062
1052
                mergeable.get_merge_request(branch_to.repository)
1080
1070
                view_info=view_info)
1081
1071
            result = tree_to.pull(
1082
1072
                branch_from, overwrite, revision_id, change_reporter,
1083
 
                local=local, show_base=show_base)
 
1073
                possible_transports=possible_transports, local=local,
 
1074
                show_base=show_base)
1084
1075
        else:
1085
1076
            result = branch_to.pull(
1086
1077
                branch_from, overwrite, revision_id, local=local)
1117
1108
    After that you will be able to do a push without '--overwrite'.
1118
1109
 
1119
1110
    If there is no default push location set, the first push will set it (use
1120
 
    --no-remember to avoid setting it).  After that, you can omit the
 
1111
    --no-remember to avoid settting it).  After that, you can omit the
1121
1112
    location to use the default.  To change the default, use --remember. The
1122
1113
    value will only be saved if the remote location can be accessed.
1123
1114
    """
1190
1181
                    # error by the feedback given to them. RBC 20080227.
1191
1182
                    stacked_on = parent_url
1192
1183
            if not stacked_on:
1193
 
                raise errors.BzrCommandError(gettext(
1194
 
                    "Could not determine branch to refer to."))
 
1184
                raise errors.BzrCommandError(
 
1185
                    "Could not determine branch to refer to.")
1195
1186
 
1196
1187
        # Get the destination location
1197
1188
        if location is None:
1198
1189
            stored_loc = br_from.get_push_location()
1199
1190
            if stored_loc is None:
1200
 
                raise errors.BzrCommandError(gettext(
1201
 
                    "No push location known or specified."))
 
1191
                raise errors.BzrCommandError(
 
1192
                    "No push location known or specified.")
1202
1193
            else:
1203
1194
                display_url = urlutils.unescape_for_display(stored_loc,
1204
1195
                        self.outf.encoding)
1205
 
                note(gettext("Using saved push location: %s") % display_url)
 
1196
                self.outf.write("Using saved push location: %s\n" % display_url)
1206
1197
                location = stored_loc
1207
1198
 
1208
1199
        _show_push_branch(br_from, revision_id, location, self.outf,
1291
1282
            to_transport.mkdir('.')
1292
1283
        except errors.FileExists:
1293
1284
            if not use_existing_dir:
1294
 
                raise errors.BzrCommandError(gettext('Target directory "%s" '
1295
 
                    'already exists.') % to_location)
 
1285
                raise errors.BzrCommandError('Target directory "%s" '
 
1286
                    'already exists.' % to_location)
1296
1287
            else:
1297
1288
                try:
1298
1289
                    bzrdir.BzrDir.open_from_transport(to_transport)
1301
1292
                else:
1302
1293
                    raise errors.AlreadyBranchError(to_location)
1303
1294
        except errors.NoSuchFile:
1304
 
            raise errors.BzrCommandError(gettext('Parent of "%s" does not exist.')
 
1295
            raise errors.BzrCommandError('Parent of "%s" does not exist.'
1305
1296
                                         % to_location)
1306
1297
        try:
1307
1298
            # preserve whatever source format we have.
1315
1306
            branch = dir.open_branch()
1316
1307
        except errors.NoSuchRevision:
1317
1308
            to_transport.delete_tree('.')
1318
 
            msg = gettext("The branch {0} has no revision {1}.").format(
1319
 
                from_location, revision)
 
1309
            msg = "The branch %s has no revision %s." % (from_location,
 
1310
                revision)
1320
1311
            raise errors.BzrCommandError(msg)
1321
1312
        _merge_tags_if_possible(br_from, branch)
1322
1313
        # If the source branch is stacked, the new branch may
1323
1314
        # be stacked whether we asked for that explicitly or not.
1324
1315
        # We therefore need a try/except here and not just 'if stacked:'
1325
1316
        try:
1326
 
            note(gettext('Created new stacked branch referring to %s.') %
 
1317
            note('Created new stacked branch referring to %s.' %
1327
1318
                branch.get_stacked_on_url())
1328
1319
        except (errors.NotStacked, errors.UnstackableBranchFormat,
1329
1320
            errors.UnstackableRepositoryFormat), e:
1330
 
            note(ngettext('Branched %d revision.', 'Branched %d revisions.', branch.revno()) % branch.revno())
 
1321
            note('Branched %d revision(s).' % branch.revno())
1331
1322
        if bind:
1332
1323
            # Bind to the parent
1333
1324
            parent_branch = Branch.open(from_location)
1334
1325
            branch.bind(parent_branch)
1335
 
            note(gettext('New branch bound to %s') % from_location)
 
1326
            note('New branch bound to %s' % from_location)
1336
1327
        if switch:
1337
1328
            # Switch to the new branch
1338
1329
            wt, _ = WorkingTree.open_containing('.')
1339
1330
            _mod_switch.switch(wt.bzrdir, branch)
1340
 
            note(gettext('Switched to branch: %s'),
 
1331
            note('Switched to branch: %s',
1341
1332
                urlutils.unescape_for_display(branch.base, 'utf-8'))
1342
1333
 
1343
1334
 
1344
 
class cmd_branches(Command):
1345
 
    __doc__ = """List the branches available at the current location.
1346
 
 
1347
 
    This command will print the names of all the branches at the current
1348
 
    location.
1349
 
    """
1350
 
 
1351
 
    takes_args = ['location?']
1352
 
    takes_options = [
1353
 
                  Option('recursive', short_name='R',
1354
 
                         help='Recursively scan for branches rather than '
1355
 
                              'just looking in the specified location.')]
1356
 
 
1357
 
    def run(self, location=".", recursive=False):
1358
 
        if recursive:
1359
 
            t = transport.get_transport(location)
1360
 
            if not t.listable():
1361
 
                raise errors.BzrCommandError(
1362
 
                    "Can't scan this type of location.")
1363
 
            for b in bzrdir.BzrDir.find_branches(t):
1364
 
                self.outf.write("%s\n" % urlutils.unescape_for_display(
1365
 
                    urlutils.relative_url(t.base, b.base),
1366
 
                    self.outf.encoding).rstrip("/"))
1367
 
        else:
1368
 
            dir = bzrdir.BzrDir.open_containing(location)[0]
1369
 
            for branch in dir.list_branches():
1370
 
                if branch.name is None:
1371
 
                    self.outf.write(gettext(" (default)\n"))
1372
 
                else:
1373
 
                    self.outf.write(" %s\n" % branch.name.encode(
1374
 
                        self.outf.encoding))
1375
 
 
1376
 
 
1377
1335
class cmd_checkout(Command):
1378
1336
    __doc__ = """Create a new checkout of an existing branch.
1379
1337
 
1505
1463
 
1506
1464
    def run(self, dir='.', revision=None, show_base=None):
1507
1465
        if revision is not None and len(revision) != 1:
1508
 
            raise errors.BzrCommandError(gettext(
1509
 
                        "bzr update --revision takes exactly one revision"))
 
1466
            raise errors.BzrCommandError(
 
1467
                        "bzr update --revision takes exactly one revision")
1510
1468
        tree = WorkingTree.open_containing(dir)[0]
1511
1469
        branch = tree.branch
1512
1470
        possible_transports = []
1537
1495
            revision_id = branch.last_revision()
1538
1496
        if revision_id == _mod_revision.ensure_null(tree.last_revision()):
1539
1497
            revno = branch.revision_id_to_dotted_revno(revision_id)
1540
 
            note(gettext("Tree is up to date at revision {0} of branch {1}"
1541
 
                        ).format('.'.join(map(str, revno)), branch_location))
 
1498
            note("Tree is up to date at revision %s of branch %s" %
 
1499
                ('.'.join(map(str, revno)), branch_location))
1542
1500
            return 0
1543
1501
        view_info = _get_view_info_for_change_reporter(tree)
1544
1502
        change_reporter = delta._ChangeReporter(
1552
1510
                old_tip=old_tip,
1553
1511
                show_base=show_base)
1554
1512
        except errors.NoSuchRevision, e:
1555
 
            raise errors.BzrCommandError(gettext(
 
1513
            raise errors.BzrCommandError(
1556
1514
                                  "branch has no revision %s\n"
1557
1515
                                  "bzr update --revision only works"
1558
 
                                  " for a revision in the branch history")
 
1516
                                  " for a revision in the branch history"
1559
1517
                                  % (e.revision))
1560
1518
        revno = tree.branch.revision_id_to_dotted_revno(
1561
1519
            _mod_revision.ensure_null(tree.last_revision()))
1562
 
        note(gettext('Updated to revision {0} of branch {1}').format(
1563
 
             '.'.join(map(str, revno)), branch_location))
 
1520
        note('Updated to revision %s of branch %s' %
 
1521
             ('.'.join(map(str, revno)), branch_location))
1564
1522
        parent_ids = tree.get_parent_ids()
1565
1523
        if parent_ids[1:] and parent_ids[1:] != existing_pending_merges:
1566
 
            note(gettext('Your local commits will now show as pending merges with '
1567
 
                 "'bzr status', and can be committed with 'bzr commit'."))
 
1524
            note('Your local commits will now show as pending merges with '
 
1525
                 "'bzr status', and can be committed with 'bzr commit'.")
1568
1526
        if conflicts != 0:
1569
1527
            return 1
1570
1528
        else:
1642
1600
    def run(self, file_list, verbose=False, new=False,
1643
1601
        file_deletion_strategy='safe'):
1644
1602
        if file_deletion_strategy == 'force':
1645
 
            note(gettext("(The --force option is deprecated, rather use --no-backup "
1646
 
                "in future.)"))
 
1603
            note("(The --force option is deprecated, rather use --no-backup "
 
1604
                "in future.)")
1647
1605
            file_deletion_strategy = 'no-backup'
1648
1606
 
1649
1607
        tree, file_list = WorkingTree.open_containing_paths(file_list)
1659
1617
                specific_files=file_list).added
1660
1618
            file_list = sorted([f[0] for f in added], reverse=True)
1661
1619
            if len(file_list) == 0:
1662
 
                raise errors.BzrCommandError(gettext('No matching files.'))
 
1620
                raise errors.BzrCommandError('No matching files.')
1663
1621
        elif file_list is None:
1664
1622
            # missing files show up in iter_changes(basis) as
1665
1623
            # versioned-with-no-kind.
1788
1746
            b = wt.branch
1789
1747
            last_revision = wt.last_revision()
1790
1748
 
1791
 
        self.add_cleanup(b.repository.lock_read().unlock)
1792
 
        graph = b.repository.get_graph()
1793
 
        revisions = [revid for revid, parents in
1794
 
            graph.iter_ancestry([last_revision])]
1795
 
        for revision_id in reversed(revisions):
1796
 
            if _mod_revision.is_null(revision_id):
1797
 
                continue
 
1749
        revision_ids = b.repository.get_ancestry(last_revision)
 
1750
        revision_ids.pop(0)
 
1751
        for revision_id in revision_ids:
1798
1752
            self.outf.write(revision_id + '\n')
1799
1753
 
1800
1754
 
1859
1813
            to_transport.ensure_base()
1860
1814
        except errors.NoSuchFile:
1861
1815
            if not create_prefix:
1862
 
                raise errors.BzrCommandError(gettext("Parent directory of %s"
 
1816
                raise errors.BzrCommandError("Parent directory of %s"
1863
1817
                    " does not exist."
1864
1818
                    "\nYou may supply --create-prefix to create all"
1865
 
                    " leading parent directories.")
 
1819
                    " leading parent directories."
1866
1820
                    % location)
1867
1821
            to_transport.create_prefix()
1868
1822
 
1893
1847
            try:
1894
1848
                branch.set_append_revisions_only(True)
1895
1849
            except errors.UpgradeRequired:
1896
 
                raise errors.BzrCommandError(gettext('This branch format cannot be set'
1897
 
                    ' to append-revisions-only.  Try --default.'))
 
1850
                raise errors.BzrCommandError('This branch format cannot be set'
 
1851
                    ' to append-revisions-only.  Try --default.')
1898
1852
        if not is_quiet():
1899
1853
            from bzrlib.info import describe_layout, describe_format
1900
1854
            try:
1904
1858
            repository = branch.repository
1905
1859
            layout = describe_layout(repository, branch, tree).lower()
1906
1860
            format = describe_format(a_bzrdir, repository, branch, tree)
1907
 
            self.outf.write(gettext("Created a {0} (format: {1})\n").format(
1908
 
                  layout, format))
 
1861
            self.outf.write("Created a %s (format: %s)\n" % (layout, format))
1909
1862
            if repository.is_shared():
1910
1863
                #XXX: maybe this can be refactored into transport.path_or_url()
1911
1864
                url = repository.bzrdir.root_transport.external_url()
1913
1866
                    url = urlutils.local_path_from_url(url)
1914
1867
                except errors.InvalidURL:
1915
1868
                    pass
1916
 
                self.outf.write(gettext("Using shared repository: %s\n") % url)
 
1869
                self.outf.write("Using shared repository: %s\n" % url)
1917
1870
 
1918
1871
 
1919
1872
class cmd_init_repository(Command):
2110
2063
        elif ':' in prefix:
2111
2064
            old_label, new_label = prefix.split(":")
2112
2065
        else:
2113
 
            raise errors.BzrCommandError(gettext(
 
2066
            raise errors.BzrCommandError(
2114
2067
                '--prefix expects two values separated by a colon'
2115
 
                ' (eg "old/:new/")'))
 
2068
                ' (eg "old/:new/")')
2116
2069
 
2117
2070
        if revision and len(revision) > 2:
2118
 
            raise errors.BzrCommandError(gettext('bzr diff --revision takes exactly'
2119
 
                                         ' one or two revision specifiers'))
 
2071
            raise errors.BzrCommandError('bzr diff --revision takes exactly'
 
2072
                                         ' one or two revision specifiers')
2120
2073
 
2121
2074
        if using is not None and format is not None:
2122
 
            raise errors.BzrCommandError(gettext(
2123
 
                '{0} and {1} are mutually exclusive').format(
2124
 
                '--using', '--format'))
 
2075
            raise errors.BzrCommandError('--using and --format are mutually '
 
2076
                'exclusive.')
2125
2077
 
2126
2078
        (old_tree, new_tree,
2127
2079
         old_branch, new_branch,
2204
2156
        basis_inv = basis.inventory
2205
2157
        inv = wt.inventory
2206
2158
        for file_id in inv:
2207
 
            if basis_inv.has_id(file_id):
 
2159
            if file_id in basis_inv:
2208
2160
                continue
2209
2161
            if inv.is_root(file_id) and len(basis_inv) == 0:
2210
2162
                continue
2235
2187
    try:
2236
2188
        return int(limitstring)
2237
2189
    except ValueError:
2238
 
        msg = gettext("The limit argument must be an integer.")
 
2190
        msg = "The limit argument must be an integer."
2239
2191
        raise errors.BzrCommandError(msg)
2240
2192
 
2241
2193
 
2243
2195
    try:
2244
2196
        return int(s)
2245
2197
    except ValueError:
2246
 
        msg = gettext("The levels argument must be an integer.")
 
2198
        msg = "The levels argument must be an integer."
2247
2199
        raise errors.BzrCommandError(msg)
2248
2200
 
2249
2201
 
2359
2311
 
2360
2312
    :Other filtering:
2361
2313
 
2362
 
      The --match option can be used for finding revisions that match a
2363
 
      regular expression in a commit message, committer, author or bug.
2364
 
      Specifying the option several times will match any of the supplied
2365
 
      expressions. --match-author, --match-bugs, --match-committer and
2366
 
      --match-message can be used to only match a specific field.
 
2314
      The --message option can be used for finding revisions that match a
 
2315
      regular expression in a commit message.
2367
2316
 
2368
2317
    :Tips & tricks:
2369
2318
 
2429
2378
                   argname='N',
2430
2379
                   type=_parse_levels),
2431
2380
            Option('message',
 
2381
                   short_name='m',
2432
2382
                   help='Show revisions whose message matches this '
2433
2383
                        'regular expression.',
2434
 
                   type=str,
2435
 
                   hidden=True),
 
2384
                   type=str),
2436
2385
            Option('limit',
2437
2386
                   short_name='l',
2438
2387
                   help='Limit the output to the first N revisions.',
2441
2390
            Option('show-diff',
2442
2391
                   short_name='p',
2443
2392
                   help='Show changes made in each revision as a patch.'),
2444
 
            Option('include-merged',
 
2393
            Option('include-merges',
2445
2394
                   help='Show merged revisions like --levels 0 does.'),
2446
 
            Option('include-merges', hidden=True,
2447
 
                   help='Historical alias for --include-merged.'),
2448
 
            Option('omit-merges',
2449
 
                   help='Do not report commits with more than one parent.'),
2450
2395
            Option('exclude-common-ancestry',
2451
2396
                   help='Display only the revisions that are not part'
2452
2397
                   ' of both ancestries (require -rX..Y)'
2453
 
                   ),
2454
 
            Option('signatures',
2455
 
                   help='Show digital signature validity'),
2456
 
            ListOption('match',
2457
 
                short_name='m',
2458
 
                help='Show revisions whose properties match this '
2459
 
                'expression.',
2460
 
                type=str),
2461
 
            ListOption('match-message',
2462
 
                   help='Show revisions whose message matches this '
2463
 
                   'expression.',
2464
 
                type=str),
2465
 
            ListOption('match-committer',
2466
 
                   help='Show revisions whose committer matches this '
2467
 
                   'expression.',
2468
 
                type=str),
2469
 
            ListOption('match-author',
2470
 
                   help='Show revisions whose authors match this '
2471
 
                   'expression.',
2472
 
                type=str),
2473
 
            ListOption('match-bugs',
2474
 
                   help='Show revisions whose bugs match this '
2475
 
                   'expression.',
2476
 
                type=str)
 
2398
                   )
2477
2399
            ]
2478
2400
    encoding_type = 'replace'
2479
2401
 
2489
2411
            message=None,
2490
2412
            limit=None,
2491
2413
            show_diff=False,
2492
 
            include_merged=None,
 
2414
            include_merges=False,
2493
2415
            authors=None,
2494
2416
            exclude_common_ancestry=False,
2495
 
            signatures=False,
2496
 
            match=None,
2497
 
            match_message=None,
2498
 
            match_committer=None,
2499
 
            match_author=None,
2500
 
            match_bugs=None,
2501
 
            omit_merges=False,
2502
 
            include_merges=symbol_versioning.DEPRECATED_PARAMETER,
2503
2417
            ):
2504
2418
        from bzrlib.log import (
2505
2419
            Logger,
2507
2421
            _get_info_for_log_files,
2508
2422
            )
2509
2423
        direction = (forward and 'forward') or 'reverse'
2510
 
        if symbol_versioning.deprecated_passed(include_merges):
2511
 
            ui.ui_factory.show_user_warning(
2512
 
                'deprecated_command_option',
2513
 
                deprecated_name='--include-merges',
2514
 
                recommended_name='--include-merged',
2515
 
                deprecated_in_version='2.5',
2516
 
                command=self.invoked_as)
2517
 
            if include_merged is None:
2518
 
                include_merged = include_merges
2519
 
            else:
2520
 
                raise errors.BzrCommandError(gettext(
2521
 
                    '{0} and {1} are mutually exclusive').format(
2522
 
                    '--include-merges', '--include-merged'))
2523
 
        if include_merged is None:
2524
 
            include_merged = False
2525
2424
        if (exclude_common_ancestry
2526
2425
            and (revision is None or len(revision) != 2)):
2527
 
            raise errors.BzrCommandError(gettext(
2528
 
                '--exclude-common-ancestry requires -r with two revisions'))
2529
 
        if include_merged:
 
2426
            raise errors.BzrCommandError(
 
2427
                '--exclude-common-ancestry requires -r with two revisions')
 
2428
        if include_merges:
2530
2429
            if levels is None:
2531
2430
                levels = 0
2532
2431
            else:
2533
 
                raise errors.BzrCommandError(gettext(
2534
 
                    '{0} and {1} are mutually exclusive').format(
2535
 
                    '--levels', '--include-merged'))
 
2432
                raise errors.BzrCommandError(
 
2433
                    '--levels and --include-merges are mutually exclusive')
2536
2434
 
2537
2435
        if change is not None:
2538
2436
            if len(change) > 1:
2539
2437
                raise errors.RangeInChangeOption()
2540
2438
            if revision is not None:
2541
 
                raise errors.BzrCommandError(gettext(
2542
 
                    '{0} and {1} are mutually exclusive').format(
2543
 
                    '--revision', '--change'))
 
2439
                raise errors.BzrCommandError(
 
2440
                    '--revision and --change are mutually exclusive')
2544
2441
            else:
2545
2442
                revision = change
2546
2443
 
2552
2449
                revision, file_list, self.add_cleanup)
2553
2450
            for relpath, file_id, kind in file_info_list:
2554
2451
                if file_id is None:
2555
 
                    raise errors.BzrCommandError(gettext(
2556
 
                        "Path unknown at end or start of revision range: %s") %
 
2452
                    raise errors.BzrCommandError(
 
2453
                        "Path unknown at end or start of revision range: %s" %
2557
2454
                        relpath)
2558
2455
                # If the relpath is the top of the tree, we log everything
2559
2456
                if relpath == '':
2576
2473
            self.add_cleanup(b.lock_read().unlock)
2577
2474
            rev1, rev2 = _get_revision_range(revision, b, self.name())
2578
2475
 
2579
 
        if b.get_config().validate_signatures_in_log():
2580
 
            signatures = True
2581
 
 
2582
 
        if signatures:
2583
 
            if not gpg.GPGStrategy.verify_signatures_available():
2584
 
                raise errors.GpgmeNotInstalled(None)
2585
 
 
2586
2476
        # Decide on the type of delta & diff filtering to use
2587
2477
        # TODO: add an --all-files option to make this configurable & consistent
2588
2478
        if not verbose:
2625
2515
        match_using_deltas = (len(file_ids) != 1 or filter_by_dir
2626
2516
            or delta_type or partial_history)
2627
2517
 
2628
 
        match_dict = {}
2629
 
        if match:
2630
 
            match_dict[''] = match
2631
 
        if match_message:
2632
 
            match_dict['message'] = match_message
2633
 
        if match_committer:
2634
 
            match_dict['committer'] = match_committer
2635
 
        if match_author:
2636
 
            match_dict['author'] = match_author
2637
 
        if match_bugs:
2638
 
            match_dict['bugs'] = match_bugs
2639
 
 
2640
2518
        # Build the LogRequest and execute it
2641
2519
        if len(file_ids) == 0:
2642
2520
            file_ids = None
2645
2523
            start_revision=rev1, end_revision=rev2, limit=limit,
2646
2524
            message_search=message, delta_type=delta_type,
2647
2525
            diff_type=diff_type, _match_using_deltas=match_using_deltas,
2648
 
            exclude_common_ancestry=exclude_common_ancestry, match=match_dict,
2649
 
            signature=signatures, omit_merges=omit_merges,
 
2526
            exclude_common_ancestry=exclude_common_ancestry,
2650
2527
            )
2651
2528
        Logger(b, rqst).show(lf)
2652
2529
 
2669
2546
            # b is taken from revision[0].get_branch(), and
2670
2547
            # show_log will use its revision_history. Having
2671
2548
            # different branches will lead to weird behaviors.
2672
 
            raise errors.BzrCommandError(gettext(
 
2549
            raise errors.BzrCommandError(
2673
2550
                "bzr %s doesn't accept two revisions in different"
2674
 
                " branches.") % command_name)
 
2551
                " branches." % command_name)
2675
2552
        if start_spec.spec is None:
2676
2553
            # Avoid loading all the history.
2677
2554
            rev1 = RevisionInfo(branch, None, None)
2685
2562
        else:
2686
2563
            rev2 = end_spec.in_history(branch)
2687
2564
    else:
2688
 
        raise errors.BzrCommandError(gettext(
2689
 
            'bzr %s --revision takes one or two values.') % command_name)
 
2565
        raise errors.BzrCommandError(
 
2566
            'bzr %s --revision takes one or two values.' % command_name)
2690
2567
    return rev1, rev2
2691
2568
 
2692
2569
 
2763
2640
            null=False, kind=None, show_ids=False, path=None, directory=None):
2764
2641
 
2765
2642
        if kind and kind not in ('file', 'directory', 'symlink'):
2766
 
            raise errors.BzrCommandError(gettext('invalid kind specified'))
 
2643
            raise errors.BzrCommandError('invalid kind specified')
2767
2644
 
2768
2645
        if verbose and null:
2769
 
            raise errors.BzrCommandError(gettext('Cannot set both --verbose and --null'))
 
2646
            raise errors.BzrCommandError('Cannot set both --verbose and --null')
2770
2647
        all = not (unknown or versioned or ignored)
2771
2648
 
2772
2649
        selection = {'I':ignored, '?':unknown, 'V':versioned}
2775
2652
            fs_path = '.'
2776
2653
        else:
2777
2654
            if from_root:
2778
 
                raise errors.BzrCommandError(gettext('cannot specify both --from-root'
2779
 
                                             ' and PATH'))
 
2655
                raise errors.BzrCommandError('cannot specify both --from-root'
 
2656
                                             ' and PATH')
2780
2657
            fs_path = path
2781
2658
        tree, branch, relpath = \
2782
2659
            _open_directory_or_containing_tree_or_branch(fs_path, directory)
2798
2675
            if view_files:
2799
2676
                apply_view = True
2800
2677
                view_str = views.view_display_str(view_files)
2801
 
                note(gettext("Ignoring files outside view. View is %s") % view_str)
 
2678
                note("Ignoring files outside view. View is %s" % view_str)
2802
2679
 
2803
2680
        self.add_cleanup(tree.lock_read().unlock)
2804
2681
        for fp, fc, fkind, fid, entry in tree.list_files(include_root=False,
2951
2828
                self.outf.write("%s\n" % pattern)
2952
2829
            return
2953
2830
        if not name_pattern_list:
2954
 
            raise errors.BzrCommandError(gettext("ignore requires at least one "
2955
 
                "NAME_PATTERN or --default-rules."))
 
2831
            raise errors.BzrCommandError("ignore requires at least one "
 
2832
                "NAME_PATTERN or --default-rules.")
2956
2833
        name_pattern_list = [globbing.normalize_pattern(p)
2957
2834
                             for p in name_pattern_list]
2958
2835
        bad_patterns = ''
2959
 
        bad_patterns_count = 0
2960
2836
        for p in name_pattern_list:
2961
2837
            if not globbing.Globster.is_pattern_valid(p):
2962
 
                bad_patterns_count += 1
2963
2838
                bad_patterns += ('\n  %s' % p)
2964
2839
        if bad_patterns:
2965
 
            msg = (ngettext('Invalid ignore pattern found. %s', 
2966
 
                            'Invalid ignore patterns found. %s',
2967
 
                            bad_patterns_count) % bad_patterns)
 
2840
            msg = ('Invalid ignore pattern(s) found. %s' % bad_patterns)
2968
2841
            ui.ui_factory.show_error(msg)
2969
2842
            raise errors.InvalidPattern('')
2970
2843
        for name_pattern in name_pattern_list:
2971
2844
            if (name_pattern[0] == '/' or
2972
2845
                (len(name_pattern) > 1 and name_pattern[1] == ':')):
2973
 
                raise errors.BzrCommandError(gettext(
2974
 
                    "NAME_PATTERN should not be an absolute path"))
 
2846
                raise errors.BzrCommandError(
 
2847
                    "NAME_PATTERN should not be an absolute path")
2975
2848
        tree, relpath = WorkingTree.open_containing(directory)
2976
2849
        ignores.tree_ignores_add_patterns(tree, name_pattern_list)
2977
2850
        ignored = globbing.Globster(name_pattern_list)
2984
2857
                if ignored.match(filename):
2985
2858
                    matches.append(filename)
2986
2859
        if len(matches) > 0:
2987
 
            self.outf.write(gettext("Warning: the following files are version "
2988
 
                  "controlled and match your ignore pattern:\n%s"
 
2860
            self.outf.write("Warning: the following files are version controlled and"
 
2861
                  " match your ignore pattern:\n%s"
2989
2862
                  "\nThese files will continue to be version controlled"
2990
 
                  " unless you 'bzr remove' them.\n") % ("\n".join(matches),))
 
2863
                  " unless you 'bzr remove' them.\n" % ("\n".join(matches),))
2991
2864
 
2992
2865
 
2993
2866
class cmd_ignored(Command):
3032
2905
        try:
3033
2906
            revno = int(revno)
3034
2907
        except ValueError:
3035
 
            raise errors.BzrCommandError(gettext("not a valid revision-number: %r")
 
2908
            raise errors.BzrCommandError("not a valid revision-number: %r"
3036
2909
                                         % revno)
3037
2910
        revid = WorkingTree.open_containing(directory)[0].branch.get_rev_id(revno)
3038
2911
        self.outf.write("%s\n" % revid)
3099
2972
            export(rev_tree, dest, format, root, subdir, filtered=filters,
3100
2973
                   per_file_timestamps=per_file_timestamps)
3101
2974
        except errors.NoSuchExportFormat, e:
3102
 
            raise errors.BzrCommandError(gettext('Unsupported export format: %s') % e.format)
 
2975
            raise errors.BzrCommandError('Unsupported export format: %s' % e.format)
3103
2976
 
3104
2977
 
3105
2978
class cmd_cat(Command):
3125
2998
    def run(self, filename, revision=None, name_from_revision=False,
3126
2999
            filters=False, directory=None):
3127
3000
        if revision is not None and len(revision) != 1:
3128
 
            raise errors.BzrCommandError(gettext("bzr cat --revision takes exactly"
3129
 
                                         " one revision specifier"))
 
3001
            raise errors.BzrCommandError("bzr cat --revision takes exactly"
 
3002
                                         " one revision specifier")
3130
3003
        tree, branch, relpath = \
3131
3004
            _open_directory_or_containing_tree_or_branch(filename, directory)
3132
3005
        self.add_cleanup(branch.lock_read().unlock)
3142
3015
 
3143
3016
        old_file_id = rev_tree.path2id(relpath)
3144
3017
 
3145
 
        # TODO: Split out this code to something that generically finds the
3146
 
        # best id for a path across one or more trees; it's like
3147
 
        # find_ids_across_trees but restricted to find just one. -- mbp
3148
 
        # 20110705.
3149
3018
        if name_from_revision:
3150
3019
            # Try in revision if requested
3151
3020
            if old_file_id is None:
3152
 
                raise errors.BzrCommandError(gettext(
3153
 
                    "{0!r} is not present in revision {1}").format(
 
3021
                raise errors.BzrCommandError(
 
3022
                    "%r is not present in revision %s" % (
3154
3023
                        filename, rev_tree.get_revision_id()))
3155
3024
            else:
3156
 
                actual_file_id = old_file_id
 
3025
                content = rev_tree.get_file_text(old_file_id)
3157
3026
        else:
3158
3027
            cur_file_id = tree.path2id(relpath)
3159
 
            if cur_file_id is not None and rev_tree.has_id(cur_file_id):
3160
 
                actual_file_id = cur_file_id
3161
 
            elif old_file_id is not None:
3162
 
                actual_file_id = old_file_id
3163
 
            else:
3164
 
                raise errors.BzrCommandError(gettext(
3165
 
                    "{0!r} is not present in revision {1}").format(
 
3028
            found = False
 
3029
            if cur_file_id is not None:
 
3030
                # Then try with the actual file id
 
3031
                try:
 
3032
                    content = rev_tree.get_file_text(cur_file_id)
 
3033
                    found = True
 
3034
                except errors.NoSuchId:
 
3035
                    # The actual file id didn't exist at that time
 
3036
                    pass
 
3037
            if not found and old_file_id is not None:
 
3038
                # Finally try with the old file id
 
3039
                content = rev_tree.get_file_text(old_file_id)
 
3040
                found = True
 
3041
            if not found:
 
3042
                # Can't be found anywhere
 
3043
                raise errors.BzrCommandError(
 
3044
                    "%r is not present in revision %s" % (
3166
3045
                        filename, rev_tree.get_revision_id()))
3167
3046
        if filtered:
3168
 
            from bzrlib.filter_tree import ContentFilterTree
3169
 
            filter_tree = ContentFilterTree(rev_tree,
3170
 
                rev_tree._content_filter_stack)
3171
 
            content = filter_tree.get_file_text(actual_file_id)
 
3047
            from bzrlib.filters import (
 
3048
                ContentFilterContext,
 
3049
                filtered_output_bytes,
 
3050
                )
 
3051
            filters = rev_tree._content_filter_stack(relpath)
 
3052
            chunks = content.splitlines(True)
 
3053
            content = filtered_output_bytes(chunks, filters,
 
3054
                ContentFilterContext(relpath, rev_tree))
 
3055
            self.cleanup_now()
 
3056
            self.outf.writelines(content)
3172
3057
        else:
3173
 
            content = rev_tree.get_file_text(actual_file_id)
3174
 
        self.cleanup_now()
3175
 
        self.outf.write(content)
 
3058
            self.cleanup_now()
 
3059
            self.outf.write(content)
3176
3060
 
3177
3061
 
3178
3062
class cmd_local_time_offset(Command):
3285
3169
    aliases = ['ci', 'checkin']
3286
3170
 
3287
3171
    def _iter_bug_fix_urls(self, fixes, branch):
3288
 
        default_bugtracker  = None
3289
3172
        # Configure the properties for bug fixing attributes.
3290
3173
        for fixed_bug in fixes:
3291
3174
            tokens = fixed_bug.split(':')
3292
 
            if len(tokens) == 1:
3293
 
                if default_bugtracker is None:
3294
 
                    branch_config = branch.get_config()
3295
 
                    default_bugtracker = branch_config.get_user_option(
3296
 
                        "bugtracker")
3297
 
                if default_bugtracker is None:
3298
 
                    raise errors.BzrCommandError(gettext(
3299
 
                        "No tracker specified for bug %s. Use the form "
3300
 
                        "'tracker:id' or specify a default bug tracker "
3301
 
                        "using the `bugtracker` option.\nSee "
3302
 
                        "\"bzr help bugs\" for more information on this "
3303
 
                        "feature. Commit refused.") % fixed_bug)
3304
 
                tag = default_bugtracker
3305
 
                bug_id = tokens[0]
3306
 
            elif len(tokens) != 2:
3307
 
                raise errors.BzrCommandError(gettext(
 
3175
            if len(tokens) != 2:
 
3176
                raise errors.BzrCommandError(
3308
3177
                    "Invalid bug %s. Must be in the form of 'tracker:id'. "
3309
3178
                    "See \"bzr help bugs\" for more information on this "
3310
 
                    "feature.\nCommit refused.") % fixed_bug)
3311
 
            else:
3312
 
                tag, bug_id = tokens
 
3179
                    "feature.\nCommit refused." % fixed_bug)
 
3180
            tag, bug_id = tokens
3313
3181
            try:
3314
3182
                yield bugtracker.get_bug_url(tag, branch, bug_id)
3315
3183
            except errors.UnknownBugTrackerAbbreviation:
3316
 
                raise errors.BzrCommandError(gettext(
3317
 
                    'Unrecognized bug %s. Commit refused.') % fixed_bug)
 
3184
                raise errors.BzrCommandError(
 
3185
                    'Unrecognized bug %s. Commit refused.' % fixed_bug)
3318
3186
            except errors.MalformedBugIdentifier, e:
3319
 
                raise errors.BzrCommandError(gettext(
3320
 
                    "%s\nCommit refused.") % (str(e),))
 
3187
                raise errors.BzrCommandError(
 
3188
                    "%s\nCommit refused." % (str(e),))
3321
3189
 
3322
3190
    def run(self, message=None, file=None, verbose=False, selected_list=None,
3323
3191
            unchanged=False, strict=False, local=False, fixes=None,
3331
3199
        from bzrlib.msgeditor import (
3332
3200
            edit_commit_message_encoded,
3333
3201
            generate_commit_message_template,
3334
 
            make_commit_message_template_encoded,
3335
 
            set_commit_message,
 
3202
            make_commit_message_template_encoded
3336
3203
        )
3337
3204
 
3338
3205
        commit_stamp = offset = None
3340
3207
            try:
3341
3208
                commit_stamp, offset = timestamp.parse_patch_date(commit_time)
3342
3209
            except ValueError, e:
3343
 
                raise errors.BzrCommandError(gettext(
3344
 
                    "Could not parse --commit-time: " + str(e)))
 
3210
                raise errors.BzrCommandError(
 
3211
                    "Could not parse --commit-time: " + str(e))
3345
3212
 
3346
3213
        properties = {}
3347
3214
 
3380
3247
                message = message.replace('\r\n', '\n')
3381
3248
                message = message.replace('\r', '\n')
3382
3249
            if file:
3383
 
                raise errors.BzrCommandError(gettext(
3384
 
                    "please specify either --message or --file"))
 
3250
                raise errors.BzrCommandError(
 
3251
                    "please specify either --message or --file")
3385
3252
 
3386
3253
        def get_message(commit_obj):
3387
3254
            """Callback to get commit message"""
3404
3271
                # make_commit_message_template_encoded returns user encoding.
3405
3272
                # We probably want to be using edit_commit_message instead to
3406
3273
                # avoid this.
3407
 
                my_message = set_commit_message(commit_obj)
3408
 
                if my_message is None:
3409
 
                    start_message = generate_commit_message_template(commit_obj)
3410
 
                    my_message = edit_commit_message_encoded(text,
3411
 
                        start_message=start_message)
3412
 
                if my_message is None:
3413
 
                    raise errors.BzrCommandError(gettext("please specify a commit"
3414
 
                        " message with either --message or --file"))
3415
 
                if my_message == "":
3416
 
                    raise errors.BzrCommandError(gettext("Empty commit message specified."
3417
 
                            " Please specify a commit message with either"
3418
 
                            " --message or --file or leave a blank message"
3419
 
                            " with --message \"\"."))
 
3274
                start_message = generate_commit_message_template(commit_obj)
 
3275
                my_message = edit_commit_message_encoded(text,
 
3276
                    start_message=start_message)
 
3277
                if my_message is None:
 
3278
                    raise errors.BzrCommandError("please specify a commit"
 
3279
                        " message with either --message or --file")
 
3280
            if my_message == "":
 
3281
                raise errors.BzrCommandError("empty commit message specified")
3420
3282
            return my_message
3421
3283
 
3422
3284
        # The API permits a commit with a filter of [] to mean 'select nothing'
3433
3295
                        exclude=tree.safe_relpath_files(exclude),
3434
3296
                        lossy=lossy)
3435
3297
        except PointlessCommit:
3436
 
            raise errors.BzrCommandError(gettext("No changes to commit."
 
3298
            raise errors.BzrCommandError("No changes to commit."
3437
3299
                " Please 'bzr add' the files you want to commit, or use"
3438
 
                " --unchanged to force an empty commit."))
 
3300
                " --unchanged to force an empty commit.")
3439
3301
        except ConflictsInTree:
3440
 
            raise errors.BzrCommandError(gettext('Conflicts detected in working '
 
3302
            raise errors.BzrCommandError('Conflicts detected in working '
3441
3303
                'tree.  Use "bzr conflicts" to list, "bzr resolve FILE" to'
3442
 
                ' resolve.'))
 
3304
                ' resolve.')
3443
3305
        except StrictCommitFailed:
3444
 
            raise errors.BzrCommandError(gettext("Commit refused because there are"
3445
 
                              " unknown files in the working tree."))
 
3306
            raise errors.BzrCommandError("Commit refused because there are"
 
3307
                              " unknown files in the working tree.")
3446
3308
        except errors.BoundBranchOutOfDate, e:
3447
 
            e.extra_help = (gettext("\n"
 
3309
            e.extra_help = ("\n"
3448
3310
                'To commit to master branch, run update and then commit.\n'
3449
3311
                'You can also pass --local to commit to continue working '
3450
 
                'disconnected.'))
 
3312
                'disconnected.')
3451
3313
            raise
3452
3314
 
3453
3315
 
3620
3482
            return
3621
3483
 
3622
3484
        if email:
3623
 
            raise errors.BzrCommandError(gettext("--email can only be used to display existing "
3624
 
                                         "identity"))
 
3485
            raise errors.BzrCommandError("--email can only be used to display existing "
 
3486
                                         "identity")
3625
3487
 
3626
3488
        # display a warning if an email address isn't included in the given name.
3627
3489
        try:
3706
3568
 
3707
3569
    def remove_alias(self, alias_name):
3708
3570
        if alias_name is None:
3709
 
            raise errors.BzrCommandError(gettext(
3710
 
                'bzr alias --remove expects an alias to remove.'))
 
3571
            raise errors.BzrCommandError(
 
3572
                'bzr alias --remove expects an alias to remove.')
3711
3573
        # If alias is not found, print something like:
3712
3574
        # unalias: foo: not found
3713
3575
        c = _mod_config.GlobalConfig()
3851
3713
                                param_name='starting_with', short_name='s',
3852
3714
                                help=
3853
3715
                                'Load only the tests starting with TESTID.'),
3854
 
                     Option('sync',
3855
 
                            help="By default we disable fsync and fdatasync"
3856
 
                                 " while running the test suite.")
3857
3716
                     ]
3858
3717
    encoding_type = 'replace'
3859
3718
 
3867
3726
            first=False, list_only=False,
3868
3727
            randomize=None, exclude=None, strict=False,
3869
3728
            load_list=None, debugflag=None, starting_with=None, subunit=False,
3870
 
            parallel=None, lsprof_tests=False,
3871
 
            sync=False):
 
3729
            parallel=None, lsprof_tests=False):
3872
3730
        from bzrlib import tests
3873
3731
 
3874
3732
        if testspecs_list is not None:
3879
3737
            try:
3880
3738
                from bzrlib.tests import SubUnitBzrRunner
3881
3739
            except ImportError:
3882
 
                raise errors.BzrCommandError(gettext("subunit not available. subunit "
3883
 
                    "needs to be installed to use --subunit."))
 
3740
                raise errors.BzrCommandError("subunit not available. subunit "
 
3741
                    "needs to be installed to use --subunit.")
3884
3742
            self.additional_selftest_args['runner_class'] = SubUnitBzrRunner
3885
3743
            # On Windows, disable automatic conversion of '\n' to '\r\n' in
3886
3744
            # stdout, which would corrupt the subunit stream. 
3895
3753
            self.additional_selftest_args.setdefault(
3896
3754
                'suite_decorators', []).append(parallel)
3897
3755
        if benchmark:
3898
 
            raise errors.BzrCommandError(gettext(
 
3756
            raise errors.BzrCommandError(
3899
3757
                "--benchmark is no longer supported from bzr 2.2; "
3900
 
                "use bzr-usertest instead"))
 
3758
                "use bzr-usertest instead")
3901
3759
        test_suite_factory = None
3902
3760
        if not exclude:
3903
3761
            exclude_pattern = None
3904
3762
        else:
3905
3763
            exclude_pattern = '(' + '|'.join(exclude) + ')'
3906
 
        if not sync:
3907
 
            self._disable_fsync()
3908
3764
        selftest_kwargs = {"verbose": verbose,
3909
3765
                          "pattern": pattern,
3910
3766
                          "stop_on_failure": one,
3932
3788
            cleanup()
3933
3789
        return int(not result)
3934
3790
 
3935
 
    def _disable_fsync(self):
3936
 
        """Change the 'os' functionality to not synchronize."""
3937
 
        self._orig_fsync = getattr(os, 'fsync', None)
3938
 
        if self._orig_fsync is not None:
3939
 
            os.fsync = lambda filedes: None
3940
 
        self._orig_fdatasync = getattr(os, 'fdatasync', None)
3941
 
        if self._orig_fdatasync is not None:
3942
 
            os.fdatasync = lambda filedes: None
3943
 
 
3944
3791
 
3945
3792
class cmd_version(Command):
3946
3793
    __doc__ = """Show version of bzr."""
3966
3813
 
3967
3814
    @display_command
3968
3815
    def run(self):
3969
 
        self.outf.write(gettext("It sure does!\n"))
 
3816
        self.outf.write("It sure does!\n")
3970
3817
 
3971
3818
 
3972
3819
class cmd_find_merge_base(Command):
3990
3837
        graph = branch1.repository.get_graph(branch2.repository)
3991
3838
        base_rev_id = graph.find_unique_lca(last1, last2)
3992
3839
 
3993
 
        self.outf.write(gettext('merge base is revision %s\n') % base_rev_id)
 
3840
        self.outf.write('merge base is revision %s\n' % base_rev_id)
3994
3841
 
3995
3842
 
3996
3843
class cmd_merge(Command):
4029
3876
    Use bzr resolve when you have fixed a problem.  See also bzr conflicts.
4030
3877
 
4031
3878
    If there is no default branch set, the first merge will set it (use
4032
 
    --no-remember to avoid setting it). After that, you can omit the branch
 
3879
    --no-remember to avoid settting it). After that, you can omit the branch
4033
3880
    to use the default.  To change the default, use --remember. The value will
4034
3881
    only be saved if the remote location can be accessed.
4035
3882
 
4038
3885
    committed to record the result of the merge.
4039
3886
 
4040
3887
    merge refuses to run if there are any uncommitted changes, unless
4041
 
    --force is given.  If --force is given, then the changes from the source 
4042
 
    will be merged with the current working tree, including any uncommitted
4043
 
    changes in the tree.  The --force option can also be used to create a
 
3888
    --force is given. The --force option can also be used to create a
4044
3889
    merge revision which has more than two parents.
4045
3890
 
4046
3891
    If one would like to merge changes from the working tree of the other
4121
3966
 
4122
3967
        tree = WorkingTree.open_containing(directory)[0]
4123
3968
        if tree.branch.revno() == 0:
4124
 
            raise errors.BzrCommandError(gettext('Merging into empty branches not currently supported, '
4125
 
                                         'https://bugs.launchpad.net/bzr/+bug/308562'))
 
3969
            raise errors.BzrCommandError('Merging into empty branches not currently supported, '
 
3970
                                         'https://bugs.launchpad.net/bzr/+bug/308562')
4126
3971
 
4127
3972
        try:
4128
3973
            basis_tree = tree.revision_tree(tree.last_revision())
4148
3993
                mergeable = None
4149
3994
            else:
4150
3995
                if uncommitted:
4151
 
                    raise errors.BzrCommandError(gettext('Cannot use --uncommitted'
4152
 
                        ' with bundles or merge directives.'))
 
3996
                    raise errors.BzrCommandError('Cannot use --uncommitted'
 
3997
                        ' with bundles or merge directives.')
4153
3998
 
4154
3999
                if revision is not None:
4155
 
                    raise errors.BzrCommandError(gettext(
4156
 
                        'Cannot use -r with merge directives or bundles'))
 
4000
                    raise errors.BzrCommandError(
 
4001
                        'Cannot use -r with merge directives or bundles')
4157
4002
                merger, verified = _mod_merge.Merger.from_mergeable(tree,
4158
4003
                   mergeable, None)
4159
4004
 
4160
4005
        if merger is None and uncommitted:
4161
4006
            if revision is not None and len(revision) > 0:
4162
 
                raise errors.BzrCommandError(gettext('Cannot use --uncommitted and'
4163
 
                    ' --revision at the same time.'))
 
4007
                raise errors.BzrCommandError('Cannot use --uncommitted and'
 
4008
                    ' --revision at the same time.')
4164
4009
            merger = self.get_merger_from_uncommitted(tree, location, None)
4165
4010
            allow_pending = False
4166
4011
 
4179
4024
            if merger.interesting_files:
4180
4025
                if not merger.other_tree.has_filename(
4181
4026
                    merger.interesting_files[0]):
4182
 
                    note(gettext("merger: ") + str(merger))
 
4027
                    note("merger: " + str(merger))
4183
4028
                    raise errors.PathsDoNotExist([location])
4184
 
            note(gettext('Nothing to do.'))
 
4029
            note('Nothing to do.')
4185
4030
            return 0
4186
4031
        if pull and not preview:
4187
4032
            if merger.interesting_files is not None:
4188
 
                raise errors.BzrCommandError(gettext('Cannot pull individual files'))
 
4033
                raise errors.BzrCommandError('Cannot pull individual files')
4189
4034
            if (merger.base_rev_id == tree.last_revision()):
4190
4035
                result = tree.pull(merger.other_branch, False,
4191
4036
                                   merger.other_rev_id)
4192
4037
                result.report(self.outf)
4193
4038
                return 0
4194
4039
        if merger.this_basis is None:
4195
 
            raise errors.BzrCommandError(gettext(
 
4040
            raise errors.BzrCommandError(
4196
4041
                "This branch has no commits."
4197
 
                " (perhaps you would prefer 'bzr pull')"))
 
4042
                " (perhaps you would prefer 'bzr pull')")
4198
4043
        if preview:
4199
4044
            return self._do_preview(merger)
4200
4045
        elif interactive:
4251
4096
    def sanity_check_merger(self, merger):
4252
4097
        if (merger.show_base and
4253
4098
            not merger.merge_type is _mod_merge.Merge3Merger):
4254
 
            raise errors.BzrCommandError(gettext("Show-base is not supported for this"
4255
 
                                         " merge type. %s") % merger.merge_type)
 
4099
            raise errors.BzrCommandError("Show-base is not supported for this"
 
4100
                                         " merge type. %s" % merger.merge_type)
4256
4101
        if merger.reprocess is None:
4257
4102
            if merger.show_base:
4258
4103
                merger.reprocess = False
4260
4105
                # Use reprocess if the merger supports it
4261
4106
                merger.reprocess = merger.merge_type.supports_reprocess
4262
4107
        if merger.reprocess and not merger.merge_type.supports_reprocess:
4263
 
            raise errors.BzrCommandError(gettext("Conflict reduction is not supported"
4264
 
                                         " for merge type %s.") %
 
4108
            raise errors.BzrCommandError("Conflict reduction is not supported"
 
4109
                                         " for merge type %s." %
4265
4110
                                         merger.merge_type)
4266
4111
        if merger.reprocess and merger.show_base:
4267
 
            raise errors.BzrCommandError(gettext("Cannot do conflict reduction and"
4268
 
                                         " show base."))
 
4112
            raise errors.BzrCommandError("Cannot do conflict reduction and"
 
4113
                                         " show base.")
4269
4114
 
4270
4115
    def _get_merger_from_branch(self, tree, location, revision, remember,
4271
4116
                                possible_transports, pb):
4375
4220
            stored_location_type = "parent"
4376
4221
        mutter("%s", stored_location)
4377
4222
        if stored_location is None:
4378
 
            raise errors.BzrCommandError(gettext("No location specified or remembered"))
 
4223
            raise errors.BzrCommandError("No location specified or remembered")
4379
4224
        display_url = urlutils.unescape_for_display(stored_location, 'utf-8')
4380
 
        note(gettext("{0} remembered {1} location {2}").format(verb_string,
4381
 
                stored_location_type, display_url))
 
4225
        note(u"%s remembered %s location %s", verb_string,
 
4226
                stored_location_type, display_url)
4382
4227
        return stored_location
4383
4228
 
4384
4229
 
4421
4266
        self.add_cleanup(tree.lock_write().unlock)
4422
4267
        parents = tree.get_parent_ids()
4423
4268
        if len(parents) != 2:
4424
 
            raise errors.BzrCommandError(gettext("Sorry, remerge only works after normal"
 
4269
            raise errors.BzrCommandError("Sorry, remerge only works after normal"
4425
4270
                                         " merges.  Not cherrypicking or"
4426
 
                                         " multi-merges."))
 
4271
                                         " multi-merges.")
4427
4272
        repository = tree.branch.repository
4428
4273
        interesting_ids = None
4429
4274
        new_conflicts = []
4648
4493
            type=_parse_revision_str,
4649
4494
            help='Filter on local branch revisions (inclusive). '
4650
4495
                'See "help revisionspec" for details.'),
4651
 
        Option('include-merged',
 
4496
        Option('include-merges',
4652
4497
               'Show all revisions in addition to the mainline ones.'),
4653
 
        Option('include-merges', hidden=True,
4654
 
               help='Historical alias for --include-merged.'),
4655
4498
        ]
4656
4499
    encoding_type = 'replace'
4657
4500
 
4660
4503
            theirs_only=False,
4661
4504
            log_format=None, long=False, short=False, line=False,
4662
4505
            show_ids=False, verbose=False, this=False, other=False,
4663
 
            include_merged=None, revision=None, my_revision=None,
4664
 
            directory=u'.',
4665
 
            include_merges=symbol_versioning.DEPRECATED_PARAMETER):
 
4506
            include_merges=False, revision=None, my_revision=None,
 
4507
            directory=u'.'):
4666
4508
        from bzrlib.missing import find_unmerged, iter_log_revisions
4667
4509
        def message(s):
4668
4510
            if not is_quiet():
4669
4511
                self.outf.write(s)
4670
4512
 
4671
 
        if symbol_versioning.deprecated_passed(include_merges):
4672
 
            ui.ui_factory.show_user_warning(
4673
 
                'deprecated_command_option',
4674
 
                deprecated_name='--include-merges',
4675
 
                recommended_name='--include-merged',
4676
 
                deprecated_in_version='2.5',
4677
 
                command=self.invoked_as)
4678
 
            if include_merged is None:
4679
 
                include_merged = include_merges
4680
 
            else:
4681
 
                raise errors.BzrCommandError(gettext(
4682
 
                    '{0} and {1} are mutually exclusive').format(
4683
 
                    '--include-merges', '--include-merged'))
4684
 
        if include_merged is None:
4685
 
            include_merged = False
4686
4513
        if this:
4687
4514
            mine_only = this
4688
4515
        if other:
4703
4530
        if other_branch is None:
4704
4531
            other_branch = parent
4705
4532
            if other_branch is None:
4706
 
                raise errors.BzrCommandError(gettext("No peer location known"
4707
 
                                             " or specified."))
 
4533
                raise errors.BzrCommandError("No peer location known"
 
4534
                                             " or specified.")
4708
4535
            display_url = urlutils.unescape_for_display(parent,
4709
4536
                                                        self.outf.encoding)
4710
 
            message(gettext("Using saved parent location: {0}\n").format(
4711
 
                    display_url))
 
4537
            message("Using saved parent location: "
 
4538
                    + display_url + "\n")
4712
4539
 
4713
4540
        remote_branch = Branch.open(other_branch)
4714
4541
        if remote_branch.base == local_branch.base:
4727
4554
        local_extra, remote_extra = find_unmerged(
4728
4555
            local_branch, remote_branch, restrict,
4729
4556
            backward=not reverse,
4730
 
            include_merged=include_merged,
 
4557
            include_merges=include_merges,
4731
4558
            local_revid_range=local_revid_range,
4732
4559
            remote_revid_range=remote_revid_range)
4733
4560
 
4740
4567
 
4741
4568
        status_code = 0
4742
4569
        if local_extra and not theirs_only:
4743
 
            message(ngettext("You have %d extra revision:\n",
4744
 
                             "You have %d extra revisions:\n", 
4745
 
                             len(local_extra)) %
 
4570
            message("You have %d extra revision(s):\n" %
4746
4571
                len(local_extra))
4747
4572
            for revision in iter_log_revisions(local_extra,
4748
4573
                                local_branch.repository,
4756
4581
        if remote_extra and not mine_only:
4757
4582
            if printed_local is True:
4758
4583
                message("\n\n\n")
4759
 
            message(ngettext("You are missing %d revision:\n",
4760
 
                             "You are missing %d revisions:\n",
4761
 
                             len(remote_extra)) %
 
4584
            message("You are missing %d revision(s):\n" %
4762
4585
                len(remote_extra))
4763
4586
            for revision in iter_log_revisions(remote_extra,
4764
4587
                                remote_branch.repository,
4768
4591
 
4769
4592
        if mine_only and not local_extra:
4770
4593
            # We checked local, and found nothing extra
4771
 
            message(gettext('This branch has no new revisions.\n'))
 
4594
            message('This branch is up to date.\n')
4772
4595
        elif theirs_only and not remote_extra:
4773
4596
            # We checked remote, and found nothing extra
4774
 
            message(gettext('Other branch has no new revisions.\n'))
 
4597
            message('Other branch is up to date.\n')
4775
4598
        elif not (mine_only or theirs_only or local_extra or
4776
4599
                  remote_extra):
4777
4600
            # We checked both branches, and neither one had extra
4778
4601
            # revisions
4779
 
            message(gettext("Branches are up to date.\n"))
 
4602
            message("Branches are up to date.\n")
4780
4603
        self.cleanup_now()
4781
4604
        if not status_code and parent is None and other_branch is not None:
4782
4605
            self.add_cleanup(local_branch.lock_write().unlock)
4943
4766
 
4944
4767
    def run(self, revision_id_list=None, revision=None, directory=u'.'):
4945
4768
        if revision_id_list is not None and revision is not None:
4946
 
            raise errors.BzrCommandError(gettext('You can only supply one of revision_id or --revision'))
 
4769
            raise errors.BzrCommandError('You can only supply one of revision_id or --revision')
4947
4770
        if revision_id_list is None and revision is None:
4948
 
            raise errors.BzrCommandError(gettext('You must supply either --revision or a revision_id'))
 
4771
            raise errors.BzrCommandError('You must supply either --revision or a revision_id')
4949
4772
        b = WorkingTree.open_containing(directory)[0].branch
4950
4773
        self.add_cleanup(b.lock_write().unlock)
4951
4774
        return self._run(b, revision_id_list, revision)
4983
4806
                if to_revid is None:
4984
4807
                    to_revno = b.revno()
4985
4808
                if from_revno is None or to_revno is None:
4986
 
                    raise errors.BzrCommandError(gettext('Cannot sign a range of non-revision-history revisions'))
 
4809
                    raise errors.BzrCommandError('Cannot sign a range of non-revision-history revisions')
4987
4810
                b.repository.start_write_group()
4988
4811
                try:
4989
4812
                    for revno in range(from_revno, to_revno + 1):
4995
4818
                else:
4996
4819
                    b.repository.commit_write_group()
4997
4820
            else:
4998
 
                raise errors.BzrCommandError(gettext('Please supply either one revision, or a range.'))
 
4821
                raise errors.BzrCommandError('Please supply either one revision, or a range.')
4999
4822
 
5000
4823
 
5001
4824
class cmd_bind(Command):
5020
4843
            try:
5021
4844
                location = b.get_old_bound_location()
5022
4845
            except errors.UpgradeRequired:
5023
 
                raise errors.BzrCommandError(gettext('No location supplied.  '
5024
 
                    'This format does not remember old locations.'))
 
4846
                raise errors.BzrCommandError('No location supplied.  '
 
4847
                    'This format does not remember old locations.')
5025
4848
            else:
5026
4849
                if location is None:
5027
4850
                    if b.get_bound_location() is not None:
5028
 
                        raise errors.BzrCommandError(gettext('Branch is already bound'))
 
4851
                        raise errors.BzrCommandError('Branch is already bound')
5029
4852
                    else:
5030
 
                        raise errors.BzrCommandError(gettext('No location supplied '
5031
 
                            'and no previous location known'))
 
4853
                        raise errors.BzrCommandError('No location supplied '
 
4854
                            'and no previous location known')
5032
4855
        b_other = Branch.open(location)
5033
4856
        try:
5034
4857
            b.bind(b_other)
5035
4858
        except errors.DivergedBranches:
5036
 
            raise errors.BzrCommandError(gettext('These branches have diverged.'
5037
 
                                         ' Try merging, and then bind again.'))
 
4859
            raise errors.BzrCommandError('These branches have diverged.'
 
4860
                                         ' Try merging, and then bind again.')
5038
4861
        if b.get_config().has_explicit_nickname():
5039
4862
            b.nick = b_other.nick
5040
4863
 
5053
4876
    def run(self, directory=u'.'):
5054
4877
        b, relpath = Branch.open_containing(directory)
5055
4878
        if not b.unbind():
5056
 
            raise errors.BzrCommandError(gettext('Local branch is not bound'))
 
4879
            raise errors.BzrCommandError('Local branch is not bound')
5057
4880
 
5058
4881
 
5059
4882
class cmd_uncommit(Command):
5080
4903
    takes_options = ['verbose', 'revision',
5081
4904
                    Option('dry-run', help='Don\'t actually make changes.'),
5082
4905
                    Option('force', help='Say yes to all questions.'),
5083
 
                    Option('keep-tags',
5084
 
                           help='Keep tags that point to removed revisions.'),
5085
4906
                    Option('local',
5086
4907
                           help="Only remove the commits from the local branch"
5087
4908
                                " when in a checkout."
5091
4912
    aliases = []
5092
4913
    encoding_type = 'replace'
5093
4914
 
5094
 
    def run(self, location=None, dry_run=False, verbose=False,
5095
 
            revision=None, force=False, local=False, keep_tags=False):
 
4915
    def run(self, location=None,
 
4916
            dry_run=False, verbose=False,
 
4917
            revision=None, force=False, local=False):
5096
4918
        if location is None:
5097
4919
            location = u'.'
5098
4920
        control, relpath = bzrdir.BzrDir.open_containing(location)
5107
4929
            self.add_cleanup(tree.lock_write().unlock)
5108
4930
        else:
5109
4931
            self.add_cleanup(b.lock_write().unlock)
5110
 
        return self._run(b, tree, dry_run, verbose, revision, force,
5111
 
                         local, keep_tags)
 
4932
        return self._run(b, tree, dry_run, verbose, revision, force, local=local)
5112
4933
 
5113
 
    def _run(self, b, tree, dry_run, verbose, revision, force, local,
5114
 
             keep_tags):
 
4934
    def _run(self, b, tree, dry_run, verbose, revision, force, local=False):
5115
4935
        from bzrlib.log import log_formatter, show_log
5116
4936
        from bzrlib.uncommit import uncommit
5117
4937
 
5132
4952
                rev_id = b.get_rev_id(revno)
5133
4953
 
5134
4954
        if rev_id is None or _mod_revision.is_null(rev_id):
5135
 
            self.outf.write(gettext('No revisions to uncommit.\n'))
 
4955
            self.outf.write('No revisions to uncommit.\n')
5136
4956
            return 1
5137
4957
 
5138
4958
        lf = log_formatter('short',
5147
4967
                 end_revision=last_revno)
5148
4968
 
5149
4969
        if dry_run:
5150
 
            self.outf.write(gettext('Dry-run, pretending to remove'
5151
 
                            ' the above revisions.\n'))
 
4970
            self.outf.write('Dry-run, pretending to remove'
 
4971
                            ' the above revisions.\n')
5152
4972
        else:
5153
 
            self.outf.write(gettext('The above revision(s) will be removed.\n'))
 
4973
            self.outf.write('The above revision(s) will be removed.\n')
5154
4974
 
5155
4975
        if not force:
5156
4976
            if not ui.ui_factory.confirm_action(
5157
 
                    gettext(u'Uncommit these revisions'),
 
4977
                    u'Uncommit these revisions',
5158
4978
                    'bzrlib.builtins.uncommit',
5159
4979
                    {}):
5160
 
                self.outf.write(gettext('Canceled\n'))
 
4980
                self.outf.write('Canceled\n')
5161
4981
                return 0
5162
4982
 
5163
4983
        mutter('Uncommitting from {%s} to {%s}',
5164
4984
               last_rev_id, rev_id)
5165
4985
        uncommit(b, tree=tree, dry_run=dry_run, verbose=verbose,
5166
 
                 revno=revno, local=local, keep_tags=keep_tags)
5167
 
        self.outf.write(gettext('You can restore the old tip by running:\n'
5168
 
             '  bzr pull . -r revid:%s\n') % last_rev_id)
 
4986
                 revno=revno, local=local)
 
4987
        self.outf.write('You can restore the old tip by running:\n'
 
4988
             '  bzr pull . -r revid:%s\n' % last_rev_id)
5169
4989
 
5170
4990
 
5171
4991
class cmd_break_lock(Command):
5255
5075
                    'option leads to global uncontrolled write access to your '
5256
5076
                    'file system.'
5257
5077
                ),
5258
 
        Option('client-timeout', type=float,
5259
 
               help='Override the default idle client timeout (5min).'),
5260
5078
        ]
5261
5079
 
5262
5080
    def get_host_and_port(self, port):
5279
5097
        return host, port
5280
5098
 
5281
5099
    def run(self, port=None, inet=False, directory=None, allow_writes=False,
5282
 
            protocol=None, client_timeout=None):
 
5100
            protocol=None):
5283
5101
        from bzrlib import transport
5284
5102
        if directory is None:
5285
5103
            directory = os.getcwd()
5290
5108
        if not allow_writes:
5291
5109
            url = 'readonly+' + url
5292
5110
        t = transport.get_transport(url)
5293
 
        try:
5294
 
            protocol(t, host, port, inet, client_timeout)
5295
 
        except TypeError, e:
5296
 
            # We use symbol_versioning.deprecated_in just so that people
5297
 
            # grepping can find it here.
5298
 
            # symbol_versioning.deprecated_in((2, 5, 0))
5299
 
            symbol_versioning.warn(
5300
 
                'Got TypeError(%s)\ntrying to call protocol: %s.%s\n'
5301
 
                'Most likely it needs to be updated to support a'
5302
 
                ' "timeout" parameter (added in bzr 2.5.0)'
5303
 
                % (e, protocol.__module__, protocol),
5304
 
                DeprecationWarning)
5305
 
            protocol(t, host, port, inet)
 
5111
        protocol(t, host, port, inet)
5306
5112
 
5307
5113
 
5308
5114
class cmd_join(Command):
5331
5137
        containing_tree = WorkingTree.open_containing(parent_dir)[0]
5332
5138
        repo = containing_tree.branch.repository
5333
5139
        if not repo.supports_rich_root():
5334
 
            raise errors.BzrCommandError(gettext(
 
5140
            raise errors.BzrCommandError(
5335
5141
                "Can't join trees because %s doesn't support rich root data.\n"
5336
 
                "You can use bzr upgrade on the repository.")
 
5142
                "You can use bzr upgrade on the repository."
5337
5143
                % (repo,))
5338
5144
        if reference:
5339
5145
            try:
5341
5147
            except errors.BadReferenceTarget, e:
5342
5148
                # XXX: Would be better to just raise a nicely printable
5343
5149
                # exception from the real origin.  Also below.  mbp 20070306
5344
 
                raise errors.BzrCommandError(
5345
 
                       gettext("Cannot join {0}.  {1}").format(tree, e.reason))
 
5150
                raise errors.BzrCommandError("Cannot join %s.  %s" %
 
5151
                                             (tree, e.reason))
5346
5152
        else:
5347
5153
            try:
5348
5154
                containing_tree.subsume(sub_tree)
5349
5155
            except errors.BadSubsumeSource, e:
5350
 
                raise errors.BzrCommandError(
5351
 
                       gettext("Cannot join {0}.  {1}").format(tree, e.reason))
 
5156
                raise errors.BzrCommandError("Cannot join %s.  %s" %
 
5157
                                             (tree, e.reason))
5352
5158
 
5353
5159
 
5354
5160
class cmd_split(Command):
5438
5244
        if submit_branch is None:
5439
5245
            submit_branch = branch.get_parent()
5440
5246
        if submit_branch is None:
5441
 
            raise errors.BzrCommandError(gettext('No submit branch specified or known'))
 
5247
            raise errors.BzrCommandError('No submit branch specified or known')
5442
5248
 
5443
5249
        stored_public_branch = branch.get_public_branch()
5444
5250
        if public_branch is None:
5446
5252
        elif stored_public_branch is None:
5447
5253
            branch.set_public_branch(public_branch)
5448
5254
        if not include_bundle and public_branch is None:
5449
 
            raise errors.BzrCommandError(gettext('No public branch specified or'
5450
 
                                         ' known'))
 
5255
            raise errors.BzrCommandError('No public branch specified or'
 
5256
                                         ' known')
5451
5257
        base_revision_id = None
5452
5258
        if revision is not None:
5453
5259
            if len(revision) > 2:
5454
 
                raise errors.BzrCommandError(gettext('bzr merge-directive takes '
5455
 
                    'at most two one revision identifiers'))
 
5260
                raise errors.BzrCommandError('bzr merge-directive takes '
 
5261
                    'at most two one revision identifiers')
5456
5262
            revision_id = revision[-1].as_revision_id(branch)
5457
5263
            if len(revision) == 2:
5458
5264
                base_revision_id = revision[0].as_revision_id(branch)
5460
5266
            revision_id = branch.last_revision()
5461
5267
        revision_id = ensure_null(revision_id)
5462
5268
        if revision_id == NULL_REVISION:
5463
 
            raise errors.BzrCommandError(gettext('No revisions to bundle.'))
 
5269
            raise errors.BzrCommandError('No revisions to bundle.')
5464
5270
        directive = merge_directive.MergeDirective2.from_objects(
5465
5271
            branch.repository, revision_id, time.time(),
5466
5272
            osutils.local_time_offset(), submit_branch,
5512
5318
 
5513
5319
    Both the submit branch and the public branch follow the usual behavior with
5514
5320
    respect to --remember: If there is no default location set, the first send
5515
 
    will set it (use --no-remember to avoid setting it). After that, you can
 
5321
    will set it (use --no-remember to avoid settting it). After that, you can
5516
5322
    omit the location to use the default.  To change the default, use
5517
5323
    --remember. The value will only be saved if the location can be accessed.
5518
5324
 
5720
5526
        self.add_cleanup(branch.lock_write().unlock)
5721
5527
        if delete:
5722
5528
            if tag_name is None:
5723
 
                raise errors.BzrCommandError(gettext("No tag specified to delete."))
 
5529
                raise errors.BzrCommandError("No tag specified to delete.")
5724
5530
            branch.tags.delete_tag(tag_name)
5725
 
            note(gettext('Deleted tag %s.') % tag_name)
 
5531
            note('Deleted tag %s.' % tag_name)
5726
5532
        else:
5727
5533
            if revision:
5728
5534
                if len(revision) != 1:
5729
 
                    raise errors.BzrCommandError(gettext(
 
5535
                    raise errors.BzrCommandError(
5730
5536
                        "Tags can only be placed on a single revision, "
5731
 
                        "not on a range"))
 
5537
                        "not on a range")
5732
5538
                revision_id = revision[0].as_revision_id(branch)
5733
5539
            else:
5734
5540
                revision_id = branch.last_revision()
5735
5541
            if tag_name is None:
5736
5542
                tag_name = branch.automatic_tag_name(revision_id)
5737
5543
                if tag_name is None:
5738
 
                    raise errors.BzrCommandError(gettext(
5739
 
                        "Please specify a tag name."))
5740
 
            try:
5741
 
                existing_target = branch.tags.lookup_tag(tag_name)
5742
 
            except errors.NoSuchTag:
5743
 
                existing_target = None
5744
 
            if not force and existing_target not in (None, revision_id):
 
5544
                    raise errors.BzrCommandError(
 
5545
                        "Please specify a tag name.")
 
5546
            if (not force) and branch.tags.has_tag(tag_name):
5745
5547
                raise errors.TagAlreadyExists(tag_name)
5746
 
            if existing_target == revision_id:
5747
 
                note(gettext('Tag %s already exists for that revision.') % tag_name)
5748
 
            else:
5749
 
                branch.tags.set_tag(tag_name, revision_id)
5750
 
                if existing_target is None:
5751
 
                    note(gettext('Created tag %s.') % tag_name)
5752
 
                else:
5753
 
                    note(gettext('Updated tag %s.') % tag_name)
 
5548
            branch.tags.set_tag(tag_name, revision_id)
 
5549
            note('Created tag %s.' % tag_name)
5754
5550
 
5755
5551
 
5756
5552
class cmd_tags(Command):
5782
5578
 
5783
5579
        self.add_cleanup(branch.lock_read().unlock)
5784
5580
        if revision:
5785
 
            # Restrict to the specified range
5786
 
            tags = self._tags_for_range(branch, revision)
 
5581
            graph = branch.repository.get_graph()
 
5582
            rev1, rev2 = _get_revision_range(revision, branch, self.name())
 
5583
            revid1, revid2 = rev1.rev_id, rev2.rev_id
 
5584
            # only show revisions between revid1 and revid2 (inclusive)
 
5585
            tags = [(tag, revid) for tag, revid in tags if
 
5586
                graph.is_between(revid, revid1, revid2)]
5787
5587
        if sort is None:
5788
5588
            sort = tag_sort_methods.get()
5789
5589
        sort(branch, tags)
5794
5594
                    revno = branch.revision_id_to_dotted_revno(revid)
5795
5595
                    if isinstance(revno, tuple):
5796
5596
                        revno = '.'.join(map(str, revno))
5797
 
                except (errors.NoSuchRevision,
5798
 
                        errors.GhostRevisionsHaveNoRevno):
 
5597
                except (errors.NoSuchRevision, errors.GhostRevisionsHaveNoRevno):
5799
5598
                    # Bad tag data/merges can lead to tagged revisions
5800
5599
                    # which are not in this branch. Fail gracefully ...
5801
5600
                    revno = '?'
5804
5603
        for tag, revspec in tags:
5805
5604
            self.outf.write('%-20s %s\n' % (tag, revspec))
5806
5605
 
5807
 
    def _tags_for_range(self, branch, revision):
5808
 
        range_valid = True
5809
 
        rev1, rev2 = _get_revision_range(revision, branch, self.name())
5810
 
        revid1, revid2 = rev1.rev_id, rev2.rev_id
5811
 
        # _get_revision_range will always set revid2 if it's not specified.
5812
 
        # If revid1 is None, it means we want to start from the branch
5813
 
        # origin which is always a valid ancestor. If revid1 == revid2, the
5814
 
        # ancestry check is useless.
5815
 
        if revid1 and revid1 != revid2:
5816
 
            # FIXME: We really want to use the same graph than
5817
 
            # branch.iter_merge_sorted_revisions below, but this is not
5818
 
            # easily available -- vila 2011-09-23
5819
 
            if branch.repository.get_graph().is_ancestor(revid2, revid1):
5820
 
                # We don't want to output anything in this case...
5821
 
                return []
5822
 
        # only show revisions between revid1 and revid2 (inclusive)
5823
 
        tagged_revids = branch.tags.get_reverse_tag_dict()
5824
 
        found = []
5825
 
        for r in branch.iter_merge_sorted_revisions(
5826
 
            start_revision_id=revid2, stop_revision_id=revid1,
5827
 
            stop_rule='include'):
5828
 
            revid_tags = tagged_revids.get(r[0], None)
5829
 
            if revid_tags:
5830
 
                found.extend([(tag, r[0]) for tag in revid_tags])
5831
 
        return found
5832
 
 
5833
5606
 
5834
5607
class cmd_reconfigure(Command):
5835
5608
    __doc__ = """Reconfigure the type of a bzr directory.
5849
5622
    takes_args = ['location?']
5850
5623
    takes_options = [
5851
5624
        RegistryOption.from_kwargs(
5852
 
            'tree_type',
5853
 
            title='Tree type',
5854
 
            help='The relation between branch and tree.',
 
5625
            'target_type',
 
5626
            title='Target type',
 
5627
            help='The type to reconfigure the directory to.',
5855
5628
            value_switches=True, enum_switch=False,
5856
5629
            branch='Reconfigure to be an unbound branch with no working tree.',
5857
5630
            tree='Reconfigure to be an unbound branch with a working tree.',
5858
5631
            checkout='Reconfigure to be a bound branch with a working tree.',
5859
5632
            lightweight_checkout='Reconfigure to be a lightweight'
5860
5633
                ' checkout (with no local history).',
5861
 
            ),
5862
 
        RegistryOption.from_kwargs(
5863
 
            'repository_type',
5864
 
            title='Repository type',
5865
 
            help='Location fo the repository.',
5866
 
            value_switches=True, enum_switch=False,
5867
5634
            standalone='Reconfigure to be a standalone branch '
5868
5635
                '(i.e. stop using shared repository).',
5869
5636
            use_shared='Reconfigure to use a shared repository.',
5870
 
            ),
5871
 
        RegistryOption.from_kwargs(
5872
 
            'repository_trees',
5873
 
            title='Trees in Repository',
5874
 
            help='Whether new branches in the repository have trees.',
5875
 
            value_switches=True, enum_switch=False,
5876
5637
            with_trees='Reconfigure repository to create '
5877
5638
                'working trees on branches by default.',
5878
5639
            with_no_trees='Reconfigure repository to not create '
5892
5653
            ),
5893
5654
        ]
5894
5655
 
5895
 
    def run(self, location=None, bind_to=None, force=False,
5896
 
            tree_type=None, repository_type=None, repository_trees=None,
5897
 
            stacked_on=None, unstacked=None):
 
5656
    def run(self, location=None, target_type=None, bind_to=None, force=False,
 
5657
            stacked_on=None,
 
5658
            unstacked=None):
5898
5659
        directory = bzrdir.BzrDir.open(location)
5899
5660
        if stacked_on and unstacked:
5900
 
            raise errors.BzrCommandError(gettext("Can't use both --stacked-on and --unstacked"))
 
5661
            raise errors.BzrCommandError("Can't use both --stacked-on and --unstacked")
5901
5662
        elif stacked_on is not None:
5902
5663
            reconfigure.ReconfigureStackedOn().apply(directory, stacked_on)
5903
5664
        elif unstacked:
5905
5666
        # At the moment you can use --stacked-on and a different
5906
5667
        # reconfiguration shape at the same time; there seems no good reason
5907
5668
        # to ban it.
5908
 
        if (tree_type is None and
5909
 
            repository_type is None and
5910
 
            repository_trees is None):
 
5669
        if target_type is None:
5911
5670
            if stacked_on or unstacked:
5912
5671
                return
5913
5672
            else:
5914
 
                raise errors.BzrCommandError(gettext('No target configuration '
5915
 
                    'specified'))
5916
 
        reconfiguration = None
5917
 
        if tree_type == 'branch':
 
5673
                raise errors.BzrCommandError('No target configuration '
 
5674
                    'specified')
 
5675
        elif target_type == 'branch':
5918
5676
            reconfiguration = reconfigure.Reconfigure.to_branch(directory)
5919
 
        elif tree_type == 'tree':
 
5677
        elif target_type == 'tree':
5920
5678
            reconfiguration = reconfigure.Reconfigure.to_tree(directory)
5921
 
        elif tree_type == 'checkout':
 
5679
        elif target_type == 'checkout':
5922
5680
            reconfiguration = reconfigure.Reconfigure.to_checkout(
5923
5681
                directory, bind_to)
5924
 
        elif tree_type == 'lightweight-checkout':
 
5682
        elif target_type == 'lightweight-checkout':
5925
5683
            reconfiguration = reconfigure.Reconfigure.to_lightweight_checkout(
5926
5684
                directory, bind_to)
5927
 
        if reconfiguration:
5928
 
            reconfiguration.apply(force)
5929
 
            reconfiguration = None
5930
 
        if repository_type == 'use-shared':
 
5685
        elif target_type == 'use-shared':
5931
5686
            reconfiguration = reconfigure.Reconfigure.to_use_shared(directory)
5932
 
        elif repository_type == 'standalone':
 
5687
        elif target_type == 'standalone':
5933
5688
            reconfiguration = reconfigure.Reconfigure.to_standalone(directory)
5934
 
        if reconfiguration:
5935
 
            reconfiguration.apply(force)
5936
 
            reconfiguration = None
5937
 
        if repository_trees == 'with-trees':
 
5689
        elif target_type == 'with-trees':
5938
5690
            reconfiguration = reconfigure.Reconfigure.set_repository_trees(
5939
5691
                directory, True)
5940
 
        elif repository_trees == 'with-no-trees':
 
5692
        elif target_type == 'with-no-trees':
5941
5693
            reconfiguration = reconfigure.Reconfigure.set_repository_trees(
5942
5694
                directory, False)
5943
 
        if reconfiguration:
5944
 
            reconfiguration.apply(force)
5945
 
            reconfiguration = None
 
5695
        reconfiguration.apply(force)
5946
5696
 
5947
5697
 
5948
5698
class cmd_switch(Command):
5986
5736
        control_dir = bzrdir.BzrDir.open_containing(tree_location)[0]
5987
5737
        if to_location is None:
5988
5738
            if revision is None:
5989
 
                raise errors.BzrCommandError(gettext('You must supply either a'
5990
 
                                             ' revision or a location'))
 
5739
                raise errors.BzrCommandError('You must supply either a'
 
5740
                                             ' revision or a location')
5991
5741
            to_location = tree_location
5992
5742
        try:
5993
5743
            branch = control_dir.open_branch()
5997
5747
            had_explicit_nick = False
5998
5748
        if create_branch:
5999
5749
            if branch is None:
6000
 
                raise errors.BzrCommandError(gettext('cannot create branch without'
6001
 
                                             ' source branch'))
 
5750
                raise errors.BzrCommandError('cannot create branch without'
 
5751
                                             ' source branch')
6002
5752
            to_location = directory_service.directories.dereference(
6003
5753
                              to_location)
6004
5754
            if '/' not in to_location and '\\' not in to_location:
6021
5771
        if had_explicit_nick:
6022
5772
            branch = control_dir.open_branch() #get the new branch!
6023
5773
            branch.nick = to_branch.nick
6024
 
        note(gettext('Switched to branch: %s'),
 
5774
        note('Switched to branch: %s',
6025
5775
            urlutils.unescape_for_display(to_branch.base, 'utf-8'))
6026
5776
 
6027
5777
    def _get_branch_location(self, control_dir):
6136
5886
            name = current_view
6137
5887
        if delete:
6138
5888
            if file_list:
6139
 
                raise errors.BzrCommandError(gettext(
6140
 
                    "Both --delete and a file list specified"))
 
5889
                raise errors.BzrCommandError(
 
5890
                    "Both --delete and a file list specified")
6141
5891
            elif switch:
6142
 
                raise errors.BzrCommandError(gettext(
6143
 
                    "Both --delete and --switch specified"))
 
5892
                raise errors.BzrCommandError(
 
5893
                    "Both --delete and --switch specified")
6144
5894
            elif all:
6145
5895
                tree.views.set_view_info(None, {})
6146
 
                self.outf.write(gettext("Deleted all views.\n"))
 
5896
                self.outf.write("Deleted all views.\n")
6147
5897
            elif name is None:
6148
 
                raise errors.BzrCommandError(gettext("No current view to delete"))
 
5898
                raise errors.BzrCommandError("No current view to delete")
6149
5899
            else:
6150
5900
                tree.views.delete_view(name)
6151
 
                self.outf.write(gettext("Deleted '%s' view.\n") % name)
 
5901
                self.outf.write("Deleted '%s' view.\n" % name)
6152
5902
        elif switch:
6153
5903
            if file_list:
6154
 
                raise errors.BzrCommandError(gettext(
6155
 
                    "Both --switch and a file list specified"))
 
5904
                raise errors.BzrCommandError(
 
5905
                    "Both --switch and a file list specified")
6156
5906
            elif all:
6157
 
                raise errors.BzrCommandError(gettext(
6158
 
                    "Both --switch and --all specified"))
 
5907
                raise errors.BzrCommandError(
 
5908
                    "Both --switch and --all specified")
6159
5909
            elif switch == 'off':
6160
5910
                if current_view is None:
6161
 
                    raise errors.BzrCommandError(gettext("No current view to disable"))
 
5911
                    raise errors.BzrCommandError("No current view to disable")
6162
5912
                tree.views.set_view_info(None, view_dict)
6163
 
                self.outf.write(gettext("Disabled '%s' view.\n") % (current_view))
 
5913
                self.outf.write("Disabled '%s' view.\n" % (current_view))
6164
5914
            else:
6165
5915
                tree.views.set_view_info(switch, view_dict)
6166
5916
                view_str = views.view_display_str(tree.views.lookup_view())
6167
 
                self.outf.write(gettext("Using '{0}' view: {1}\n").format(switch, view_str))
 
5917
                self.outf.write("Using '%s' view: %s\n" % (switch, view_str))
6168
5918
        elif all:
6169
5919
            if view_dict:
6170
 
                self.outf.write(gettext('Views defined:\n'))
 
5920
                self.outf.write('Views defined:\n')
6171
5921
                for view in sorted(view_dict):
6172
5922
                    if view == current_view:
6173
5923
                        active = "=>"
6176
5926
                    view_str = views.view_display_str(view_dict[view])
6177
5927
                    self.outf.write('%s %-20s %s\n' % (active, view, view_str))
6178
5928
            else:
6179
 
                self.outf.write(gettext('No views defined.\n'))
 
5929
                self.outf.write('No views defined.\n')
6180
5930
        elif file_list:
6181
5931
            if name is None:
6182
5932
                # No name given and no current view set
6183
5933
                name = 'my'
6184
5934
            elif name == 'off':
6185
 
                raise errors.BzrCommandError(gettext(
6186
 
                    "Cannot change the 'off' pseudo view"))
 
5935
                raise errors.BzrCommandError(
 
5936
                    "Cannot change the 'off' pseudo view")
6187
5937
            tree.views.set_view(name, sorted(file_list))
6188
5938
            view_str = views.view_display_str(tree.views.lookup_view())
6189
 
            self.outf.write(gettext("Using '{0}' view: {1}\n").format(name, view_str))
 
5939
            self.outf.write("Using '%s' view: %s\n" % (name, view_str))
6190
5940
        else:
6191
5941
            # list the files
6192
5942
            if name is None:
6193
5943
                # No name given and no current view set
6194
 
                self.outf.write(gettext('No current view.\n'))
 
5944
                self.outf.write('No current view.\n')
6195
5945
            else:
6196
5946
                view_str = views.view_display_str(tree.views.lookup_view(name))
6197
 
                self.outf.write(gettext("'{0}' view is: {1}\n").format(name, view_str))
 
5947
                self.outf.write("'%s' view is: %s\n" % (name, view_str))
6198
5948
 
6199
5949
 
6200
5950
class cmd_hooks(Command):
6214
5964
                        self.outf.write("    %s\n" %
6215
5965
                                        (some_hooks.get_hook_name(hook),))
6216
5966
                else:
6217
 
                    self.outf.write(gettext("    <no hooks installed>\n"))
 
5967
                    self.outf.write("    <no hooks installed>\n")
6218
5968
 
6219
5969
 
6220
5970
class cmd_remove_branch(Command):
6321
6071
        manager = tree.get_shelf_manager()
6322
6072
        shelves = manager.active_shelves()
6323
6073
        if len(shelves) == 0:
6324
 
            note(gettext('No shelved changes.'))
 
6074
            note('No shelved changes.')
6325
6075
            return 0
6326
6076
        for shelf_id in reversed(shelves):
6327
6077
            message = manager.get_metadata(shelf_id).get('message')
6466
6216
        ('cmd_version_info', [], 'bzrlib.cmd_version_info'),
6467
6217
        ('cmd_resolve', ['resolved'], 'bzrlib.conflicts'),
6468
6218
        ('cmd_conflicts', [], 'bzrlib.conflicts'),
6469
 
        ('cmd_sign_my_commits', [], 'bzrlib.commit_signature_commands'),
6470
 
        ('cmd_verify_signatures', [],
6471
 
                                        'bzrlib.commit_signature_commands'),
 
6219
        ('cmd_sign_my_commits', [], 'bzrlib.sign_my_commits'),
6472
6220
        ('cmd_test_script', [], 'bzrlib.cmd_test_script'),
6473
6221
        ]:
6474
6222
        builtin_command_registry.register_lazy(name, aliases, module_name)