##// END OF EJS Templates
errors: name arguments to Abort constructor...
errors: name arguments to Abort constructor Differential Revision: https://phab.mercurial-scm.org/D9179

File last commit:

r44514:006e7821 default
r46274:d2e1dcd4 default
Show More
debugcommands.py
477 lines | 13.2 KiB | text/x-python | PythonLexer
Augie Fackler
remotefilelog: import pruned-down remotefilelog extension from hg-experimental...
r40530 # debugcommands.py - debug logic for remotefilelog
#
# Copyright 2013 Facebook, Inc.
#
# This software may be used and distributed according to the terms of the
# GNU General Public License version 2 or any later version.
from __future__ import absolute_import
import os
Augie Fackler
remotefilelog: rip out lz4 support...
r40542 import zlib
Augie Fackler
remotefilelog: import pruned-down remotefilelog extension from hg-experimental...
r40530
from mercurial.node import bin, hex, nullid, short
from mercurial.i18n import _
Gregory Szorc
py3: manually import pycompat.open into files that need it...
r43355 from mercurial.pycompat import open
Augie Fackler
remotefilelog: import pruned-down remotefilelog extension from hg-experimental...
r40530 from mercurial import (
error,
filelog,
Boris Feld
remotefilelog: replace repack lock to solve race condition...
r43213 lock as lockmod,
Pulkit Goyal
py3: use node.hex(h.digest()) instead of h.hexdigest()...
r40648 node as nodemod,
Kyle Lippincott
remotefilelog: fix format str, blobsize isn't always a #, can be "(missing)"...
r41973 pycompat,
Augie Fackler
remotefilelog: import pruned-down remotefilelog extension from hg-experimental...
r40530 revlog,
)
Augie Fackler
hgext: replace references to hashlib.sha1 with hashutil.sha1...
r44519 from mercurial.utils import hashutil
Augie Fackler
remotefilelog: import pruned-down remotefilelog extension from hg-experimental...
r40530 from . import (
constants,
datapack,
fileserverclient,
historypack,
repack,
shallowutil,
)
Augie Fackler
formatting: blacken the codebase...
r43346
Augie Fackler
remotefilelog: import pruned-down remotefilelog extension from hg-experimental...
r40530 def debugremotefilelog(ui, path, **opts):
Augie Fackler
cleanup: remove pointless r-prefixes on single-quoted strings...
r43906 decompress = opts.get('decompress')
Augie Fackler
remotefilelog: import pruned-down remotefilelog extension from hg-experimental...
r40530
size, firstnode, mapping = parsefileblob(path, decompress)
Augie Fackler
formatting: byteify all mercurial/ and hgext/ string literals...
r43347 ui.status(_(b"size: %d bytes\n") % size)
ui.status(_(b"path: %s \n") % path)
ui.status(_(b"key: %s \n") % (short(firstnode)))
ui.status(_(b"\n"))
Augie Fackler
formatting: blacken the codebase...
r43346 ui.status(
Augie Fackler
formatting: byteify all mercurial/ and hgext/ string literals...
r43347 _(b"%12s => %12s %13s %13s %12s\n")
% (b"node", b"p1", b"p2", b"linknode", b"copyfrom")
Augie Fackler
formatting: blacken the codebase...
r43346 )
Augie Fackler
remotefilelog: import pruned-down remotefilelog extension from hg-experimental...
r40530
queue = [firstnode]
while queue:
node = queue.pop(0)
p1, p2, linknode, copyfrom = mapping[node]
Augie Fackler
formatting: blacken the codebase...
r43346 ui.status(
Augie Fackler
formatting: byteify all mercurial/ and hgext/ string literals...
r43347 _(b"%s => %s %s %s %s\n")
Augie Fackler
formatting: blacken the codebase...
r43346 % (short(node), short(p1), short(p2), short(linknode), copyfrom)
)
Augie Fackler
remotefilelog: import pruned-down remotefilelog extension from hg-experimental...
r40530 if p1 != nullid:
queue.append(p1)
if p2 != nullid:
queue.append(p2)
Augie Fackler
formatting: blacken the codebase...
r43346
Augie Fackler
remotefilelog: import pruned-down remotefilelog extension from hg-experimental...
r40530 def buildtemprevlog(repo, file):
# get filename key
Augie Fackler
hgext: replace references to hashlib.sha1 with hashutil.sha1...
r44519 filekey = nodemod.hex(hashutil.sha1(file).digest())
Augie Fackler
formatting: byteify all mercurial/ and hgext/ string literals...
r43347 filedir = os.path.join(repo.path, b'store/data', filekey)
Augie Fackler
remotefilelog: import pruned-down remotefilelog extension from hg-experimental...
r40530
# sort all entries based on linkrev
fctxs = []
for filenode in os.listdir(filedir):
Augie Fackler
formatting: byteify all mercurial/ and hgext/ string literals...
r43347 if b'_old' not in filenode:
Augie Fackler
remotefilelog: import pruned-down remotefilelog extension from hg-experimental...
r40530 fctxs.append(repo.filectx(file, fileid=bin(filenode)))
fctxs = sorted(fctxs, key=lambda x: x.linkrev())
# add to revlog
Augie Fackler
formatting: byteify all mercurial/ and hgext/ string literals...
r43347 temppath = repo.sjoin(b'data/temprevlog.i')
Augie Fackler
remotefilelog: import pruned-down remotefilelog extension from hg-experimental...
r40530 if os.path.exists(temppath):
os.remove(temppath)
Augie Fackler
formatting: byteify all mercurial/ and hgext/ string literals...
r43347 r = filelog.filelog(repo.svfs, b'temprevlog')
Augie Fackler
remotefilelog: import pruned-down remotefilelog extension from hg-experimental...
r40530
class faket(object):
def add(self, a, b, c):
pass
Augie Fackler
formatting: blacken the codebase...
r43346
Augie Fackler
remotefilelog: import pruned-down remotefilelog extension from hg-experimental...
r40530 t = faket()
for fctx in fctxs:
if fctx.node() not in repo:
continue
p = fctx.filelog().parents(fctx.filenode())
meta = {}
if fctx.renamed():
Augie Fackler
formatting: byteify all mercurial/ and hgext/ string literals...
r43347 meta[b'copy'] = fctx.renamed()[0]
meta[b'copyrev'] = hex(fctx.renamed()[1])
Augie Fackler
remotefilelog: import pruned-down remotefilelog extension from hg-experimental...
r40530
r.add(fctx.data(), meta, t, fctx.linkrev(), p[0], p[1])
return r
Augie Fackler
formatting: blacken the codebase...
r43346
Augie Fackler
remotefilelog: import pruned-down remotefilelog extension from hg-experimental...
r40530 def debugindex(orig, ui, repo, file_=None, **opts):
"""dump the contents of an index file"""
Augie Fackler
formatting: blacken the codebase...
r43346 if (
Augie Fackler
cleanup: remove pointless r-prefixes on single-quoted strings...
r43906 opts.get('changelog')
or opts.get('manifest')
or opts.get('dir')
Augie Fackler
formatting: blacken the codebase...
r43346 or not shallowutil.isenabled(repo)
or not repo.shallowmatch(file_)
):
Augie Fackler
remotefilelog: import pruned-down remotefilelog extension from hg-experimental...
r40530 return orig(ui, repo, file_, **opts)
r = buildtemprevlog(repo, file_)
# debugindex like normal
Augie Fackler
formatting: byteify all mercurial/ and hgext/ string literals...
r43347 format = opts.get(b'format', 0)
Augie Fackler
remotefilelog: import pruned-down remotefilelog extension from hg-experimental...
r40530 if format not in (0, 1):
Augie Fackler
formatting: byteify all mercurial/ and hgext/ string literals...
r43347 raise error.Abort(_(b"unknown format %d") % format)
Augie Fackler
remotefilelog: import pruned-down remotefilelog extension from hg-experimental...
r40530
generaldelta = r.version & revlog.FLAG_GENERALDELTA
if generaldelta:
Augie Fackler
formatting: byteify all mercurial/ and hgext/ string literals...
r43347 basehdr = b' delta'
Augie Fackler
remotefilelog: import pruned-down remotefilelog extension from hg-experimental...
r40530 else:
Augie Fackler
formatting: byteify all mercurial/ and hgext/ string literals...
r43347 basehdr = b' base'
Augie Fackler
remotefilelog: import pruned-down remotefilelog extension from hg-experimental...
r40530
if format == 0:
Augie Fackler
formatting: blacken the codebase...
r43346 ui.write(
(
Augie Fackler
formatting: byteify all mercurial/ and hgext/ string literals...
r43347 b" rev offset length " + basehdr + b" linkrev"
b" nodeid p1 p2\n"
Augie Fackler
formatting: blacken the codebase...
r43346 )
)
Augie Fackler
remotefilelog: import pruned-down remotefilelog extension from hg-experimental...
r40530 elif format == 1:
Augie Fackler
formatting: blacken the codebase...
r43346 ui.write(
(
Augie Fackler
formatting: byteify all mercurial/ and hgext/ string literals...
r43347 b" rev flag offset length"
b" size " + basehdr + b" link p1 p2"
b" nodeid\n"
Augie Fackler
formatting: blacken the codebase...
r43346 )
)
Augie Fackler
remotefilelog: import pruned-down remotefilelog extension from hg-experimental...
r40530
for i in r:
node = r.node(i)
if generaldelta:
base = r.deltaparent(i)
else:
base = r.chainbase(i)
if format == 0:
try:
pp = r.parents(node)
except Exception:
pp = [nullid, nullid]
Augie Fackler
formatting: blacken the codebase...
r43346 ui.write(
Augie Fackler
formatting: byteify all mercurial/ and hgext/ string literals...
r43347 b"% 6d % 9d % 7d % 6d % 7d %s %s %s\n"
Augie Fackler
formatting: blacken the codebase...
r43346 % (
i,
r.start(i),
r.length(i),
base,
r.linkrev(i),
short(node),
short(pp[0]),
short(pp[1]),
)
)
Augie Fackler
remotefilelog: import pruned-down remotefilelog extension from hg-experimental...
r40530 elif format == 1:
pr = r.parentrevs(i)
Augie Fackler
formatting: blacken the codebase...
r43346 ui.write(
Augie Fackler
formatting: byteify all mercurial/ and hgext/ string literals...
r43347 b"% 6d %04x % 8d % 8d % 8d % 6d % 6d % 6d % 6d %s\n"
Augie Fackler
formatting: blacken the codebase...
r43346 % (
i,
r.flags(i),
r.start(i),
r.length(i),
r.rawsize(i),
base,
r.linkrev(i),
pr[0],
pr[1],
short(node),
)
)
Augie Fackler
remotefilelog: import pruned-down remotefilelog extension from hg-experimental...
r40530
def debugindexdot(orig, ui, repo, file_):
"""dump an index DAG as a graphviz dot file"""
Pulkit Goyal
shallowutil: introduce a helper function isenabled()...
r40549 if not shallowutil.isenabled(repo):
Augie Fackler
remotefilelog: import pruned-down remotefilelog extension from hg-experimental...
r40530 return orig(ui, repo, file_)
r = buildtemprevlog(repo, os.path.basename(file_)[:-2])
Augie Fackler
cleanup: mark some ui.(status|note|warn|write) calls as not needing i18n...
r43350 ui.writenoi18n(b"digraph G {\n")
Augie Fackler
remotefilelog: import pruned-down remotefilelog extension from hg-experimental...
r40530 for i in r:
node = r.node(i)
pp = r.parents(node)
Augie Fackler
formatting: byteify all mercurial/ and hgext/ string literals...
r43347 ui.write(b"\t%d -> %d\n" % (r.rev(pp[0]), i))
Augie Fackler
remotefilelog: import pruned-down remotefilelog extension from hg-experimental...
r40530 if pp[1] != nullid:
Augie Fackler
formatting: byteify all mercurial/ and hgext/ string literals...
r43347 ui.write(b"\t%d -> %d\n" % (r.rev(pp[1]), i))
ui.write(b"}\n")
Augie Fackler
remotefilelog: import pruned-down remotefilelog extension from hg-experimental...
r40530
Augie Fackler
formatting: blacken the codebase...
r43346
Augie Fackler
remotefilelog: import pruned-down remotefilelog extension from hg-experimental...
r40530 def verifyremotefilelog(ui, path, **opts):
Augie Fackler
cleanup: remove pointless r-prefixes on single-quoted strings...
r43906 decompress = opts.get('decompress')
Augie Fackler
remotefilelog: import pruned-down remotefilelog extension from hg-experimental...
r40530
for root, dirs, files in os.walk(path):
for file in files:
Augie Fackler
formatting: byteify all mercurial/ and hgext/ string literals...
r43347 if file == b"repos":
Augie Fackler
remotefilelog: import pruned-down remotefilelog extension from hg-experimental...
r40530 continue
filepath = os.path.join(root, file)
size, firstnode, mapping = parsefileblob(filepath, decompress)
Gregory Szorc
py3: define and use pycompat.itervalues()...
r43374 for p1, p2, linknode, copyfrom in pycompat.itervalues(mapping):
Augie Fackler
remotefilelog: import pruned-down remotefilelog extension from hg-experimental...
r40530 if linknode == nullid:
actualpath = os.path.relpath(root, path)
Augie Fackler
formatting: blacken the codebase...
r43346 key = fileserverclient.getcachekey(
Augie Fackler
formatting: byteify all mercurial/ and hgext/ string literals...
r43347 b"reponame", actualpath, file
Augie Fackler
formatting: blacken the codebase...
r43346 )
ui.status(
Augie Fackler
formatting: byteify all mercurial/ and hgext/ string literals...
r43347 b"%s %s\n" % (key, os.path.relpath(filepath, path))
Augie Fackler
formatting: blacken the codebase...
r43346 )
Augie Fackler
remotefilelog: import pruned-down remotefilelog extension from hg-experimental...
r40530
Augie Fackler
remotefilelog: rip out lz4 support...
r40542 def _decompressblob(raw):
return zlib.decompress(raw)
Augie Fackler
formatting: blacken the codebase...
r43346
Augie Fackler
remotefilelog: import pruned-down remotefilelog extension from hg-experimental...
r40530 def parsefileblob(path, decompress):
Augie Fackler
formatting: byteify all mercurial/ and hgext/ string literals...
r43347 f = open(path, b"rb")
Augie Fackler
remotefilelog: import pruned-down remotefilelog extension from hg-experimental...
r40530 try:
raw = f.read()
finally:
f.close()
if decompress:
Augie Fackler
remotefilelog: rip out lz4 support...
r40542 raw = _decompressblob(raw)
Augie Fackler
remotefilelog: import pruned-down remotefilelog extension from hg-experimental...
r40530
offset, size, flags = shallowutil.parsesizeflags(raw)
start = offset + size
firstnode = None
mapping = {}
while start < len(raw):
Augie Fackler
formatting: byteify all mercurial/ and hgext/ string literals...
r43347 divider = raw.index(b'\0', start + 80)
Augie Fackler
remotefilelog: import pruned-down remotefilelog extension from hg-experimental...
r40530
Augie Fackler
formatting: blacken the codebase...
r43346 currentnode = raw[start : (start + 20)]
Augie Fackler
remotefilelog: import pruned-down remotefilelog extension from hg-experimental...
r40530 if not firstnode:
firstnode = currentnode
Augie Fackler
formatting: blacken the codebase...
r43346 p1 = raw[(start + 20) : (start + 40)]
p2 = raw[(start + 40) : (start + 60)]
linknode = raw[(start + 60) : (start + 80)]
copyfrom = raw[(start + 80) : divider]
Augie Fackler
remotefilelog: import pruned-down remotefilelog extension from hg-experimental...
r40530
mapping[currentnode] = (p1, p2, linknode, copyfrom)
start = divider + 1
return size, firstnode, mapping
Augie Fackler
formatting: blacken the codebase...
r43346
Augie Fackler
remotefilelog: import pruned-down remotefilelog extension from hg-experimental...
r40530 def debugdatapack(ui, *paths, **opts):
for path in paths:
Augie Fackler
formatting: byteify all mercurial/ and hgext/ string literals...
r43347 if b'.data' in path:
path = path[: path.index(b'.data')]
ui.write(b"%s:\n" % path)
Augie Fackler
remotefilelog: import pruned-down remotefilelog extension from hg-experimental...
r40530 dpack = datapack.datapack(path)
Augie Fackler
cleanup: remove pointless r-prefixes on single-quoted strings...
r43906 node = opts.get('node')
Augie Fackler
remotefilelog: import pruned-down remotefilelog extension from hg-experimental...
r40530 if node:
Augie Fackler
formatting: byteify all mercurial/ and hgext/ string literals...
r43347 deltachain = dpack.getdeltachain(b'', bin(node))
Augie Fackler
remotefilelog: import pruned-down remotefilelog extension from hg-experimental...
r40530 dumpdeltachain(ui, deltachain, **opts)
return
Augie Fackler
cleanup: remove pointless r-prefixes on single-quoted strings...
r43906 if opts.get('long'):
Augie Fackler
remotefilelog: import pruned-down remotefilelog extension from hg-experimental...
r40530 hashformatter = hex
hashlen = 42
else:
hashformatter = short
hashlen = 14
lastfilename = None
totaldeltasize = 0
totalblobsize = 0
Augie Fackler
formatting: blacken the codebase...
r43346
Augie Fackler
remotefilelog: import pruned-down remotefilelog extension from hg-experimental...
r40530 def printtotals():
if lastfilename is not None:
Augie Fackler
formatting: byteify all mercurial/ and hgext/ string literals...
r43347 ui.write(b"\n")
Augie Fackler
remotefilelog: import pruned-down remotefilelog extension from hg-experimental...
r40530 if not totaldeltasize or not totalblobsize:
return
difference = totalblobsize - totaldeltasize
Augie Fackler
formatting: byteify all mercurial/ and hgext/ string literals...
r43347 deltastr = b"%0.1f%% %s" % (
Augie Fackler
remotefilelog: import pruned-down remotefilelog extension from hg-experimental...
r40530 (100.0 * abs(difference) / totalblobsize),
Augie Fackler
formatting: byteify all mercurial/ and hgext/ string literals...
r43347 (b"smaller" if difference > 0 else b"bigger"),
Augie Fackler
formatting: blacken the codebase...
r43346 )
Augie Fackler
remotefilelog: import pruned-down remotefilelog extension from hg-experimental...
r40530
Augie Fackler
cleanup: mark some ui.(status|note|warn|write) calls as not needing i18n...
r43350 ui.writenoi18n(
Augie Fackler
formatting: byteify all mercurial/ and hgext/ string literals...
r43347 b"Total:%s%s %s (%s)\n"
Augie Fackler
formatting: blacken the codebase...
r43346 % (
Augie Fackler
formatting: byteify all mercurial/ and hgext/ string literals...
r43347 b"".ljust(2 * hashlen - len(b"Total:")),
(b'%d' % totaldeltasize).ljust(12),
(b'%d' % totalblobsize).ljust(9),
Augie Fackler
formatting: blacken the codebase...
r43346 deltastr,
)
)
Augie Fackler
remotefilelog: import pruned-down remotefilelog extension from hg-experimental...
r40530
bases = {}
nodes = set()
failures = 0
for filename, node, deltabase, deltalen in dpack.iterentries():
bases[node] = deltabase
if node in nodes:
Augie Fackler
formatting: byteify all mercurial/ and hgext/ string literals...
r43347 ui.write((b"Bad entry: %s appears twice\n" % short(node)))
Augie Fackler
remotefilelog: import pruned-down remotefilelog extension from hg-experimental...
r40530 failures += 1
nodes.add(node)
if filename != lastfilename:
printtotals()
Augie Fackler
formatting: byteify all mercurial/ and hgext/ string literals...
r43347 name = b'(empty name)' if filename == b'' else filename
ui.write(b"%s:\n" % name)
Augie Fackler
formatting: blacken the codebase...
r43346 ui.write(
Augie Fackler
formatting: byteify all mercurial/ and hgext/ string literals...
r43347 b"%s%s%s%s\n"
Augie Fackler
formatting: blacken the codebase...
r43346 % (
Augie Fackler
formatting: byteify all mercurial/ and hgext/ string literals...
r43347 b"Node".ljust(hashlen),
b"Delta Base".ljust(hashlen),
b"Delta Length".ljust(14),
b"Blob Size".ljust(9),
Augie Fackler
formatting: blacken the codebase...
r43346 )
)
Augie Fackler
remotefilelog: import pruned-down remotefilelog extension from hg-experimental...
r40530 lastfilename = filename
totalblobsize = 0
totaldeltasize = 0
# Metadata could be missing, in which case it will be an empty dict.
meta = dpack.getmeta(filename, node)
if constants.METAKEYSIZE in meta:
blobsize = meta[constants.METAKEYSIZE]
totaldeltasize += deltalen
totalblobsize += blobsize
else:
Augie Fackler
formatting: byteify all mercurial/ and hgext/ string literals...
r43347 blobsize = b"(missing)"
Augie Fackler
formatting: blacken the codebase...
r43346 ui.write(
Augie Fackler
formatting: byteify all mercurial/ and hgext/ string literals...
r43347 b"%s %s %s%s\n"
Augie Fackler
formatting: blacken the codebase...
r43346 % (
hashformatter(node),
hashformatter(deltabase),
Augie Fackler
formatting: byteify all mercurial/ and hgext/ string literals...
r43347 (b'%d' % deltalen).ljust(14),
Augie Fackler
formatting: blacken the codebase...
r43346 pycompat.bytestr(blobsize),
)
)
Augie Fackler
remotefilelog: import pruned-down remotefilelog extension from hg-experimental...
r40530
if filename is not None:
printtotals()
failures += _sanitycheck(ui, set(nodes), bases)
if failures > 1:
Augie Fackler
formatting: byteify all mercurial/ and hgext/ string literals...
r43347 ui.warn((b"%d failures\n" % failures))
Augie Fackler
remotefilelog: import pruned-down remotefilelog extension from hg-experimental...
r40530 return 1
Augie Fackler
formatting: blacken the codebase...
r43346
Augie Fackler
remotefilelog: import pruned-down remotefilelog extension from hg-experimental...
r40530 def _sanitycheck(ui, nodes, bases):
"""
Does some basic sanity checking on a packfiles with ``nodes`` ``bases`` (a
mapping of node->base):
- Each deltabase must itself be a node elsewhere in the pack
- There must be no cycles
"""
failures = 0
for node in nodes:
seen = set()
current = node
deltabase = bases[current]
while deltabase != nullid:
if deltabase not in nodes:
Augie Fackler
formatting: blacken the codebase...
r43346 ui.warn(
(
Augie Fackler
formatting: byteify all mercurial/ and hgext/ string literals...
r43347 b"Bad entry: %s has an unknown deltabase (%s)\n"
Augie Fackler
formatting: blacken the codebase...
r43346 % (short(node), short(deltabase))
)
)
Augie Fackler
remotefilelog: import pruned-down remotefilelog extension from hg-experimental...
r40530 failures += 1
break
if deltabase in seen:
Augie Fackler
formatting: blacken the codebase...
r43346 ui.warn(
(
Augie Fackler
formatting: byteify all mercurial/ and hgext/ string literals...
r43347 b"Bad entry: %s has a cycle (at %s)\n"
Augie Fackler
formatting: blacken the codebase...
r43346 % (short(node), short(deltabase))
)
)
Augie Fackler
remotefilelog: import pruned-down remotefilelog extension from hg-experimental...
r40530 failures += 1
break
current = deltabase
seen.add(current)
deltabase = bases[current]
# Since ``node`` begins a valid chain, reset/memoize its base to nullid
# so we don't traverse it again.
bases[node] = nullid
return failures
Augie Fackler
formatting: blacken the codebase...
r43346
Augie Fackler
remotefilelog: import pruned-down remotefilelog extension from hg-experimental...
r40530 def dumpdeltachain(ui, deltachain, **opts):
hashformatter = hex
hashlen = 40
lastfilename = None
for filename, node, filename, deltabasenode, delta in deltachain:
if filename != lastfilename:
Augie Fackler
formatting: byteify all mercurial/ and hgext/ string literals...
r43347 ui.write(b"\n%s\n" % filename)
Augie Fackler
remotefilelog: import pruned-down remotefilelog extension from hg-experimental...
r40530 lastfilename = filename
Augie Fackler
formatting: blacken the codebase...
r43346 ui.write(
Augie Fackler
formatting: byteify all mercurial/ and hgext/ string literals...
r43347 b"%s %s %s %s\n"
Augie Fackler
formatting: blacken the codebase...
r43346 % (
Augie Fackler
formatting: byteify all mercurial/ and hgext/ string literals...
r43347 b"Node".ljust(hashlen),
b"Delta Base".ljust(hashlen),
b"Delta SHA1".ljust(hashlen),
b"Delta Length".ljust(6),
Augie Fackler
formatting: blacken the codebase...
r43346 )
)
Augie Fackler
remotefilelog: import pruned-down remotefilelog extension from hg-experimental...
r40530
Augie Fackler
formatting: blacken the codebase...
r43346 ui.write(
Augie Fackler
formatting: byteify all mercurial/ and hgext/ string literals...
r43347 b"%s %s %s %d\n"
Augie Fackler
formatting: blacken the codebase...
r43346 % (
hashformatter(node),
hashformatter(deltabasenode),
Augie Fackler
hgext: replace references to hashlib.sha1 with hashutil.sha1...
r44519 nodemod.hex(hashutil.sha1(delta).digest()),
Augie Fackler
formatting: blacken the codebase...
r43346 len(delta),
)
)
Augie Fackler
remotefilelog: import pruned-down remotefilelog extension from hg-experimental...
r40530
def debughistorypack(ui, path):
Augie Fackler
formatting: byteify all mercurial/ and hgext/ string literals...
r43347 if b'.hist' in path:
path = path[: path.index(b'.hist')]
Augie Fackler
remotefilelog: import pruned-down remotefilelog extension from hg-experimental...
r40530 hpack = historypack.historypack(path)
lastfilename = None
for entry in hpack.iterentries():
filename, node, p1node, p2node, linknode, copyfrom = entry
if filename != lastfilename:
Augie Fackler
formatting: byteify all mercurial/ and hgext/ string literals...
r43347 ui.write(b"\n%s\n" % filename)
Augie Fackler
formatting: blacken the codebase...
r43346 ui.write(
Augie Fackler
formatting: byteify all mercurial/ and hgext/ string literals...
r43347 b"%s%s%s%s%s\n"
Augie Fackler
formatting: blacken the codebase...
r43346 % (
Augie Fackler
formatting: byteify all mercurial/ and hgext/ string literals...
r43347 b"Node".ljust(14),
b"P1 Node".ljust(14),
b"P2 Node".ljust(14),
b"Link Node".ljust(14),
b"Copy From",
Augie Fackler
formatting: blacken the codebase...
r43346 )
)
Augie Fackler
remotefilelog: import pruned-down remotefilelog extension from hg-experimental...
r40530 lastfilename = filename
Augie Fackler
formatting: blacken the codebase...
r43346 ui.write(
Augie Fackler
formatting: byteify all mercurial/ and hgext/ string literals...
r43347 b"%s %s %s %s %s\n"
Augie Fackler
formatting: blacken the codebase...
r43346 % (
short(node),
short(p1node),
short(p2node),
short(linknode),
copyfrom,
)
)
Augie Fackler
remotefilelog: import pruned-down remotefilelog extension from hg-experimental...
r40530
def debugwaitonrepack(repo):
Augie Fackler
formatting: byteify all mercurial/ and hgext/ string literals...
r43347 with lockmod.lock(repack.repacklockvfs(repo), b"repacklock", timeout=-1):
Augie Fackler
remotefilelog: import pruned-down remotefilelog extension from hg-experimental...
r40530 return
Augie Fackler
formatting: blacken the codebase...
r43346
Augie Fackler
remotefilelog: import pruned-down remotefilelog extension from hg-experimental...
r40530 def debugwaitonprefetch(repo):
Augie Fackler
formatting: blacken the codebase...
r43346 with repo._lock(
repo.svfs,
Augie Fackler
formatting: byteify all mercurial/ and hgext/ string literals...
r43347 b"prefetchlock",
Augie Fackler
formatting: blacken the codebase...
r43346 True,
None,
None,
Augie Fackler
formatting: byteify all mercurial/ and hgext/ string literals...
r43347 _(b'prefetching in %s') % repo.origroot,
Augie Fackler
formatting: blacken the codebase...
r43346 ):
Augie Fackler
remotefilelog: import pruned-down remotefilelog extension from hg-experimental...
r40530 pass