# HG changeset patch # User Yuya Nishihara # Date 1471331352 -32400 # Node ID 110ed1868f86b2db61c62e0dea53781471141889 # Parent 8540133f91a1215759bef1088af1ecefb882fbbd version: factor out mapping of internal/external labels Prepares for formatter support, where translation should be disabled conditionally. diff -r 8540133f91a1 -r 110ed1868f86 mercurial/commands.py --- a/mercurial/commands.py Tue Aug 16 16:03:09 2016 +0900 +++ b/mercurial/commands.py Tue Aug 16 16:09:12 2016 +0900 @@ -7258,20 +7258,19 @@ # format names and versions into columns names = [] vers = [] - place = [] + isinternals = [] for name, module in extensions.extensions(): names.append(name) vers.append(extensions.moduleversion(module)) - if extensions.ismoduleinternal(module): - place.append(_("internal")) - else: - place.append(_("external")) + isinternals.append(extensions.ismoduleinternal(module)) if names: maxnamelen = max(len(n) for n in names) + places = [_("external"), _("internal")] for i, name in enumerate(names): + p = isinternals[i] if ui.verbose: ui.write(" %-*s %s %s\n" % - (maxnamelen, name, place[i], vers[i])) + (maxnamelen, name, places[p], vers[i])) def loadcmdtable(ui, name, cmdtable): """Load command functions from specified cmdtable diff -r 8540133f91a1 -r 110ed1868f86 tests/test-extension.t --- a/tests/test-extension.t Tue Aug 16 16:03:09 2016 +0900 +++ b/tests/test-extension.t Tue Aug 16 16:09:12 2016 +0900 @@ -1224,7 +1224,7 @@ throw external 1.2.3 $ echo 'getversion = lambda: "1.twentythree"' >> throw.py $ rm -f throw.pyc throw.pyo - $ hg version -v --config extensions.throw=throw.py + $ hg version -v --config extensions.throw=throw.py --config extensions.strip= Mercurial Distributed SCM (version *) (glob) (see https://mercurial-scm.org for more information) @@ -1235,6 +1235,7 @@ Enabled extensions: throw external 1.twentythree + strip internal $ hg version -q --config extensions.throw=throw.py Mercurial Distributed SCM (version *) (glob)