contrib/dumprevlog
author Patrick Mezard <pmezard@gmail.com>
Fri, 02 Dec 2011 17:38:07 +0100
changeset 15605 2ad5b8937d0d
parent 14233 659f34b833b9
child 29165 a212ca70205c
permissions -rwxr-xr-x
convert/svn: update svn working copy only when necessary I have not tried to produce the bug but here is idea: f85c0034a062 stopped passing the modified files list to commit. This makes commit more fragile since we better not touch unrelated files by mistake. But putcommit() still applies file changes before exiting upon ignored revisions. So in theory, we could apply changes from a skipped branch then commit them as part of another revision. This patch makes the sink apply the changes after possibly skipping the revision. The real fix would be to use svn commit --targets option to pass the file names in an argument file. Unfortunately, it seems to be bugged in svn 1.7.1: http://svn.haxx.se/dev/archive-2011-11/0211.shtml

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

import sys
from mercurial import revlog, node, util

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

for f in sys.argv[1:]:
    binopen = lambda fn: open(fn, 'rb')
    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-"