~bzr-pqm/bzr/bzr.dev

« back to all changes in this revision

Viewing changes to bzrlib/builtins.py

add gettext to all the builtin commands outf usage

Show diffs side-by-side

added added

removed removed

Lines of Context:
57
57
from bzrlib.revisionspec import RevisionSpec, RevisionInfo
58
58
from bzrlib.smtp_connection import SMTPConnection
59
59
from bzrlib.workingtree import WorkingTree
 
60
from bzrlib.i18n import gettext
60
61
""")
61
62
 
62
63
from bzrlib.commands import (
723
724
            if verbose:
724
725
                for glob in sorted(ignored.keys()):
725
726
                    for path in ignored[glob]:
726
 
                        self.outf.write("ignored %s matching \"%s\"\n"
 
727
                        self.outf.write(gettext("ignored %s matching \"%s\"\n")
727
728
                                        % (path, glob))
728
729
 
729
730
 
744
745
            if id != None:
745
746
                os.mkdir(d)
746
747
                wt.add([dd])
747
 
                self.outf.write('added %s\n' % d)
 
748
                self.outf.write(gettext('added %s\n') % d)
748
749
            else:
749
750
                raise errors.NotVersionedError(path=base)
750
751
 
1045
1046
                display_url = urlutils.unescape_for_display(stored_loc,
1046
1047
                        self.outf.encoding)
1047
1048
                if not is_quiet():
1048
 
                    self.outf.write("Using saved parent location: %s\n" % display_url)
 
1049
                    self.outf.write(gettext("Using saved parent location: %s\n") % display_url)
1049
1050
                location = stored_loc
1050
1051
 
1051
1052
        revision = _get_one_revision('pull', revision)
1198
1199
            else:
1199
1200
                display_url = urlutils.unescape_for_display(stored_loc,
1200
1201
                        self.outf.encoding)
1201
 
                note("Using saved push location: %s" % display_url)
 
1202
                note(gettext("Using saved push location: %s") % display_url)
1202
1203
                location = stored_loc
1203
1204
 
1204
1205
        _show_push_branch(br_from, revision_id, location, self.outf,
1349
1350
        dir = bzrdir.BzrDir.open_containing(location)[0]
1350
1351
        for branch in dir.list_branches():
1351
1352
            if branch.name is None:
1352
 
                self.outf.write(" (default)\n")
 
1353
                self.outf.write(gettext(" (default)\n"))
1353
1354
            else:
1354
1355
                self.outf.write(" %s\n" % branch.name.encode(self.outf.encoding))
1355
1356
 
1884
1885
            repository = branch.repository
1885
1886
            layout = describe_layout(repository, branch, tree).lower()
1886
1887
            format = describe_format(a_bzrdir, repository, branch, tree)
1887
 
            self.outf.write("Created a %s (format: %s)\n" % (layout, format))
 
1888
            self.outf.write(gettext("Created a %s (format: %s)\n") % (layout, format))
1888
1889
            if repository.is_shared():
1889
1890
                #XXX: maybe this can be refactored into transport.path_or_url()
1890
1891
                url = repository.bzrdir.root_transport.external_url()
1892
1893
                    url = urlutils.local_path_from_url(url)
1893
1894
                except errors.InvalidURL:
1894
1895
                    pass
1895
 
                self.outf.write("Using shared repository: %s\n" % url)
 
1896
                self.outf.write(gettext("Using shared repository: %s\n") % url)
1896
1897
 
1897
1898
 
1898
1899
class cmd_init_repository(Command):
2935
2936
                if ignored.match(filename):
2936
2937
                    matches.append(filename)
2937
2938
        if len(matches) > 0:
2938
 
            self.outf.write("Warning: the following files are version controlled and"
2939
 
                  " match your ignore pattern:\n%s"
 
2939
            self.outf.write(gettext("Warning: the following files are version "
 
2940
                  "controlled and match your ignore pattern:\n%s"
2940
2941
                  "\nThese files will continue to be version controlled"
2941
 
                  " unless you 'bzr remove' them.\n" % ("\n".join(matches),))
 
2942
                  " unless you 'bzr remove' them.\n") % ("\n".join(matches),))
2942
2943
 
2943
2944
 
2944
2945
class cmd_ignored(Command):
3917
3918
 
3918
3919
    @display_command
3919
3920
    def run(self):
3920
 
        self.outf.write("It sure does!\n")
 
3921
        self.outf.write(gettext("It sure does!\n"))
3921
3922
 
3922
3923
 
3923
3924
class cmd_find_merge_base(Command):
3941
3942
        graph = branch1.repository.get_graph(branch2.repository)
3942
3943
        base_rev_id = graph.find_unique_lca(last1, last2)
3943
3944
 
3944
 
        self.outf.write('merge base is revision %s\n' % base_rev_id)
 
3945
        self.outf.write(gettext('merge base is revision %s\n') % base_rev_id)
3945
3946
 
3946
3947
 
3947
3948
class cmd_merge(Command):
4640
4641
                                             " or specified.")
4641
4642
            display_url = urlutils.unescape_for_display(parent,
4642
4643
                                                        self.outf.encoding)
4643
 
            message("Using saved parent location: "
4644
 
                    + display_url + "\n")
 
4644
            message(gettext("Using saved parent location: {0}\n").format(
 
4645
                    display_url))
4645
4646
 
4646
4647
        remote_branch = Branch.open(other_branch)
4647
4648
        if remote_branch.base == local_branch.base:
4673
4674
 
4674
4675
        status_code = 0
4675
4676
        if local_extra and not theirs_only:
4676
 
            message("You have %d extra revision(s):\n" %
 
4677
            message(gettext("You have %d extra revision(s):\n") %
4677
4678
                len(local_extra))
4678
4679
            for revision in iter_log_revisions(local_extra,
4679
4680
                                local_branch.repository,
4687
4688
        if remote_extra and not mine_only:
4688
4689
            if printed_local is True:
4689
4690
                message("\n\n\n")
4690
 
            message("You are missing %d revision(s):\n" %
 
4691
            message(gettext("You are missing %d revision(s):\n") %
4691
4692
                len(remote_extra))
4692
4693
            for revision in iter_log_revisions(remote_extra,
4693
4694
                                remote_branch.repository,
4697
4698
 
4698
4699
        if mine_only and not local_extra:
4699
4700
            # We checked local, and found nothing extra
4700
 
            message('This branch has no new revisions.\n')
 
4701
            message(gettext('This branch has no new revisions.\n'))
4701
4702
        elif theirs_only and not remote_extra:
4702
4703
            # We checked remote, and found nothing extra
4703
 
            message('Other branch has no new revisions.\n')
 
4704
            message(gettext('Other branch has no new revisions.\n'))
4704
4705
        elif not (mine_only or theirs_only or local_extra or
4705
4706
                  remote_extra):
4706
4707
            # We checked both branches, and neither one had extra
4707
4708
            # revisions
4708
 
            message("Branches are up to date.\n")
 
4709
            message(gettext("Branches are up to date.\n"))
4709
4710
        self.cleanup_now()
4710
4711
        if not status_code and parent is None and other_branch is not None:
4711
4712
            self.add_cleanup(local_branch.lock_write().unlock)
5061
5062
                rev_id = b.get_rev_id(revno)
5062
5063
 
5063
5064
        if rev_id is None or _mod_revision.is_null(rev_id):
5064
 
            self.outf.write('No revisions to uncommit.\n')
 
5065
            self.outf.write(gettext('No revisions to uncommit.\n'))
5065
5066
            return 1
5066
5067
 
5067
5068
        lf = log_formatter('short',
5076
5077
                 end_revision=last_revno)
5077
5078
 
5078
5079
        if dry_run:
5079
 
            self.outf.write('Dry-run, pretending to remove'
5080
 
                            ' the above revisions.\n')
 
5080
            self.outf.write(gettext('Dry-run, pretending to remove'
 
5081
                            ' the above revisions.\n'))
5081
5082
        else:
5082
 
            self.outf.write('The above revision(s) will be removed.\n')
 
5083
            self.outf.write(gettext('The above revision(s) will be removed.\n'))
5083
5084
 
5084
5085
        if not force:
5085
5086
            if not ui.ui_factory.confirm_action(
5086
 
                    u'Uncommit these revisions',
 
5087
                    gettext(u'Uncommit these revisions'),
5087
5088
                    'bzrlib.builtins.uncommit',
5088
5089
                    {}):
5089
 
                self.outf.write('Canceled\n')
 
5090
                self.outf.write(gettext('Canceled\n'))
5090
5091
                return 0
5091
5092
 
5092
5093
        mutter('Uncommitting from {%s} to {%s}',
5093
5094
               last_rev_id, rev_id)
5094
5095
        uncommit(b, tree=tree, dry_run=dry_run, verbose=verbose,
5095
5096
                 revno=revno, local=local, keep_tags=keep_tags)
5096
 
        self.outf.write('You can restore the old tip by running:\n'
5097
 
             '  bzr pull . -r revid:%s\n' % last_rev_id)
 
5097
        self.outf.write(gettext('You can restore the old tip by running:\n'
 
5098
             '  bzr pull . -r revid:%s\n') % last_rev_id)
5098
5099
 
5099
5100
 
5100
5101
class cmd_break_lock(Command):
6035
6036
                    "Both --delete and --switch specified")
6036
6037
            elif all:
6037
6038
                tree.views.set_view_info(None, {})
6038
 
                self.outf.write("Deleted all views.\n")
 
6039
                self.outf.write(gettext("Deleted all views.\n"))
6039
6040
            elif name is None:
6040
6041
                raise errors.BzrCommandError("No current view to delete")
6041
6042
            else:
6042
6043
                tree.views.delete_view(name)
6043
 
                self.outf.write("Deleted '%s' view.\n" % name)
 
6044
                self.outf.write(gettext("Deleted '%s' view.\n") % name)
6044
6045
        elif switch:
6045
6046
            if file_list:
6046
6047
                raise errors.BzrCommandError(
6052
6053
                if current_view is None:
6053
6054
                    raise errors.BzrCommandError("No current view to disable")
6054
6055
                tree.views.set_view_info(None, view_dict)
6055
 
                self.outf.write("Disabled '%s' view.\n" % (current_view))
 
6056
                self.outf.write(gettext("Disabled '%s' view.\n") % (current_view))
6056
6057
            else:
6057
6058
                tree.views.set_view_info(switch, view_dict)
6058
6059
                view_str = views.view_display_str(tree.views.lookup_view())
6059
 
                self.outf.write("Using '%s' view: %s\n" % (switch, view_str))
 
6060
                self.outf.write(gettext("Using '%s' view: %s\n") % (switch, view_str))
6060
6061
        elif all:
6061
6062
            if view_dict:
6062
 
                self.outf.write('Views defined:\n')
 
6063
                self.outf.write(gettext'Views defined:\n'))
6063
6064
                for view in sorted(view_dict):
6064
6065
                    if view == current_view:
6065
6066
                        active = "=>"
6068
6069
                    view_str = views.view_display_str(view_dict[view])
6069
6070
                    self.outf.write('%s %-20s %s\n' % (active, view, view_str))
6070
6071
            else:
6071
 
                self.outf.write('No views defined.\n')
 
6072
                self.outf.write(gettext('No views defined.\n'))
6072
6073
        elif file_list:
6073
6074
            if name is None:
6074
6075
                # No name given and no current view set
6078
6079
                    "Cannot change the 'off' pseudo view")
6079
6080
            tree.views.set_view(name, sorted(file_list))
6080
6081
            view_str = views.view_display_str(tree.views.lookup_view())
6081
 
            self.outf.write("Using '%s' view: %s\n" % (name, view_str))
 
6082
            self.outf.write(gettext("Using '%s' view: %s\n") % (name, view_str))
6082
6083
        else:
6083
6084
            # list the files
6084
6085
            if name is None:
6085
6086
                # No name given and no current view set
6086
 
                self.outf.write('No current view.\n')
 
6087
                self.outf.write(gettext('No current view.\n'))
6087
6088
            else:
6088
6089
                view_str = views.view_display_str(tree.views.lookup_view(name))
6089
 
                self.outf.write("'%s' view is: %s\n" % (name, view_str))
 
6090
                self.outf.write(gettext("'%s' view is: %s\n") % (name, view_str))
6090
6091
 
6091
6092
 
6092
6093
class cmd_hooks(Command):
6106
6107
                        self.outf.write("    %s\n" %
6107
6108
                                        (some_hooks.get_hook_name(hook),))
6108
6109
                else:
6109
 
                    self.outf.write("    <no hooks installed>\n")
 
6110
                    self.outf.write(gettext("    <no hooks installed>\n"))
6110
6111
 
6111
6112
 
6112
6113
class cmd_remove_branch(Command):