diff --git a/contrib/debugshell.py b/contrib/debugshell.py --- a/contrib/debugshell.py +++ b/contrib/debugshell.py @@ -56,7 +56,7 @@ with demandimport.deactivated(): __import__(pdbmap[debugger]) except ImportError: - ui.warn( + ui.warnnoi18n( b"%s debugger specified but %s module was not found\n" % (debugger, pdbmap[debugger]) ) diff --git a/contrib/perf.py b/contrib/perf.py --- a/contrib/perf.py +++ b/contrib/perf.py @@ -1307,7 +1307,7 @@ hint=b"see 'hg help config.paths'", ) dest = path.pushloc or path.loc - ui.status(b'analysing phase of %s\n' % util.hidepassword(dest)) + ui.statusnoi18n(b'analysing phase of %s\n' % util.hidepassword(dest)) other = hg.peer(repo, opts, dest) # easier to perform discovery through the operation @@ -1323,9 +1323,9 @@ del other publishing = remotephases.get(b'publishing', False) if publishing: - ui.status(b'publishing: yes\n') + ui.statusnoi18n(b'publishing: yes\n') else: - ui.status(b'publishing: no\n') + ui.statusnoi18n(b'publishing: no\n') nodemap = repo.changelog.nodemap nonpublishroots = 0 @@ -1335,8 +1335,8 @@ node = bin(nhex) if node in nodemap and int(phase): nonpublishroots += 1 - ui.status(b'number of roots: %d\n' % len(remotephases)) - ui.status(b'number of known non public roots: %d\n' % nonpublishroots) + ui.statusnoi18n(b'number of roots: %d\n' % len(remotephases)) + ui.statusnoi18n(b'number of known non public roots: %d\n' % nonpublishroots) def d(): phases.remotephasessummary(repo, remotesubset, remotephases) @@ -3694,7 +3694,7 @@ def write(): for i in range(100000): - ui.write(b'Testing write performance\n') + ui.writenoi18n(b'Testing write performance\n') timer(write) fm.end() diff --git a/doc/check-seclevel.py b/doc/check-seclevel.py --- a/doc/check-seclevel.py +++ b/doc/check-seclevel.py @@ -47,7 +47,7 @@ def checkseclevel(ui, doc, name, initlevel): - ui.note('checking "%s"\n' % name) + ui.notenoi18n('checking "%s"\n' % name) if not isinstance(doc, bytes): doc = doc.encode('utf-8') blocks, pruned = minirst.parse(doc, 0, ['verbose']) @@ -70,11 +70,11 @@ continue nextlevel = mark2level[mark] if curlevel < nextlevel and curlevel + 1 != nextlevel: - ui.warn('gap of section level at "%s" of %s\n' % (title, name)) + ui.warnnoi18n('gap of section level at "%s" of %s\n' % (title, name)) showavailables(ui, initlevel) errorcnt += 1 continue - ui.note( + ui.notenoi18n( 'appropriate section level for "%s %s"\n' % (mark * (nextlevel * 2), title) ) @@ -88,7 +88,7 @@ for k, entry in cmdtable.items(): name = k.split(b"|")[0].lstrip(b"^") if not entry[0].__doc__: - ui.note('skip checking %s: no help document\n' % (namefmt % name)) + ui.notenoi18n('skip checking %s: no help document\n' % (namefmt % name)) continue errorcnt += checkseclevel( ui, entry[0].__doc__, namefmt % name, initlevel @@ -113,7 +113,7 @@ ): mod = extensions.load(ui, name, None) if not mod.__doc__: - ui.note('skip checking %s extension: no help document\n' % name) + ui.notenoi18n('skip checking %s extension: no help document\n' % name) continue errorcnt += checkseclevel( ui, mod.__doc__, '%s extension' % name, initlevel_ext @@ -138,7 +138,7 @@ with open(filename) as fp: doc = fp.read() - ui.note( + ui.notenoi18n( 'checking input from %s with initlevel %d\n' % (filename, initlevel) ) return checkseclevel(ui, doc, 'input from %s' % filename, initlevel) diff --git a/hgext/convert/cvsps.py b/hgext/convert/cvsps.py --- a/hgext/convert/cvsps.py +++ b/hgext/convert/cvsps.py @@ -1021,7 +1021,7 @@ ) ) if cs.branchpoints: - ui.write( + ui.writenoi18n( b'Branchpoints: %s \n' % b', '.join(sorted(cs.branchpoints)) ) if opts[b"parents"] and cs.parents: @@ -1044,9 +1044,9 @@ if r: ui.write((b'Ancestors: %s\n' % (b','.join(r)))) - ui.write(b'Log:\n') + ui.writenoi18n(b'Log:\n') ui.write(b'%s\n\n' % cs.comment) - ui.write(b'Members: \n') + ui.writenoi18n(b'Members: \n') for f in cs.entries: fn = f.file if fn.startswith(opts[b"prefix"]): diff --git a/hgext/hgk.py b/hgext/hgk.py --- a/hgext/hgk.py +++ b/hgext/hgk.py @@ -97,17 +97,17 @@ for f in modified: # TODO get file permissions - ui.write( + ui.writenoi18n( b":100664 100664 %s %s M\t%s\t%s\n" % (short(mmap[f]), short(mmap2[f]), f, f) ) for f in added: - ui.write( + ui.writenoi18n( b":000000 100664 %s %s N\t%s\t%s\n" % (empty, short(mmap2[f]), f, f) ) for f in removed: - ui.write( + ui.writenoi18n( b":100664 000000 %s %s D\t%s\t%s\n" % (short(mmap[f]), empty, f, f) ) @@ -166,7 +166,7 @@ ui.write((b"branch %s\n" % ctx.branch())) if obsolete.isenabled(repo, obsolete.createmarkersopt): if ctx.obsolete(): - ui.write(b"obsolete\n") + ui.writenoi18n(b"obsolete\n") ui.write((b"phase %s\n\n" % ctx.phasestr())) if prefix != b"": diff --git a/hgext/keyword.py b/hgext/keyword.py --- a/hgext/keyword.py +++ b/hgext/keyword.py @@ -517,7 +517,7 @@ uisetup(ui) reposetup(ui, repo) - ui.write(b'[extensions]\nkeyword =\n') + ui.writenoi18n(b'[extensions]\nkeyword =\n') demoitems(b'keyword', ui.configitems(b'keyword')) demoitems(b'keywordset', ui.configitems(b'keywordset')) demoitems(b'keywordmaps', kwmaps.iteritems()) diff --git a/hgext/phabricator.py b/hgext/phabricator.py --- a/hgext/phabricator.py +++ b/hgext/phabricator.py @@ -774,7 +774,7 @@ try: writediffproperties(unfi[newnode], diffmap[old.node()]) except util.urlerr.urlerror: - ui.warn(b'Failed to update metadata for D%s\n' % drevid) + ui.warnnoi18n(b'Failed to update metadata for D%s\n' % drevid) # Remove local tags since it's no longer necessary tagname = b'D%d' % drevid if tagname in repo.tags(): diff --git a/hgext/remotefilelog/debugcommands.py b/hgext/remotefilelog/debugcommands.py --- a/hgext/remotefilelog/debugcommands.py +++ b/hgext/remotefilelog/debugcommands.py @@ -187,7 +187,7 @@ r = buildtemprevlog(repo, os.path.basename(file_)[:-2]) - ui.write(b"digraph G {\n") + ui.writenoi18n(b"digraph G {\n") for i in r: node = r.node(i) pp = r.parents(node) @@ -289,7 +289,7 @@ (b"smaller" if difference > 0 else b"bigger"), ) - ui.write( + ui.writenoi18n( b"Total:%s%s %s (%s)\n" % ( b"".ljust(2 * hashlen - len(b"Total:")), diff --git a/hgext/show.py b/hgext/show.py --- a/hgext/show.py +++ b/hgext/show.py @@ -316,7 +316,7 @@ else: ui.write(b' ') - ui.write(b'o ') + ui.writenoi18n(b'o ') displayer.show(ctx, nodelen=nodelen) displayer.flush(ctx) ui.write(b'\n') @@ -378,7 +378,7 @@ ui.write(b' / ') ui.write(_(b'(stack base)'), b'\n', label=b'stack.label') - ui.write(b'o ') + ui.writenoi18n(b'o ') displayer.show(basectx, nodelen=nodelen) displayer.flush(basectx) diff --git a/hgext/win32mbcs.py b/hgext/win32mbcs.py --- a/hgext/win32mbcs.py +++ b/hgext/win32mbcs.py @@ -215,4 +215,4 @@ # command line options is not yet applied when # extensions.loadall() is called. if b'--debug' in sys.argv: - ui.write(b"[win32mbcs] activated with encoding: %s\n" % _encoding) + ui.writenoi18n(b"[win32mbcs] activated with encoding: %s\n" % _encoding) diff --git a/mercurial/bundle2.py b/mercurial/bundle2.py --- a/mercurial/bundle2.py +++ b/mercurial/bundle2.py @@ -2388,7 +2388,7 @@ tr = op.gettransaction() markerdata = inpart.read() if op.ui.config(b'experimental', b'obsmarkers-exchange-debug'): - op.ui.write( + op.ui.writenoi18n( b'obsmarker-exchange: %i bytes received\n' % len(markerdata) ) # The mergemarkers call will crash if marker creation is not enabled. diff --git a/mercurial/debugcommands.py b/mercurial/debugcommands.py --- a/mercurial/debugcommands.py +++ b/mercurial/debugcommands.py @@ -304,7 +304,7 @@ def _debugchangegroup(ui, gen, all=None, indent=0, **opts): indent_string = b' ' * indent if all: - ui.write( + ui.writenoi18n( b"%sformat: id, p1, p2, cset, delta base, len(delta)\n" % indent_string ) @@ -438,12 +438,12 @@ opts = pycompat.byteskwargs(opts) peer = hg.peer(ui, opts, path) caps = peer.capabilities() - ui.write(b'Main capabilities:\n') + ui.writenoi18n(b'Main capabilities:\n') for c in sorted(caps): ui.write(b' %s\n' % c) b2caps = bundle2.bundle2caps(peer) if b2caps: - ui.write(b'Bundle2 capabilities:\n') + ui.writenoi18n(b'Bundle2 capabilities:\n') for key, values in sorted(b2caps.iteritems()): ui.write(b' %s\n' % key) for v in values: @@ -487,7 +487,7 @@ ) def debugcolor(ui, repo, **opts): """show available color, effects or style""" - ui.write(b'color mode: %s\n' % stringutil.pprint(ui._colormode)) + ui.writenoi18n(b'color mode: %s\n' % stringutil.pprint(ui._colormode)) if opts.get(r'style'): return _debugdisplaystyle(ui) else: @@ -651,11 +651,11 @@ d = dateutil.parsedate(date, util.extendeddateformats) else: d = dateutil.parsedate(date) - ui.write(b"internal: %d %d\n" % d) - ui.write(b"standard: %s\n" % dateutil.datestr(d)) + ui.writenoi18n(b"internal: %d %d\n" % d) + ui.writenoi18n(b"standard: %s\n" % dateutil.datestr(d)) if range: m = dateutil.matchdate(range) - ui.write(b"match: %s\n" % m(d[0])) + ui.writenoi18n(b"match: %s\n" % m(d[0])) @command( @@ -922,7 +922,7 @@ ) common = set(common) if not opts.get(b'nonheads'): - ui.write( + ui.writenoi18n( b"unpruned common: %s\n" % b" ".join(sorted(short(n) for n in common)) ) @@ -969,24 +969,24 @@ data[b'nb-revs-missing'] = data[b'nb-revs'] - data[b'nb-revs-common'] # display discovery summary - ui.write(b"elapsed time: %(elapsed)f seconds\n" % data) - ui.write(b"heads summary:\n") - ui.write(b" total common heads: %(nb-common)9d\n" % data) - ui.write(b" also local heads: %(nb-common-local)9d\n" % data) - ui.write(b" also remote heads: %(nb-common-remote)9d\n" % data) - ui.write(b" both: %(nb-common-both)9d\n" % data) - ui.write(b" local heads: %(nb-local)9d\n" % data) - ui.write(b" common: %(nb-common-local)9d\n" % data) - ui.write(b" missing: %(nb-local-missing)9d\n" % data) - ui.write(b" remote heads: %(nb-remote)9d\n" % data) - ui.write(b" common: %(nb-common-remote)9d\n" % data) - ui.write(b" unknown: %(nb-remote-unknown)9d\n" % data) - ui.write(b"local changesets: %(nb-revs)9d\n" % data) - ui.write(b" common: %(nb-revs-common)9d\n" % data) - ui.write(b" missing: %(nb-revs-missing)9d\n" % data) + ui.writenoi18n(b"elapsed time: %(elapsed)f seconds\n" % data) + ui.writenoi18n(b"heads summary:\n") + ui.writenoi18n(b" total common heads: %(nb-common)9d\n" % data) + ui.writenoi18n(b" also local heads: %(nb-common-local)9d\n" % data) + ui.writenoi18n(b" also remote heads: %(nb-common-remote)9d\n" % data) + ui.writenoi18n(b" both: %(nb-common-both)9d\n" % data) + ui.writenoi18n(b" local heads: %(nb-local)9d\n" % data) + ui.writenoi18n(b" common: %(nb-common-local)9d\n" % data) + ui.writenoi18n(b" missing: %(nb-local-missing)9d\n" % data) + ui.writenoi18n(b" remote heads: %(nb-remote)9d\n" % data) + ui.writenoi18n(b" common: %(nb-common-remote)9d\n" % data) + ui.writenoi18n(b" unknown: %(nb-remote-unknown)9d\n" % data) + ui.writenoi18n(b"local changesets: %(nb-revs)9d\n" % data) + ui.writenoi18n(b" common: %(nb-revs-common)9d\n" % data) + ui.writenoi18n(b" missing: %(nb-revs-missing)9d\n" % data) if ui.verbose: - ui.write( + ui.writenoi18n( b"common heads: %s\n" % b" ".join(sorted(short(n) for n in common)) ) @@ -1163,7 +1163,7 @@ m = ctx.matchfileset(expr) if opts[b'show_matcher'] or (opts[b'show_matcher'] is None and ui.verbose): - ui.write(b'* matcher:\n', stringutil.prettyrepr(m), b'\n') + ui.writenoi18n(b'* matcher:\n', stringutil.prettyrepr(m), b'\n') for f in sorted(files): if not m(f): continue @@ -1245,19 +1245,19 @@ @command(b'debugfsinfo', [], _(b'[PATH]'), norepo=True) def debugfsinfo(ui, path=b"."): """show information detected about current filesystem""" - ui.write(b'path: %s\n' % path) - ui.write(b'mounted on: %s\n' % (util.getfsmountpoint(path) or b'(unknown)')) - ui.write(b'exec: %s\n' % (util.checkexec(path) and b'yes' or b'no')) - ui.write(b'fstype: %s\n' % (util.getfstype(path) or b'(unknown)')) - ui.write(b'symlink: %s\n' % (util.checklink(path) and b'yes' or b'no')) - ui.write(b'hardlink: %s\n' % (util.checknlink(path) and b'yes' or b'no')) + ui.writenoi18n(b'path: %s\n' % path) + ui.writenoi18n(b'mounted on: %s\n' % (util.getfsmountpoint(path) or b'(unknown)')) + ui.writenoi18n(b'exec: %s\n' % (util.checkexec(path) and b'yes' or b'no')) + ui.writenoi18n(b'fstype: %s\n' % (util.getfstype(path) or b'(unknown)')) + ui.writenoi18n(b'symlink: %s\n' % (util.checklink(path) and b'yes' or b'no')) + ui.writenoi18n(b'hardlink: %s\n' % (util.checknlink(path) and b'yes' or b'no')) casesensitive = b'(unknown)' try: with pycompat.namedtempfile(prefix=b'.debugfsinfo', dir=path) as f: casesensitive = util.fscasesensitive(f.name) and b'yes' or b'no' except OSError: pass - ui.write(b'case-sensitive: %s\n' % casesensitive) + ui.writenoi18n(b'case-sensitive: %s\n' % casesensitive) @command( @@ -1409,7 +1409,7 @@ """dump an index DAG as a graphviz dot file""" opts = pycompat.byteskwargs(opts) r = cmdutil.openstorage(repo, b'debugindexdot', file_, opts) - ui.write(b"digraph G {\n") + ui.writenoi18n(b"digraph G {\n") for i in r: node = r.node(i) pp = r.parents(node) @@ -1818,13 +1818,13 @@ pid, host, ) - ui.write(b"%-6s %s (%ds)\n" % (name + b":", locker, age)) + ui.writenoi18n(b"%-6s %s (%ds)\n" % (name + b":", locker, age)) return 1 except OSError as e: if e.errno != errno.ENOENT: raise - ui.write(b"%-6s free\n" % (name + b":")) + ui.writenoi18n(b"%-6s free\n" % (name + b":")) return 0 held += report(repo.svfs, b"lock", repo.lock) @@ -1920,7 +1920,7 @@ return h def printrecords(version): - ui.write(b'* version %d records\n' % version) + ui.writenoi18n(b'* version %d records\n' % version) if version == 1: records = v1records else: @@ -1929,12 +1929,12 @@ for rtype, record in records: # pretty print some record types if rtype == b'L': - ui.write(b'local: %s\n' % record) + ui.writenoi18n(b'local: %s\n' % record) elif rtype == b'O': - ui.write(b'other: %s\n' % record) + ui.writenoi18n(b'other: %s\n' % record) elif rtype == b'm': driver, mdstate = record.split(b'\0', 1) - ui.write(b'merge driver: %s (state "%s")\n' % (driver, mdstate)) + ui.writenoi18n(b'merge driver: %s (state "%s")\n' % (driver, mdstate)) elif rtype in b'FDC': r = record.split(b'\0') f, state, hash, lfile, afile, anode, ofile = r[0:7] @@ -1943,16 +1943,16 @@ flags = r[7] else: onode, flags = r[7:9] - ui.write( + ui.writenoi18n( b'file: %s (record type "%s", state "%s", hash %s)\n' % (f, rtype, state, _hashornull(hash)) ) - ui.write(b' local path: %s (flags "%s")\n' % (lfile, flags)) - ui.write( + ui.writenoi18n(b' local path: %s (flags "%s")\n' % (lfile, flags)) + ui.writenoi18n( b' ancestor path: %s (node %s)\n' % (afile, _hashornull(anode)) ) - ui.write( + ui.writenoi18n( b' other path: %s (node %s)\n' % (ofile, _hashornull(onode)) ) @@ -1965,20 +1965,20 @@ extrastrings.append(b'%s = %s' % (extras[i], extras[i + 1])) i += 2 - ui.write( + ui.writenoi18n( b'file extras: %s (%s)\n' % (filename, b', '.join(extrastrings)) ) elif rtype == b'l': labels = record.split(b'\0', 2) labels = [l for l in labels if len(l) > 0] - ui.write(b'labels:\n') + ui.writenoi18n(b'labels:\n') ui.write((b' local: %s\n' % labels[0])) ui.write((b' other: %s\n' % labels[1])) if len(labels) > 2: ui.write((b' base: %s\n' % labels[2])) else: - ui.write( + ui.writenoi18n( b'unrecognized entry: %s\t%s\n' % (rtype, record.replace(b'\0', b'\t')) ) @@ -2004,15 +2004,15 @@ v2records.sort(key=key) if not v1records and not v2records: - ui.write(b'no merge state found\n') + ui.writenoi18n(b'no merge state found\n') elif not v2records: - ui.note(b'no version 2 merge state\n') + ui.notenoi18n(b'no version 2 merge state\n') printrecords(1) elif ms._v1v2match(v1records, v2records): - ui.note(b'v1 and v2 states match: using v2\n') + ui.notenoi18n(b'v1 and v2 states match: using v2\n') printrecords(2) else: - ui.note(b'v1 and v2 states mismatch: using v1\n') + ui.notenoi18n(b'v1 and v2 states mismatch: using v1\n') printrecords(1) if ui.verbose: printrecords(2) @@ -2381,15 +2381,15 @@ overrides = {} if opts[b'tool']: overrides[(b'ui', b'forcemerge')] = opts[b'tool'] - ui.note(b'with --tool %r\n' % (pycompat.bytestr(opts[b'tool']))) + ui.notenoi18n(b'with --tool %r\n' % (pycompat.bytestr(opts[b'tool']))) with ui.configoverride(overrides, b'debugmergepatterns'): hgmerge = encoding.environ.get(b"HGMERGE") if hgmerge is not None: - ui.note(b'with HGMERGE=%r\n' % (pycompat.bytestr(hgmerge))) + ui.notenoi18n(b'with HGMERGE=%r\n' % (pycompat.bytestr(hgmerge))) uimerge = ui.config(b"ui", b"merge") if uimerge: - ui.note(b'with ui.merge=%r\n' % (pycompat.bytestr(uimerge))) + ui.notenoi18n(b'with ui.merge=%r\n' % (pycompat.bytestr(uimerge))) ctx = scmutil.revsingle(repo, opts.get(b'rev')) m = scmutil.match(ctx, pats, opts) @@ -2785,34 +2785,34 @@ else: return value, 100.0 - ui.write(b'format : %d\n' % format) - ui.write(b'flags : %s\n' % b', '.join(flags)) + ui.writenoi18n(b'format : %d\n' % format) + ui.writenoi18n(b'flags : %s\n' % b', '.join(flags)) ui.write(b'\n') fmt = pcfmtstr(totalsize) fmt2 = dfmtstr(totalsize) - ui.write(b'revisions : ' + fmt2 % numrevs) - ui.write(b' merges : ' + fmt % pcfmt(nummerges, numrevs)) - ui.write(b' normal : ' + fmt % pcfmt(numrevs - nummerges, numrevs)) - ui.write(b'revisions : ' + fmt2 % numrevs) - ui.write(b' empty : ' + fmt % pcfmt(numempty, numrevs)) - ui.write( + ui.writenoi18n(b'revisions : ' + fmt2 % numrevs) + ui.writenoi18n(b' merges : ' + fmt % pcfmt(nummerges, numrevs)) + ui.writenoi18n(b' normal : ' + fmt % pcfmt(numrevs - nummerges, numrevs)) + ui.writenoi18n(b'revisions : ' + fmt2 % numrevs) + ui.writenoi18n(b' empty : ' + fmt % pcfmt(numempty, numrevs)) + ui.writenoi18n( b' text : ' + fmt % pcfmt(numemptytext, numemptytext + numemptydelta) ) - ui.write( + ui.writenoi18n( b' delta : ' + fmt % pcfmt(numemptydelta, numemptytext + numemptydelta) ) - ui.write(b' snapshot : ' + fmt % pcfmt(numfull + numsemi, numrevs)) + ui.writenoi18n(b' snapshot : ' + fmt % pcfmt(numfull + numsemi, numrevs)) for depth in sorted(numsnapdepth): ui.write( (b' lvl-%-3d : ' % depth) + fmt % pcfmt(numsnapdepth[depth], numrevs) ) - ui.write(b' deltas : ' + fmt % pcfmt(numdeltas, numrevs)) - ui.write(b'revision size : ' + fmt2 % totalsize) - ui.write( + ui.writenoi18n(b' deltas : ' + fmt % pcfmt(numdeltas, numrevs)) + ui.writenoi18n(b'revision size : ' + fmt2 % totalsize) + ui.writenoi18n( b' snapshot : ' + fmt % pcfmt(fulltotal + semitotal, totalsize) ) for depth in sorted(numsnapdepth): @@ -2820,7 +2820,7 @@ (b' lvl-%-3d : ' % depth) + fmt % pcfmt(snaptotal[depth], totalsize) ) - ui.write(b' deltas : ' + fmt % pcfmt(deltatotal, totalsize)) + ui.writenoi18n(b' deltas : ' + fmt % pcfmt(deltatotal, totalsize)) def fmtchunktype(chunktype): if chunktype == b'empty': @@ -2831,44 +2831,44 @@ return b' 0x%s : ' % hex(chunktype) ui.write(b'\n') - ui.write(b'chunks : ' + fmt2 % numrevs) + ui.writenoi18n(b'chunks : ' + fmt2 % numrevs) for chunktype in sorted(chunktypecounts): ui.write(fmtchunktype(chunktype)) ui.write(fmt % pcfmt(chunktypecounts[chunktype], numrevs)) - ui.write(b'chunks size : ' + fmt2 % totalsize) + ui.writenoi18n(b'chunks size : ' + fmt2 % totalsize) for chunktype in sorted(chunktypecounts): ui.write(fmtchunktype(chunktype)) ui.write(fmt % pcfmt(chunktypesizes[chunktype], totalsize)) ui.write(b'\n') fmt = dfmtstr(max(avgchainlen, maxchainlen, maxchainspan, compratio)) - ui.write(b'avg chain length : ' + fmt % avgchainlen) - ui.write(b'max chain length : ' + fmt % maxchainlen) - ui.write(b'max chain reach : ' + fmt % maxchainspan) - ui.write(b'compression ratio : ' + fmt % compratio) + ui.writenoi18n(b'avg chain length : ' + fmt % avgchainlen) + ui.writenoi18n(b'max chain length : ' + fmt % maxchainlen) + ui.writenoi18n(b'max chain reach : ' + fmt % maxchainspan) + ui.writenoi18n(b'compression ratio : ' + fmt % compratio) if format > 0: ui.write(b'\n') - ui.write( + ui.writenoi18n( b'uncompressed data size (min/max/avg) : %d / %d / %d\n' % tuple(datasize) ) - ui.write( + ui.writenoi18n( b'full revision size (min/max/avg) : %d / %d / %d\n' % tuple(fullsize) ) - ui.write( + ui.writenoi18n( b'inter-snapshot size (min/max/avg) : %d / %d / %d\n' % tuple(semisize) ) for depth in sorted(snapsizedepth): if depth == 0: continue - ui.write( + ui.writenoi18n( b' level-%-3d (min/max/avg) : %d / %d / %d\n' % ((depth,) + tuple(snapsizedepth[depth])) ) - ui.write( + ui.writenoi18n( b'delta size (min/max/avg) : %d / %d / %d\n' % tuple(deltasize) ) @@ -2877,21 +2877,21 @@ ui.write(b'\n') fmt = pcfmtstr(numdeltas) fmt2 = pcfmtstr(numdeltas, 4) - ui.write(b'deltas against prev : ' + fmt % pcfmt(numprev, numdeltas)) + ui.writenoi18n(b'deltas against prev : ' + fmt % pcfmt(numprev, numdeltas)) if numprev > 0: - ui.write( + ui.writenoi18n( b' where prev = p1 : ' + fmt2 % pcfmt(nump1prev, numprev) ) - ui.write( + ui.writenoi18n( b' where prev = p2 : ' + fmt2 % pcfmt(nump2prev, numprev) ) - ui.write( + ui.writenoi18n( b' other : ' + fmt2 % pcfmt(numoprev, numprev) ) if gdelta: - ui.write(b'deltas against p1 : ' + fmt % pcfmt(nump1, numdeltas)) - ui.write(b'deltas against p2 : ' + fmt % pcfmt(nump2, numdeltas)) - ui.write( + ui.writenoi18n(b'deltas against p1 : ' + fmt % pcfmt(nump1, numdeltas)) + ui.writenoi18n(b'deltas against p2 : ' + fmt % pcfmt(nump2, numdeltas)) + ui.writenoi18n( b'deltas against other : ' + fmt % pcfmt(numother, numdeltas) ) @@ -2929,7 +2929,7 @@ % (b"nodeid".ljust(idlen), b"p1".ljust(idlen)) ) else: - ui.write( + ui.writenoi18n( b" rev linkrev %s %s p2\n" % (b"nodeid".ljust(idlen), b"p1".ljust(idlen)) ) @@ -2943,7 +2943,7 @@ % b"nodeid".rjust(idlen) ) else: - ui.write( + ui.writenoi18n( b" rev flag size link p1 p2 %s\n" % b"nodeid".rjust(idlen) ) @@ -3109,14 +3109,14 @@ arevs = revset.makematcher(treebystage[b'analyzed'])(repo) brevs = revset.makematcher(treebystage[b'optimized'])(repo) if opts[b'show_set'] or (opts[b'show_set'] is None and ui.verbose): - ui.write(b"* analyzed set:\n", stringutil.prettyrepr(arevs), b"\n") - ui.write(b"* optimized set:\n", stringutil.prettyrepr(brevs), b"\n") + ui.writenoi18n(b"* analyzed set:\n", stringutil.prettyrepr(arevs), b"\n") + ui.writenoi18n(b"* optimized set:\n", stringutil.prettyrepr(brevs), b"\n") arevs = list(arevs) brevs = list(brevs) if arevs == brevs: return 0 - ui.write(b'--- analyzed\n', label=b'diff.file_a') - ui.write(b'+++ optimized\n', label=b'diff.file_b') + ui.writenoi18n(b'--- analyzed\n', label=b'diff.file_a') + ui.writenoi18n(b'+++ optimized\n', label=b'diff.file_b') sm = difflib.SequenceMatcher(None, arevs, brevs) for tag, alo, ahi, blo, bhi in sm.get_opcodes(): if tag in (r'delete', r'replace'): @@ -3133,7 +3133,7 @@ func = revset.makematcher(tree) revs = func(repo) if opts[b'show_set'] or (opts[b'show_set'] is None and ui.verbose): - ui.write(b"* set:\n", stringutil.prettyrepr(revs), b"\n") + ui.writenoi18n(b"* set:\n", stringutil.prettyrepr(revs), b"\n") if not opts[b'show_revs']: return for c in revs: @@ -3311,9 +3311,9 @@ def debugsub(ui, repo, rev=None): ctx = scmutil.revsingle(repo, rev, None) for k, v in sorted(ctx.substate.items()): - ui.write(b'path %s\n' % k) - ui.write(b' source %s\n' % v[0]) - ui.write(b' revision %s\n' % v[1]) + ui.writenoi18n(b'path %s\n' % k) + ui.writenoi18n(b' source %s\n' % v[0]) + ui.writenoi18n(b' revision %s\n' % v[1]) @command( @@ -3414,22 +3414,22 @@ ui.note(templater.prettyformat(tree), b'\n') newtree = templater.expandaliases(tree, aliases) if newtree != tree: - ui.note(b"* expanded:\n", templater.prettyformat(newtree), b'\n') + ui.notenoi18n(b"* expanded:\n", templater.prettyformat(newtree), b'\n') if revs is None: tres = formatter.templateresources(ui, repo) t = formatter.maketemplater(ui, tmpl, resources=tres) if ui.verbose: kwds, funcs = t.symbolsuseddefault() - ui.write(b"* keywords: %s\n" % b', '.join(sorted(kwds))) - ui.write(b"* functions: %s\n" % b', '.join(sorted(funcs))) + ui.writenoi18n(b"* keywords: %s\n" % b', '.join(sorted(kwds))) + ui.writenoi18n(b"* functions: %s\n" % b', '.join(sorted(funcs))) ui.write(t.renderdefault(props)) else: displayer = logcmdutil.maketemplater(ui, repo, tmpl) if ui.verbose: kwds, funcs = displayer.t.symbolsuseddefault() - ui.write(b"* keywords: %s\n" % b', '.join(sorted(kwds))) - ui.write(b"* functions: %s\n" % b', '.join(sorted(funcs))) + ui.writenoi18n(b"* keywords: %s\n" % b', '.join(sorted(kwds))) + ui.writenoi18n(b"* functions: %s\n" % b', '.join(sorted(funcs))) for r in revs: displayer.show(repo[r], **pycompat.strkwargs(props)) displayer.close() @@ -3444,7 +3444,7 @@ def debuguigetpass(ui, prompt=b''): """show prompt to type password""" r = ui.getpass(prompt) - ui.write(b'respose: %s\n' % r) + ui.writenoi18n(b'respose: %s\n' % r) @command( @@ -3456,7 +3456,7 @@ def debuguiprompt(ui, prompt=b''): """show plain prompt""" r = ui.prompt(prompt) - ui.write(b'response: %s\n' % r) + ui.writenoi18n(b'response: %s\n' % r) @command(b'debugupdatecaches', []) @@ -3522,7 +3522,7 @@ opts = pycompat.byteskwargs(opts) m = scmutil.match(repo[None], pats, opts) if ui.verbose: - ui.write(b'* matcher:\n', stringutil.prettyrepr(m), b'\n') + ui.writenoi18n(b'* matcher:\n', stringutil.prettyrepr(m), b'\n') items = list(repo[None].walk(m)) if not items: return diff --git a/mercurial/dispatch.py b/mercurial/dispatch.py --- a/mercurial/dispatch.py +++ b/mercurial/dispatch.py @@ -93,7 +93,7 @@ except: # re-raises below if exc is None: exc = sys.exc_info()[1] - self.ui.warn(b'error in exit handlers:\n') + self.ui.warnnoi18n(b'error in exit handlers:\n') self.ui.traceback(force=True) finally: if exc is not None: diff --git a/mercurial/sslutil.py b/mercurial/sslutil.py --- a/mercurial/sslutil.py +++ b/mercurial/sslutil.py @@ -383,11 +383,11 @@ sslkeylog.set_keylog( pycompat.fsdecode(encoding.environ[b'SSLKEYLOGFILE']) ) - ui.warn( + ui.warnnoi18n( b'sslkeylog enabled by SSLKEYLOGFILE environment variable\n' ) except ImportError: - ui.warn( + ui.warnnoi18n( b'sslkeylog module missing, ' b'but SSLKEYLOGFILE set in environment\n' ) diff --git a/tests/blackbox-readonly-dispatch.py b/tests/blackbox-readonly-dispatch.py --- a/tests/blackbox-readonly-dispatch.py +++ b/tests/blackbox-readonly-dispatch.py @@ -14,10 +14,10 @@ """ ui = uimod.ui.load() extensions.populateui(ui) - ui.status(b"running: %s\n" % cmd) + ui.statusnoi18n(b"running: %s\n" % cmd) req = dispatch.request(cmd.split(), ui) result = dispatch.dispatch(req) - ui.status(b"result: %r\n" % result) + ui.statusnoi18n(b"result: %r\n" % result) # create file 'foo', add and commit diff --git a/tests/test-ui-color.py b/tests/test-ui-color.py --- a/tests/test-ui-color.py +++ b/tests/test-ui-color.py @@ -10,8 +10,8 @@ # ensure errors aren't buffered testui = uimod.ui() testui.pushbuffer() -testui.write(b'buffered\n') -testui.warn(b'warning\n') +testui.writenoi18n(b'buffered\n') +testui.warnnoi18n(b'warning\n') testui.write_err(b'error\n') print(stringutil.pprint(testui.popbuffer(), bprefix=True).decode('ascii'))