##// END OF EJS Templates
tests: use sha256line.py instead of /dev/random in test-censor.t (issue6858)...
tests: use sha256line.py instead of /dev/random in test-censor.t (issue6858) Sometimes the systems that run our test suite don't have enough entropy and they cannot produce target file of the expected size using /dev/random, which results in test failures. Switching to /dev/urandom would give us way more available data at the cost of it being less "random", but we don't really need to use entropy for this task at all, since we only care if the file size after compression is big enough to not be stored inline in the revlog. So let's use something that we already have used to generate this kind of data in other tests.

File last commit:

r49730:6000f5b2 default
r52255:e7be2ddf stable
Show More
dumprevlog
59 lines | 1.3 KiB | text/plain | TextLexer
Gregory Szorc
global: use python3 in shebangs...
r46434 #!/usr/bin/env python3
Matt Mackall
add simple dump and undump scripts to contrib/
r6433 # Dump revlogs as raw data stream
# $ find .hg/store/ -name "*.i" | xargs dumprevlog > repo.dump
Pulkit Goyal
py3: make contrib/dumprevlog use absolute_import
r29165
Matt Mackall
add simple dump and undump scripts to contrib/
r6433 import sys
Joerg Sonnenberger
node: import symbols explicitly...
r46729 from mercurial.node import hex
Pulkit Goyal
py3: make contrib/dumprevlog use absolute_import
r29165 from mercurial import (
Matt Harbison
py3: byteify contrib/dumprevlog
r39983 encoding,
pycompat,
Pulkit Goyal
py3: make contrib/dumprevlog use absolute_import
r29165 revlog,
Yuya Nishihara
procutil: bulk-replace function calls to point to new module
r37138 )
Gregory Szorc
black: blacken scripts...
r44058 from mercurial.utils import procutil
Adrian Buehlmann
contrib: fix binary file issues with dumprevlog on Windows...
r6466
revlog: introduce an explicit tracking of what the revlog is about...
r47838 from mercurial.revlogutils import (
constants as revlog_constants,
)
Adrian Buehlmann
contrib: fix binary file issues with dumprevlog on Windows...
r6466 for fp in (sys.stdin, sys.stdout, sys.stderr):
Yuya Nishihara
procutil: bulk-replace function calls to point to new module
r37138 procutil.setbinary(fp)
Matt Mackall
add simple dump and undump scripts to contrib/
r6433
Gregory Szorc
black: blacken scripts...
r44058
Matt Harbison
py3: byteify contrib/dumprevlog
r39983 def binopen(path, mode=b'rb'):
if b'b' not in mode:
mode = mode + b'b'
return open(path, pycompat.sysstr(mode))
Gregory Szorc
black: blacken scripts...
r44058
vfs: give all vfs an options attribute by default...
r43295 binopen.options = {}
Matt Harbison
py3: byteify contrib/dumprevlog
r39983
Gregory Szorc
black: blacken scripts...
r44058
Matt Harbison
py3: byteify contrib/dumprevlog
r39983 def printb(data, end=b'\n'):
sys.stdout.flush()
Manuel Jacob
pycompat: change users of pycompat.{stdin,stdout,stderr} to use procutil.std*...
r45598 procutil.stdout.write(data + end)
Boris Feld
dumprevlog: handle being passed a mode parameter...
r35982
Gregory Szorc
black: blacken scripts...
r44058
Matt Mackall
add simple dump and undump scripts to contrib/
r6433 for f in sys.argv[1:]:
revlog: use a "radix" to address revlog...
r47921 localf = encoding.strtolocal(f)
if not localf.endswith(b'.i'):
print("file:", f, file=sys.stderr)
Raphaël Gomès
contrib: fix typo...
r47948 print(" invalid filename", file=sys.stderr)
revlog: use a "radix" to address revlog...
r47921
revlog: introduce an explicit tracking of what the revlog is about...
r47838 r = revlog.revlog(
binopen,
target=(revlog_constants.KIND_OTHER, b'dump-revlog'),
revlog: use a "radix" to address revlog...
r47921 radix=localf[:-2],
revlog: introduce an explicit tracking of what the revlog is about...
r47838 )
Pulkit Goyal
py3: make contrib/dumprevlog use print_function
r29166 print("file:", f)
Matt Mackall
add __len__ and __iter__ methods to repo and revlog
r6750 for i in r:
Matt Mackall
add simple dump and undump scripts to contrib/
r6433 n = r.node(i)
p = r.parents(n)
d = r.revision(n)
Joerg Sonnenberger
node: import symbols explicitly...
r46729 printb(b"node: %s" % hex(n))
Matt Harbison
py3: byteify contrib/dumprevlog
r39983 printb(b"linkrev: %d" % r.linkrev(i))
Joerg Sonnenberger
node: import symbols explicitly...
r46729 printb(b"parents: %s %s" % (hex(p[0]), hex(p[1])))
Matt Harbison
py3: byteify contrib/dumprevlog
r39983 printb(b"length: %d" % len(d))
printb(b"-start-")
printb(d)
printb(b"-end-")