Mercurial > hg
comparison mercurial/debugcommands.py @ 43080:86e4daa2d54c
cleanup: mark some ui.(status|note|warn|write) calls as not needing i18n
These used to be marked with no-op parens, but black removes those now
and this is more explicit.
# skip-blame: fallout from mass reformatting
Differential Revision: https://phab.mercurial-scm.org/D6996
author | Augie Fackler <augie@google.com> |
---|---|
date | Sun, 06 Oct 2019 10:51:16 -0400 |
parents | 687b865b95ad |
children | eef9a2d67051 |
comparison
equal
deleted
inserted
replaced
43079:5209fc94b982 | 43080:86e4daa2d54c |
---|---|
302 | 302 |
303 | 303 |
304 def _debugchangegroup(ui, gen, all=None, indent=0, **opts): | 304 def _debugchangegroup(ui, gen, all=None, indent=0, **opts): |
305 indent_string = b' ' * indent | 305 indent_string = b' ' * indent |
306 if all: | 306 if all: |
307 ui.write( | 307 ui.writenoi18n( |
308 b"%sformat: id, p1, p2, cset, delta base, len(delta)\n" | 308 b"%sformat: id, p1, p2, cset, delta base, len(delta)\n" |
309 % indent_string | 309 % indent_string |
310 ) | 310 ) |
311 | 311 |
312 def showchunks(named): | 312 def showchunks(named): |
436 def debugcapabilities(ui, path, **opts): | 436 def debugcapabilities(ui, path, **opts): |
437 """lists the capabilities of a remote peer""" | 437 """lists the capabilities of a remote peer""" |
438 opts = pycompat.byteskwargs(opts) | 438 opts = pycompat.byteskwargs(opts) |
439 peer = hg.peer(ui, opts, path) | 439 peer = hg.peer(ui, opts, path) |
440 caps = peer.capabilities() | 440 caps = peer.capabilities() |
441 ui.write(b'Main capabilities:\n') | 441 ui.writenoi18n(b'Main capabilities:\n') |
442 for c in sorted(caps): | 442 for c in sorted(caps): |
443 ui.write(b' %s\n' % c) | 443 ui.write(b' %s\n' % c) |
444 b2caps = bundle2.bundle2caps(peer) | 444 b2caps = bundle2.bundle2caps(peer) |
445 if b2caps: | 445 if b2caps: |
446 ui.write(b'Bundle2 capabilities:\n') | 446 ui.writenoi18n(b'Bundle2 capabilities:\n') |
447 for key, values in sorted(b2caps.iteritems()): | 447 for key, values in sorted(b2caps.iteritems()): |
448 ui.write(b' %s\n' % key) | 448 ui.write(b' %s\n' % key) |
449 for v in values: | 449 for v in values: |
450 ui.write(b' %s\n' % v) | 450 ui.write(b' %s\n' % v) |
451 | 451 |
485 [(b'', b'style', None, _(b'show all configured styles'))], | 485 [(b'', b'style', None, _(b'show all configured styles'))], |
486 b'hg debugcolor', | 486 b'hg debugcolor', |
487 ) | 487 ) |
488 def debugcolor(ui, repo, **opts): | 488 def debugcolor(ui, repo, **opts): |
489 """show available color, effects or style""" | 489 """show available color, effects or style""" |
490 ui.write(b'color mode: %s\n' % stringutil.pprint(ui._colormode)) | 490 ui.writenoi18n(b'color mode: %s\n' % stringutil.pprint(ui._colormode)) |
491 if opts.get(r'style'): | 491 if opts.get(r'style'): |
492 return _debugdisplaystyle(ui) | 492 return _debugdisplaystyle(ui) |
493 else: | 493 else: |
494 return _debugdisplaycolor(ui) | 494 return _debugdisplaycolor(ui) |
495 | 495 |
649 """parse and display a date""" | 649 """parse and display a date""" |
650 if opts[r"extended"]: | 650 if opts[r"extended"]: |
651 d = dateutil.parsedate(date, util.extendeddateformats) | 651 d = dateutil.parsedate(date, util.extendeddateformats) |
652 else: | 652 else: |
653 d = dateutil.parsedate(date) | 653 d = dateutil.parsedate(date) |
654 ui.write(b"internal: %d %d\n" % d) | 654 ui.writenoi18n(b"internal: %d %d\n" % d) |
655 ui.write(b"standard: %s\n" % dateutil.datestr(d)) | 655 ui.writenoi18n(b"standard: %s\n" % dateutil.datestr(d)) |
656 if range: | 656 if range: |
657 m = dateutil.matchdate(range) | 657 m = dateutil.matchdate(range) |
658 ui.write(b"match: %s\n" % m(d[0])) | 658 ui.writenoi18n(b"match: %s\n" % m(d[0])) |
659 | 659 |
660 | 660 |
661 @command( | 661 @command( |
662 b'debugdeltachain', | 662 b'debugdeltachain', |
663 cmdutil.debugrevlogopts + cmdutil.formatteropts, | 663 cmdutil.debugrevlogopts + cmdutil.formatteropts, |
920 common, _in, hds = treediscovery.findcommonincoming( | 920 common, _in, hds = treediscovery.findcommonincoming( |
921 repo, remote, force=True | 921 repo, remote, force=True |
922 ) | 922 ) |
923 common = set(common) | 923 common = set(common) |
924 if not opts.get(b'nonheads'): | 924 if not opts.get(b'nonheads'): |
925 ui.write( | 925 ui.writenoi18n( |
926 b"unpruned common: %s\n" | 926 b"unpruned common: %s\n" |
927 % b" ".join(sorted(short(n) for n in common)) | 927 % b" ".join(sorted(short(n) for n in common)) |
928 ) | 928 ) |
929 | 929 |
930 clnode = repo.changelog.node | 930 clnode = repo.changelog.node |
967 data[b'nb-revs'] = len(repo.revs(b'all()')) | 967 data[b'nb-revs'] = len(repo.revs(b'all()')) |
968 data[b'nb-revs-common'] = len(repo.revs(b'::%ln', common)) | 968 data[b'nb-revs-common'] = len(repo.revs(b'::%ln', common)) |
969 data[b'nb-revs-missing'] = data[b'nb-revs'] - data[b'nb-revs-common'] | 969 data[b'nb-revs-missing'] = data[b'nb-revs'] - data[b'nb-revs-common'] |
970 | 970 |
971 # display discovery summary | 971 # display discovery summary |
972 ui.write(b"elapsed time: %(elapsed)f seconds\n" % data) | 972 ui.writenoi18n(b"elapsed time: %(elapsed)f seconds\n" % data) |
973 ui.write(b"heads summary:\n") | 973 ui.writenoi18n(b"heads summary:\n") |
974 ui.write(b" total common heads: %(nb-common)9d\n" % data) | 974 ui.writenoi18n(b" total common heads: %(nb-common)9d\n" % data) |
975 ui.write(b" also local heads: %(nb-common-local)9d\n" % data) | 975 ui.writenoi18n(b" also local heads: %(nb-common-local)9d\n" % data) |
976 ui.write(b" also remote heads: %(nb-common-remote)9d\n" % data) | 976 ui.writenoi18n(b" also remote heads: %(nb-common-remote)9d\n" % data) |
977 ui.write(b" both: %(nb-common-both)9d\n" % data) | 977 ui.writenoi18n(b" both: %(nb-common-both)9d\n" % data) |
978 ui.write(b" local heads: %(nb-local)9d\n" % data) | 978 ui.writenoi18n(b" local heads: %(nb-local)9d\n" % data) |
979 ui.write(b" common: %(nb-common-local)9d\n" % data) | 979 ui.writenoi18n(b" common: %(nb-common-local)9d\n" % data) |
980 ui.write(b" missing: %(nb-local-missing)9d\n" % data) | 980 ui.writenoi18n(b" missing: %(nb-local-missing)9d\n" % data) |
981 ui.write(b" remote heads: %(nb-remote)9d\n" % data) | 981 ui.writenoi18n(b" remote heads: %(nb-remote)9d\n" % data) |
982 ui.write(b" common: %(nb-common-remote)9d\n" % data) | 982 ui.writenoi18n(b" common: %(nb-common-remote)9d\n" % data) |
983 ui.write(b" unknown: %(nb-remote-unknown)9d\n" % data) | 983 ui.writenoi18n(b" unknown: %(nb-remote-unknown)9d\n" % data) |
984 ui.write(b"local changesets: %(nb-revs)9d\n" % data) | 984 ui.writenoi18n(b"local changesets: %(nb-revs)9d\n" % data) |
985 ui.write(b" common: %(nb-revs-common)9d\n" % data) | 985 ui.writenoi18n(b" common: %(nb-revs-common)9d\n" % data) |
986 ui.write(b" missing: %(nb-revs-missing)9d\n" % data) | 986 ui.writenoi18n(b" missing: %(nb-revs-missing)9d\n" % data) |
987 | 987 |
988 if ui.verbose: | 988 if ui.verbose: |
989 ui.write( | 989 ui.writenoi18n( |
990 b"common heads: %s\n" % b" ".join(sorted(short(n) for n in common)) | 990 b"common heads: %s\n" % b" ".join(sorted(short(n) for n in common)) |
991 ) | 991 ) |
992 | 992 |
993 | 993 |
994 _chunksize = 4 << 10 | 994 _chunksize = 4 << 10 |
1161 files.update(ctx.files()) | 1161 files.update(ctx.files()) |
1162 files.update(ctx.substate) | 1162 files.update(ctx.substate) |
1163 | 1163 |
1164 m = ctx.matchfileset(expr) | 1164 m = ctx.matchfileset(expr) |
1165 if opts[b'show_matcher'] or (opts[b'show_matcher'] is None and ui.verbose): | 1165 if opts[b'show_matcher'] or (opts[b'show_matcher'] is None and ui.verbose): |
1166 ui.write(b'* matcher:\n', stringutil.prettyrepr(m), b'\n') | 1166 ui.writenoi18n(b'* matcher:\n', stringutil.prettyrepr(m), b'\n') |
1167 for f in sorted(files): | 1167 for f in sorted(files): |
1168 if not m(f): | 1168 if not m(f): |
1169 continue | 1169 continue |
1170 ui.write(b"%s\n" % f) | 1170 ui.write(b"%s\n" % f) |
1171 | 1171 |
1243 | 1243 |
1244 | 1244 |
1245 @command(b'debugfsinfo', [], _(b'[PATH]'), norepo=True) | 1245 @command(b'debugfsinfo', [], _(b'[PATH]'), norepo=True) |
1246 def debugfsinfo(ui, path=b"."): | 1246 def debugfsinfo(ui, path=b"."): |
1247 """show information detected about current filesystem""" | 1247 """show information detected about current filesystem""" |
1248 ui.write(b'path: %s\n' % path) | 1248 ui.writenoi18n(b'path: %s\n' % path) |
1249 ui.write(b'mounted on: %s\n' % (util.getfsmountpoint(path) or b'(unknown)')) | 1249 ui.writenoi18n(b'mounted on: %s\n' % (util.getfsmountpoint(path) or b'(unknown)')) |
1250 ui.write(b'exec: %s\n' % (util.checkexec(path) and b'yes' or b'no')) | 1250 ui.writenoi18n(b'exec: %s\n' % (util.checkexec(path) and b'yes' or b'no')) |
1251 ui.write(b'fstype: %s\n' % (util.getfstype(path) or b'(unknown)')) | 1251 ui.writenoi18n(b'fstype: %s\n' % (util.getfstype(path) or b'(unknown)')) |
1252 ui.write(b'symlink: %s\n' % (util.checklink(path) and b'yes' or b'no')) | 1252 ui.writenoi18n(b'symlink: %s\n' % (util.checklink(path) and b'yes' or b'no')) |
1253 ui.write(b'hardlink: %s\n' % (util.checknlink(path) and b'yes' or b'no')) | 1253 ui.writenoi18n(b'hardlink: %s\n' % (util.checknlink(path) and b'yes' or b'no')) |
1254 casesensitive = b'(unknown)' | 1254 casesensitive = b'(unknown)' |
1255 try: | 1255 try: |
1256 with pycompat.namedtempfile(prefix=b'.debugfsinfo', dir=path) as f: | 1256 with pycompat.namedtempfile(prefix=b'.debugfsinfo', dir=path) as f: |
1257 casesensitive = util.fscasesensitive(f.name) and b'yes' or b'no' | 1257 casesensitive = util.fscasesensitive(f.name) and b'yes' or b'no' |
1258 except OSError: | 1258 except OSError: |
1259 pass | 1259 pass |
1260 ui.write(b'case-sensitive: %s\n' % casesensitive) | 1260 ui.writenoi18n(b'case-sensitive: %s\n' % casesensitive) |
1261 | 1261 |
1262 | 1262 |
1263 @command( | 1263 @command( |
1264 b'debuggetbundle', | 1264 b'debuggetbundle', |
1265 [ | 1265 [ |
1407 ) | 1407 ) |
1408 def debugindexdot(ui, repo, file_=None, **opts): | 1408 def debugindexdot(ui, repo, file_=None, **opts): |
1409 """dump an index DAG as a graphviz dot file""" | 1409 """dump an index DAG as a graphviz dot file""" |
1410 opts = pycompat.byteskwargs(opts) | 1410 opts = pycompat.byteskwargs(opts) |
1411 r = cmdutil.openstorage(repo, b'debugindexdot', file_, opts) | 1411 r = cmdutil.openstorage(repo, b'debugindexdot', file_, opts) |
1412 ui.write(b"digraph G {\n") | 1412 ui.writenoi18n(b"digraph G {\n") |
1413 for i in r: | 1413 for i in r: |
1414 node = r.node(i) | 1414 node = r.node(i) |
1415 pp = r.parents(node) | 1415 pp = r.parents(node) |
1416 ui.write(b"\t%d -> %d\n" % (r.rev(pp[0]), i)) | 1416 ui.write(b"\t%d -> %d\n" % (r.rev(pp[0]), i)) |
1417 if pp[1] != nullid: | 1417 if pp[1] != nullid: |
1816 locker = b'user %s, process %s, host %s' % ( | 1816 locker = b'user %s, process %s, host %s' % ( |
1817 user or b'None', | 1817 user or b'None', |
1818 pid, | 1818 pid, |
1819 host, | 1819 host, |
1820 ) | 1820 ) |
1821 ui.write(b"%-6s %s (%ds)\n" % (name + b":", locker, age)) | 1821 ui.writenoi18n(b"%-6s %s (%ds)\n" % (name + b":", locker, age)) |
1822 return 1 | 1822 return 1 |
1823 except OSError as e: | 1823 except OSError as e: |
1824 if e.errno != errno.ENOENT: | 1824 if e.errno != errno.ENOENT: |
1825 raise | 1825 raise |
1826 | 1826 |
1827 ui.write(b"%-6s free\n" % (name + b":")) | 1827 ui.writenoi18n(b"%-6s free\n" % (name + b":")) |
1828 return 0 | 1828 return 0 |
1829 | 1829 |
1830 held += report(repo.svfs, b"lock", repo.lock) | 1830 held += report(repo.svfs, b"lock", repo.lock) |
1831 held += report(repo.vfs, b"wlock", repo.wlock) | 1831 held += report(repo.vfs, b"wlock", repo.wlock) |
1832 | 1832 |
1918 return b'null' | 1918 return b'null' |
1919 else: | 1919 else: |
1920 return h | 1920 return h |
1921 | 1921 |
1922 def printrecords(version): | 1922 def printrecords(version): |
1923 ui.write(b'* version %d records\n' % version) | 1923 ui.writenoi18n(b'* version %d records\n' % version) |
1924 if version == 1: | 1924 if version == 1: |
1925 records = v1records | 1925 records = v1records |
1926 else: | 1926 else: |
1927 records = v2records | 1927 records = v2records |
1928 | 1928 |
1929 for rtype, record in records: | 1929 for rtype, record in records: |
1930 # pretty print some record types | 1930 # pretty print some record types |
1931 if rtype == b'L': | 1931 if rtype == b'L': |
1932 ui.write(b'local: %s\n' % record) | 1932 ui.writenoi18n(b'local: %s\n' % record) |
1933 elif rtype == b'O': | 1933 elif rtype == b'O': |
1934 ui.write(b'other: %s\n' % record) | 1934 ui.writenoi18n(b'other: %s\n' % record) |
1935 elif rtype == b'm': | 1935 elif rtype == b'm': |
1936 driver, mdstate = record.split(b'\0', 1) | 1936 driver, mdstate = record.split(b'\0', 1) |
1937 ui.write(b'merge driver: %s (state "%s")\n' % (driver, mdstate)) | 1937 ui.writenoi18n(b'merge driver: %s (state "%s")\n' % (driver, mdstate)) |
1938 elif rtype in b'FDC': | 1938 elif rtype in b'FDC': |
1939 r = record.split(b'\0') | 1939 r = record.split(b'\0') |
1940 f, state, hash, lfile, afile, anode, ofile = r[0:7] | 1940 f, state, hash, lfile, afile, anode, ofile = r[0:7] |
1941 if version == 1: | 1941 if version == 1: |
1942 onode = b'not stored in v1 format' | 1942 onode = b'not stored in v1 format' |
1943 flags = r[7] | 1943 flags = r[7] |
1944 else: | 1944 else: |
1945 onode, flags = r[7:9] | 1945 onode, flags = r[7:9] |
1946 ui.write( | 1946 ui.writenoi18n( |
1947 b'file: %s (record type "%s", state "%s", hash %s)\n' | 1947 b'file: %s (record type "%s", state "%s", hash %s)\n' |
1948 % (f, rtype, state, _hashornull(hash)) | 1948 % (f, rtype, state, _hashornull(hash)) |
1949 ) | 1949 ) |
1950 ui.write(b' local path: %s (flags "%s")\n' % (lfile, flags)) | 1950 ui.writenoi18n(b' local path: %s (flags "%s")\n' % (lfile, flags)) |
1951 ui.write( | 1951 ui.writenoi18n( |
1952 b' ancestor path: %s (node %s)\n' | 1952 b' ancestor path: %s (node %s)\n' |
1953 % (afile, _hashornull(anode)) | 1953 % (afile, _hashornull(anode)) |
1954 ) | 1954 ) |
1955 ui.write( | 1955 ui.writenoi18n( |
1956 b' other path: %s (node %s)\n' | 1956 b' other path: %s (node %s)\n' |
1957 % (ofile, _hashornull(onode)) | 1957 % (ofile, _hashornull(onode)) |
1958 ) | 1958 ) |
1959 elif rtype == b'f': | 1959 elif rtype == b'f': |
1960 filename, rawextras = record.split(b'\0', 1) | 1960 filename, rawextras = record.split(b'\0', 1) |
1963 extrastrings = [] | 1963 extrastrings = [] |
1964 while i < len(extras): | 1964 while i < len(extras): |
1965 extrastrings.append(b'%s = %s' % (extras[i], extras[i + 1])) | 1965 extrastrings.append(b'%s = %s' % (extras[i], extras[i + 1])) |
1966 i += 2 | 1966 i += 2 |
1967 | 1967 |
1968 ui.write( | 1968 ui.writenoi18n( |
1969 b'file extras: %s (%s)\n' | 1969 b'file extras: %s (%s)\n' |
1970 % (filename, b', '.join(extrastrings)) | 1970 % (filename, b', '.join(extrastrings)) |
1971 ) | 1971 ) |
1972 elif rtype == b'l': | 1972 elif rtype == b'l': |
1973 labels = record.split(b'\0', 2) | 1973 labels = record.split(b'\0', 2) |
1974 labels = [l for l in labels if len(l) > 0] | 1974 labels = [l for l in labels if len(l) > 0] |
1975 ui.write(b'labels:\n') | 1975 ui.writenoi18n(b'labels:\n') |
1976 ui.write((b' local: %s\n' % labels[0])) | 1976 ui.write((b' local: %s\n' % labels[0])) |
1977 ui.write((b' other: %s\n' % labels[1])) | 1977 ui.write((b' other: %s\n' % labels[1])) |
1978 if len(labels) > 2: | 1978 if len(labels) > 2: |
1979 ui.write((b' base: %s\n' % labels[2])) | 1979 ui.write((b' base: %s\n' % labels[2])) |
1980 else: | 1980 else: |
1981 ui.write( | 1981 ui.writenoi18n( |
1982 b'unrecognized entry: %s\t%s\n' | 1982 b'unrecognized entry: %s\t%s\n' |
1983 % (rtype, record.replace(b'\0', b'\t')) | 1983 % (rtype, record.replace(b'\0', b'\t')) |
1984 ) | 1984 ) |
1985 | 1985 |
1986 # Avoid mergestate.read() since it may raise an exception for unsupported | 1986 # Avoid mergestate.read() since it may raise an exception for unsupported |
2002 | 2002 |
2003 v1records.sort(key=key) | 2003 v1records.sort(key=key) |
2004 v2records.sort(key=key) | 2004 v2records.sort(key=key) |
2005 | 2005 |
2006 if not v1records and not v2records: | 2006 if not v1records and not v2records: |
2007 ui.write(b'no merge state found\n') | 2007 ui.writenoi18n(b'no merge state found\n') |
2008 elif not v2records: | 2008 elif not v2records: |
2009 ui.note(b'no version 2 merge state\n') | 2009 ui.notenoi18n(b'no version 2 merge state\n') |
2010 printrecords(1) | 2010 printrecords(1) |
2011 elif ms._v1v2match(v1records, v2records): | 2011 elif ms._v1v2match(v1records, v2records): |
2012 ui.note(b'v1 and v2 states match: using v2\n') | 2012 ui.notenoi18n(b'v1 and v2 states match: using v2\n') |
2013 printrecords(2) | 2013 printrecords(2) |
2014 else: | 2014 else: |
2015 ui.note(b'v1 and v2 states mismatch: using v1\n') | 2015 ui.notenoi18n(b'v1 and v2 states mismatch: using v1\n') |
2016 printrecords(1) | 2016 printrecords(1) |
2017 if ui.verbose: | 2017 if ui.verbose: |
2018 printrecords(2) | 2018 printrecords(2) |
2019 | 2019 |
2020 | 2020 |
2379 """ | 2379 """ |
2380 opts = pycompat.byteskwargs(opts) | 2380 opts = pycompat.byteskwargs(opts) |
2381 overrides = {} | 2381 overrides = {} |
2382 if opts[b'tool']: | 2382 if opts[b'tool']: |
2383 overrides[(b'ui', b'forcemerge')] = opts[b'tool'] | 2383 overrides[(b'ui', b'forcemerge')] = opts[b'tool'] |
2384 ui.note(b'with --tool %r\n' % (pycompat.bytestr(opts[b'tool']))) | 2384 ui.notenoi18n(b'with --tool %r\n' % (pycompat.bytestr(opts[b'tool']))) |
2385 | 2385 |
2386 with ui.configoverride(overrides, b'debugmergepatterns'): | 2386 with ui.configoverride(overrides, b'debugmergepatterns'): |
2387 hgmerge = encoding.environ.get(b"HGMERGE") | 2387 hgmerge = encoding.environ.get(b"HGMERGE") |
2388 if hgmerge is not None: | 2388 if hgmerge is not None: |
2389 ui.note(b'with HGMERGE=%r\n' % (pycompat.bytestr(hgmerge))) | 2389 ui.notenoi18n(b'with HGMERGE=%r\n' % (pycompat.bytestr(hgmerge))) |
2390 uimerge = ui.config(b"ui", b"merge") | 2390 uimerge = ui.config(b"ui", b"merge") |
2391 if uimerge: | 2391 if uimerge: |
2392 ui.note(b'with ui.merge=%r\n' % (pycompat.bytestr(uimerge))) | 2392 ui.notenoi18n(b'with ui.merge=%r\n' % (pycompat.bytestr(uimerge))) |
2393 | 2393 |
2394 ctx = scmutil.revsingle(repo, opts.get(b'rev')) | 2394 ctx = scmutil.revsingle(repo, opts.get(b'rev')) |
2395 m = scmutil.match(ctx, pats, opts) | 2395 m = scmutil.match(ctx, pats, opts) |
2396 changedelete = opts[b'changedelete'] | 2396 changedelete = opts[b'changedelete'] |
2397 for path in ctx.walk(m): | 2397 for path in ctx.walk(m): |
2783 if total: | 2783 if total: |
2784 return (value, 100 * float(value) / total) | 2784 return (value, 100 * float(value) / total) |
2785 else: | 2785 else: |
2786 return value, 100.0 | 2786 return value, 100.0 |
2787 | 2787 |
2788 ui.write(b'format : %d\n' % format) | 2788 ui.writenoi18n(b'format : %d\n' % format) |
2789 ui.write(b'flags : %s\n' % b', '.join(flags)) | 2789 ui.writenoi18n(b'flags : %s\n' % b', '.join(flags)) |
2790 | 2790 |
2791 ui.write(b'\n') | 2791 ui.write(b'\n') |
2792 fmt = pcfmtstr(totalsize) | 2792 fmt = pcfmtstr(totalsize) |
2793 fmt2 = dfmtstr(totalsize) | 2793 fmt2 = dfmtstr(totalsize) |
2794 ui.write(b'revisions : ' + fmt2 % numrevs) | 2794 ui.writenoi18n(b'revisions : ' + fmt2 % numrevs) |
2795 ui.write(b' merges : ' + fmt % pcfmt(nummerges, numrevs)) | 2795 ui.writenoi18n(b' merges : ' + fmt % pcfmt(nummerges, numrevs)) |
2796 ui.write(b' normal : ' + fmt % pcfmt(numrevs - nummerges, numrevs)) | 2796 ui.writenoi18n(b' normal : ' + fmt % pcfmt(numrevs - nummerges, numrevs)) |
2797 ui.write(b'revisions : ' + fmt2 % numrevs) | 2797 ui.writenoi18n(b'revisions : ' + fmt2 % numrevs) |
2798 ui.write(b' empty : ' + fmt % pcfmt(numempty, numrevs)) | 2798 ui.writenoi18n(b' empty : ' + fmt % pcfmt(numempty, numrevs)) |
2799 ui.write( | 2799 ui.writenoi18n( |
2800 b' text : ' | 2800 b' text : ' |
2801 + fmt % pcfmt(numemptytext, numemptytext + numemptydelta) | 2801 + fmt % pcfmt(numemptytext, numemptytext + numemptydelta) |
2802 ) | 2802 ) |
2803 ui.write( | 2803 ui.writenoi18n( |
2804 b' delta : ' | 2804 b' delta : ' |
2805 + fmt % pcfmt(numemptydelta, numemptytext + numemptydelta) | 2805 + fmt % pcfmt(numemptydelta, numemptytext + numemptydelta) |
2806 ) | 2806 ) |
2807 ui.write(b' snapshot : ' + fmt % pcfmt(numfull + numsemi, numrevs)) | 2807 ui.writenoi18n(b' snapshot : ' + fmt % pcfmt(numfull + numsemi, numrevs)) |
2808 for depth in sorted(numsnapdepth): | 2808 for depth in sorted(numsnapdepth): |
2809 ui.write( | 2809 ui.write( |
2810 (b' lvl-%-3d : ' % depth) | 2810 (b' lvl-%-3d : ' % depth) |
2811 + fmt % pcfmt(numsnapdepth[depth], numrevs) | 2811 + fmt % pcfmt(numsnapdepth[depth], numrevs) |
2812 ) | 2812 ) |
2813 ui.write(b' deltas : ' + fmt % pcfmt(numdeltas, numrevs)) | 2813 ui.writenoi18n(b' deltas : ' + fmt % pcfmt(numdeltas, numrevs)) |
2814 ui.write(b'revision size : ' + fmt2 % totalsize) | 2814 ui.writenoi18n(b'revision size : ' + fmt2 % totalsize) |
2815 ui.write( | 2815 ui.writenoi18n( |
2816 b' snapshot : ' + fmt % pcfmt(fulltotal + semitotal, totalsize) | 2816 b' snapshot : ' + fmt % pcfmt(fulltotal + semitotal, totalsize) |
2817 ) | 2817 ) |
2818 for depth in sorted(numsnapdepth): | 2818 for depth in sorted(numsnapdepth): |
2819 ui.write( | 2819 ui.write( |
2820 (b' lvl-%-3d : ' % depth) | 2820 (b' lvl-%-3d : ' % depth) |
2821 + fmt % pcfmt(snaptotal[depth], totalsize) | 2821 + fmt % pcfmt(snaptotal[depth], totalsize) |
2822 ) | 2822 ) |
2823 ui.write(b' deltas : ' + fmt % pcfmt(deltatotal, totalsize)) | 2823 ui.writenoi18n(b' deltas : ' + fmt % pcfmt(deltatotal, totalsize)) |
2824 | 2824 |
2825 def fmtchunktype(chunktype): | 2825 def fmtchunktype(chunktype): |
2826 if chunktype == b'empty': | 2826 if chunktype == b'empty': |
2827 return b' %s : ' % chunktype | 2827 return b' %s : ' % chunktype |
2828 elif chunktype in pycompat.bytestr(string.ascii_letters): | 2828 elif chunktype in pycompat.bytestr(string.ascii_letters): |
2829 return b' 0x%s (%s) : ' % (hex(chunktype), chunktype) | 2829 return b' 0x%s (%s) : ' % (hex(chunktype), chunktype) |
2830 else: | 2830 else: |
2831 return b' 0x%s : ' % hex(chunktype) | 2831 return b' 0x%s : ' % hex(chunktype) |
2832 | 2832 |
2833 ui.write(b'\n') | 2833 ui.write(b'\n') |
2834 ui.write(b'chunks : ' + fmt2 % numrevs) | 2834 ui.writenoi18n(b'chunks : ' + fmt2 % numrevs) |
2835 for chunktype in sorted(chunktypecounts): | 2835 for chunktype in sorted(chunktypecounts): |
2836 ui.write(fmtchunktype(chunktype)) | 2836 ui.write(fmtchunktype(chunktype)) |
2837 ui.write(fmt % pcfmt(chunktypecounts[chunktype], numrevs)) | 2837 ui.write(fmt % pcfmt(chunktypecounts[chunktype], numrevs)) |
2838 ui.write(b'chunks size : ' + fmt2 % totalsize) | 2838 ui.writenoi18n(b'chunks size : ' + fmt2 % totalsize) |
2839 for chunktype in sorted(chunktypecounts): | 2839 for chunktype in sorted(chunktypecounts): |
2840 ui.write(fmtchunktype(chunktype)) | 2840 ui.write(fmtchunktype(chunktype)) |
2841 ui.write(fmt % pcfmt(chunktypesizes[chunktype], totalsize)) | 2841 ui.write(fmt % pcfmt(chunktypesizes[chunktype], totalsize)) |
2842 | 2842 |
2843 ui.write(b'\n') | 2843 ui.write(b'\n') |
2844 fmt = dfmtstr(max(avgchainlen, maxchainlen, maxchainspan, compratio)) | 2844 fmt = dfmtstr(max(avgchainlen, maxchainlen, maxchainspan, compratio)) |
2845 ui.write(b'avg chain length : ' + fmt % avgchainlen) | 2845 ui.writenoi18n(b'avg chain length : ' + fmt % avgchainlen) |
2846 ui.write(b'max chain length : ' + fmt % maxchainlen) | 2846 ui.writenoi18n(b'max chain length : ' + fmt % maxchainlen) |
2847 ui.write(b'max chain reach : ' + fmt % maxchainspan) | 2847 ui.writenoi18n(b'max chain reach : ' + fmt % maxchainspan) |
2848 ui.write(b'compression ratio : ' + fmt % compratio) | 2848 ui.writenoi18n(b'compression ratio : ' + fmt % compratio) |
2849 | 2849 |
2850 if format > 0: | 2850 if format > 0: |
2851 ui.write(b'\n') | 2851 ui.write(b'\n') |
2852 ui.write( | 2852 ui.writenoi18n( |
2853 b'uncompressed data size (min/max/avg) : %d / %d / %d\n' | 2853 b'uncompressed data size (min/max/avg) : %d / %d / %d\n' |
2854 % tuple(datasize) | 2854 % tuple(datasize) |
2855 ) | 2855 ) |
2856 ui.write( | 2856 ui.writenoi18n( |
2857 b'full revision size (min/max/avg) : %d / %d / %d\n' | 2857 b'full revision size (min/max/avg) : %d / %d / %d\n' |
2858 % tuple(fullsize) | 2858 % tuple(fullsize) |
2859 ) | 2859 ) |
2860 ui.write( | 2860 ui.writenoi18n( |
2861 b'inter-snapshot size (min/max/avg) : %d / %d / %d\n' | 2861 b'inter-snapshot size (min/max/avg) : %d / %d / %d\n' |
2862 % tuple(semisize) | 2862 % tuple(semisize) |
2863 ) | 2863 ) |
2864 for depth in sorted(snapsizedepth): | 2864 for depth in sorted(snapsizedepth): |
2865 if depth == 0: | 2865 if depth == 0: |
2866 continue | 2866 continue |
2867 ui.write( | 2867 ui.writenoi18n( |
2868 b' level-%-3d (min/max/avg) : %d / %d / %d\n' | 2868 b' level-%-3d (min/max/avg) : %d / %d / %d\n' |
2869 % ((depth,) + tuple(snapsizedepth[depth])) | 2869 % ((depth,) + tuple(snapsizedepth[depth])) |
2870 ) | 2870 ) |
2871 ui.write( | 2871 ui.writenoi18n( |
2872 b'delta size (min/max/avg) : %d / %d / %d\n' | 2872 b'delta size (min/max/avg) : %d / %d / %d\n' |
2873 % tuple(deltasize) | 2873 % tuple(deltasize) |
2874 ) | 2874 ) |
2875 | 2875 |
2876 if numdeltas > 0: | 2876 if numdeltas > 0: |
2877 ui.write(b'\n') | 2877 ui.write(b'\n') |
2878 fmt = pcfmtstr(numdeltas) | 2878 fmt = pcfmtstr(numdeltas) |
2879 fmt2 = pcfmtstr(numdeltas, 4) | 2879 fmt2 = pcfmtstr(numdeltas, 4) |
2880 ui.write(b'deltas against prev : ' + fmt % pcfmt(numprev, numdeltas)) | 2880 ui.writenoi18n(b'deltas against prev : ' + fmt % pcfmt(numprev, numdeltas)) |
2881 if numprev > 0: | 2881 if numprev > 0: |
2882 ui.write( | 2882 ui.writenoi18n( |
2883 b' where prev = p1 : ' + fmt2 % pcfmt(nump1prev, numprev) | 2883 b' where prev = p1 : ' + fmt2 % pcfmt(nump1prev, numprev) |
2884 ) | 2884 ) |
2885 ui.write( | 2885 ui.writenoi18n( |
2886 b' where prev = p2 : ' + fmt2 % pcfmt(nump2prev, numprev) | 2886 b' where prev = p2 : ' + fmt2 % pcfmt(nump2prev, numprev) |
2887 ) | 2887 ) |
2888 ui.write( | 2888 ui.writenoi18n( |
2889 b' other : ' + fmt2 % pcfmt(numoprev, numprev) | 2889 b' other : ' + fmt2 % pcfmt(numoprev, numprev) |
2890 ) | 2890 ) |
2891 if gdelta: | 2891 if gdelta: |
2892 ui.write(b'deltas against p1 : ' + fmt % pcfmt(nump1, numdeltas)) | 2892 ui.writenoi18n(b'deltas against p1 : ' + fmt % pcfmt(nump1, numdeltas)) |
2893 ui.write(b'deltas against p2 : ' + fmt % pcfmt(nump2, numdeltas)) | 2893 ui.writenoi18n(b'deltas against p2 : ' + fmt % pcfmt(nump2, numdeltas)) |
2894 ui.write( | 2894 ui.writenoi18n( |
2895 b'deltas against other : ' + fmt % pcfmt(numother, numdeltas) | 2895 b'deltas against other : ' + fmt % pcfmt(numother, numdeltas) |
2896 ) | 2896 ) |
2897 | 2897 |
2898 | 2898 |
2899 @command( | 2899 @command( |
2927 ui.write( | 2927 ui.write( |
2928 (b" rev offset length linkrev" b" %s %s p2\n") | 2928 (b" rev offset length linkrev" b" %s %s p2\n") |
2929 % (b"nodeid".ljust(idlen), b"p1".ljust(idlen)) | 2929 % (b"nodeid".ljust(idlen), b"p1".ljust(idlen)) |
2930 ) | 2930 ) |
2931 else: | 2931 else: |
2932 ui.write( | 2932 ui.writenoi18n( |
2933 b" rev linkrev %s %s p2\n" | 2933 b" rev linkrev %s %s p2\n" |
2934 % (b"nodeid".ljust(idlen), b"p1".ljust(idlen)) | 2934 % (b"nodeid".ljust(idlen), b"p1".ljust(idlen)) |
2935 ) | 2935 ) |
2936 elif format == 1: | 2936 elif format == 1: |
2937 if ui.verbose: | 2937 if ui.verbose: |
2941 b" p2 %s\n" | 2941 b" p2 %s\n" |
2942 ) | 2942 ) |
2943 % b"nodeid".rjust(idlen) | 2943 % b"nodeid".rjust(idlen) |
2944 ) | 2944 ) |
2945 else: | 2945 else: |
2946 ui.write( | 2946 ui.writenoi18n( |
2947 b" rev flag size link p1 p2 %s\n" | 2947 b" rev flag size link p1 p2 %s\n" |
2948 % b"nodeid".rjust(idlen) | 2948 % b"nodeid".rjust(idlen) |
2949 ) | 2949 ) |
2950 | 2950 |
2951 for i in r: | 2951 for i in r: |
3107 | 3107 |
3108 if opts[b'verify_optimized']: | 3108 if opts[b'verify_optimized']: |
3109 arevs = revset.makematcher(treebystage[b'analyzed'])(repo) | 3109 arevs = revset.makematcher(treebystage[b'analyzed'])(repo) |
3110 brevs = revset.makematcher(treebystage[b'optimized'])(repo) | 3110 brevs = revset.makematcher(treebystage[b'optimized'])(repo) |
3111 if opts[b'show_set'] or (opts[b'show_set'] is None and ui.verbose): | 3111 if opts[b'show_set'] or (opts[b'show_set'] is None and ui.verbose): |
3112 ui.write(b"* analyzed set:\n", stringutil.prettyrepr(arevs), b"\n") | 3112 ui.writenoi18n(b"* analyzed set:\n", stringutil.prettyrepr(arevs), b"\n") |
3113 ui.write(b"* optimized set:\n", stringutil.prettyrepr(brevs), b"\n") | 3113 ui.writenoi18n(b"* optimized set:\n", stringutil.prettyrepr(brevs), b"\n") |
3114 arevs = list(arevs) | 3114 arevs = list(arevs) |
3115 brevs = list(brevs) | 3115 brevs = list(brevs) |
3116 if arevs == brevs: | 3116 if arevs == brevs: |
3117 return 0 | 3117 return 0 |
3118 ui.write(b'--- analyzed\n', label=b'diff.file_a') | 3118 ui.writenoi18n(b'--- analyzed\n', label=b'diff.file_a') |
3119 ui.write(b'+++ optimized\n', label=b'diff.file_b') | 3119 ui.writenoi18n(b'+++ optimized\n', label=b'diff.file_b') |
3120 sm = difflib.SequenceMatcher(None, arevs, brevs) | 3120 sm = difflib.SequenceMatcher(None, arevs, brevs) |
3121 for tag, alo, ahi, blo, bhi in sm.get_opcodes(): | 3121 for tag, alo, ahi, blo, bhi in sm.get_opcodes(): |
3122 if tag in (r'delete', r'replace'): | 3122 if tag in (r'delete', r'replace'): |
3123 for c in arevs[alo:ahi]: | 3123 for c in arevs[alo:ahi]: |
3124 ui.write(b'-%d\n' % c, label=b'diff.deleted') | 3124 ui.write(b'-%d\n' % c, label=b'diff.deleted') |
3131 return 1 | 3131 return 1 |
3132 | 3132 |
3133 func = revset.makematcher(tree) | 3133 func = revset.makematcher(tree) |
3134 revs = func(repo) | 3134 revs = func(repo) |
3135 if opts[b'show_set'] or (opts[b'show_set'] is None and ui.verbose): | 3135 if opts[b'show_set'] or (opts[b'show_set'] is None and ui.verbose): |
3136 ui.write(b"* set:\n", stringutil.prettyrepr(revs), b"\n") | 3136 ui.writenoi18n(b"* set:\n", stringutil.prettyrepr(revs), b"\n") |
3137 if not opts[b'show_revs']: | 3137 if not opts[b'show_revs']: |
3138 return | 3138 return |
3139 for c in revs: | 3139 for c in revs: |
3140 ui.write(b"%d\n" % c) | 3140 ui.write(b"%d\n" % c) |
3141 | 3141 |
3309 _(b'[-r REV] [REV]'), | 3309 _(b'[-r REV] [REV]'), |
3310 ) | 3310 ) |
3311 def debugsub(ui, repo, rev=None): | 3311 def debugsub(ui, repo, rev=None): |
3312 ctx = scmutil.revsingle(repo, rev, None) | 3312 ctx = scmutil.revsingle(repo, rev, None) |
3313 for k, v in sorted(ctx.substate.items()): | 3313 for k, v in sorted(ctx.substate.items()): |
3314 ui.write(b'path %s\n' % k) | 3314 ui.writenoi18n(b'path %s\n' % k) |
3315 ui.write(b' source %s\n' % v[0]) | 3315 ui.writenoi18n(b' source %s\n' % v[0]) |
3316 ui.write(b' revision %s\n' % v[1]) | 3316 ui.writenoi18n(b' revision %s\n' % v[1]) |
3317 | 3317 |
3318 | 3318 |
3319 @command( | 3319 @command( |
3320 b'debugsuccessorssets', | 3320 b'debugsuccessorssets', |
3321 [(b'', b'closest', False, _(b'return closest successors sets only'))], | 3321 [(b'', b'closest', False, _(b'return closest successors sets only'))], |
3412 aliases = ui.configitems(b'templatealias') | 3412 aliases = ui.configitems(b'templatealias') |
3413 tree = templater.parse(tmpl) | 3413 tree = templater.parse(tmpl) |
3414 ui.note(templater.prettyformat(tree), b'\n') | 3414 ui.note(templater.prettyformat(tree), b'\n') |
3415 newtree = templater.expandaliases(tree, aliases) | 3415 newtree = templater.expandaliases(tree, aliases) |
3416 if newtree != tree: | 3416 if newtree != tree: |
3417 ui.note(b"* expanded:\n", templater.prettyformat(newtree), b'\n') | 3417 ui.notenoi18n(b"* expanded:\n", templater.prettyformat(newtree), b'\n') |
3418 | 3418 |
3419 if revs is None: | 3419 if revs is None: |
3420 tres = formatter.templateresources(ui, repo) | 3420 tres = formatter.templateresources(ui, repo) |
3421 t = formatter.maketemplater(ui, tmpl, resources=tres) | 3421 t = formatter.maketemplater(ui, tmpl, resources=tres) |
3422 if ui.verbose: | 3422 if ui.verbose: |
3423 kwds, funcs = t.symbolsuseddefault() | 3423 kwds, funcs = t.symbolsuseddefault() |
3424 ui.write(b"* keywords: %s\n" % b', '.join(sorted(kwds))) | 3424 ui.writenoi18n(b"* keywords: %s\n" % b', '.join(sorted(kwds))) |
3425 ui.write(b"* functions: %s\n" % b', '.join(sorted(funcs))) | 3425 ui.writenoi18n(b"* functions: %s\n" % b', '.join(sorted(funcs))) |
3426 ui.write(t.renderdefault(props)) | 3426 ui.write(t.renderdefault(props)) |
3427 else: | 3427 else: |
3428 displayer = logcmdutil.maketemplater(ui, repo, tmpl) | 3428 displayer = logcmdutil.maketemplater(ui, repo, tmpl) |
3429 if ui.verbose: | 3429 if ui.verbose: |
3430 kwds, funcs = displayer.t.symbolsuseddefault() | 3430 kwds, funcs = displayer.t.symbolsuseddefault() |
3431 ui.write(b"* keywords: %s\n" % b', '.join(sorted(kwds))) | 3431 ui.writenoi18n(b"* keywords: %s\n" % b', '.join(sorted(kwds))) |
3432 ui.write(b"* functions: %s\n" % b', '.join(sorted(funcs))) | 3432 ui.writenoi18n(b"* functions: %s\n" % b', '.join(sorted(funcs))) |
3433 for r in revs: | 3433 for r in revs: |
3434 displayer.show(repo[r], **pycompat.strkwargs(props)) | 3434 displayer.show(repo[r], **pycompat.strkwargs(props)) |
3435 displayer.close() | 3435 displayer.close() |
3436 | 3436 |
3437 | 3437 |
3442 norepo=True, | 3442 norepo=True, |
3443 ) | 3443 ) |
3444 def debuguigetpass(ui, prompt=b''): | 3444 def debuguigetpass(ui, prompt=b''): |
3445 """show prompt to type password""" | 3445 """show prompt to type password""" |
3446 r = ui.getpass(prompt) | 3446 r = ui.getpass(prompt) |
3447 ui.write(b'respose: %s\n' % r) | 3447 ui.writenoi18n(b'respose: %s\n' % r) |
3448 | 3448 |
3449 | 3449 |
3450 @command( | 3450 @command( |
3451 b'debuguiprompt', | 3451 b'debuguiprompt', |
3452 [(b'p', b'prompt', b'', _(b'prompt text'), _(b'TEXT')),], | 3452 [(b'p', b'prompt', b'', _(b'prompt text'), _(b'TEXT')),], |
3454 norepo=True, | 3454 norepo=True, |
3455 ) | 3455 ) |
3456 def debuguiprompt(ui, prompt=b''): | 3456 def debuguiprompt(ui, prompt=b''): |
3457 """show plain prompt""" | 3457 """show plain prompt""" |
3458 r = ui.prompt(prompt) | 3458 r = ui.prompt(prompt) |
3459 ui.write(b'response: %s\n' % r) | 3459 ui.writenoi18n(b'response: %s\n' % r) |
3460 | 3460 |
3461 | 3461 |
3462 @command(b'debugupdatecaches', []) | 3462 @command(b'debugupdatecaches', []) |
3463 def debugupdatecaches(ui, repo, *pats, **opts): | 3463 def debugupdatecaches(ui, repo, *pats, **opts): |
3464 """warm all known caches in the repository""" | 3464 """warm all known caches in the repository""" |
3520 def debugwalk(ui, repo, *pats, **opts): | 3520 def debugwalk(ui, repo, *pats, **opts): |
3521 """show how files match on given patterns""" | 3521 """show how files match on given patterns""" |
3522 opts = pycompat.byteskwargs(opts) | 3522 opts = pycompat.byteskwargs(opts) |
3523 m = scmutil.match(repo[None], pats, opts) | 3523 m = scmutil.match(repo[None], pats, opts) |
3524 if ui.verbose: | 3524 if ui.verbose: |
3525 ui.write(b'* matcher:\n', stringutil.prettyrepr(m), b'\n') | 3525 ui.writenoi18n(b'* matcher:\n', stringutil.prettyrepr(m), b'\n') |
3526 items = list(repo[None].walk(m)) | 3526 items = list(repo[None].walk(m)) |
3527 if not items: | 3527 if not items: |
3528 return | 3528 return |
3529 f = lambda fn: fn | 3529 f = lambda fn: fn |
3530 if ui.configbool(b'ui', b'slash') and pycompat.ossep != b'/': | 3530 if ui.configbool(b'ui', b'slash') and pycompat.ossep != b'/': |