view contrib/dumprevlog @ 39926:c4a3d3c67c4f

logtoprocess: connect all fds to /dev/null to avoid bad interaction with pager We detected that pager is waiting for log-to-process script to finish, which is annoying when adding a script on commandfinish that does an HTTP push. There seems to be no workaround on the script side and it will make the behavior on Linux/MacOS closer to the Windows behavior. The drawback is that it makes the related tests more flaky as log-to-process outputs are now really asynchronous. If it's considered a BC change, another option would be to add a config option for this new behavior. I personally think that the different behavior between Windows and Linux is confusing and that it's a bug I would be fine with a new config option. Differential Revision: https://phab.mercurial-scm.org/D4816
author Boris Feld <boris.feld@octobus.net>
date Fri, 03 Nov 2017 21:11:07 +0100
parents a8a902d7176e
children a063b84ce064
line wrap: on
line source

#!/usr/bin/env python
# Dump revlogs as raw data stream
# $ find .hg/store/ -name "*.i" | xargs dumprevlog > repo.dump

from __future__ import absolute_import, print_function

import sys
from mercurial import (
    node,
    revlog,
)
from mercurial.utils import (
    procutil,
)

for fp in (sys.stdin, sys.stdout, sys.stderr):
    procutil.setbinary(fp)

def binopen(path, mode='rb'):
    if 'b' not in mode:
        mode = mode + 'b'
    return open(path, mode)

for f in sys.argv[1:]:
    r = revlog.revlog(binopen, f)
    print("file:", f)
    for i in r:
        n = r.node(i)
        p = r.parents(n)
        d = r.revision(n)
        print("node:", node.hex(n))
        print("linkrev:", r.linkrev(i))
        print("parents:", node.hex(p[0]), node.hex(p[1]))
        print("length:", len(d))
        print("-start-")
        print(d)
        print("-end-")