Show More
@@ -1,31 +1,35 b'' | |||
|
1 | 1 | #!/usr/bin/env python |
|
2 | 2 | # Dump revlogs as raw data stream |
|
3 | 3 | # $ find .hg/store/ -name "*.i" | xargs dumprevlog > repo.dump |
|
4 | 4 | |
|
5 | 5 | from __future__ import absolute_import, print_function |
|
6 | 6 | |
|
7 | 7 | import sys |
|
8 | 8 | from mercurial import ( |
|
9 | 9 | node, |
|
10 | 10 | revlog, |
|
11 | 11 | util, |
|
12 | 12 | ) |
|
13 | 13 | |
|
14 | 14 | for fp in (sys.stdin, sys.stdout, sys.stderr): |
|
15 | 15 | util.setbinary(fp) |
|
16 | 16 | |
|
17 | def binopen(path, mode='rb'): | |
|
18 | if 'b' not in mode: | |
|
19 | mode = mode + 'b' | |
|
20 | return open(path, mode) | |
|
21 | ||
|
17 | 22 | for f in sys.argv[1:]: |
|
18 | binopen = lambda fn: open(fn, 'rb') | |
|
19 | 23 | r = revlog.revlog(binopen, f) |
|
20 | 24 | print("file:", f) |
|
21 | 25 | for i in r: |
|
22 | 26 | n = r.node(i) |
|
23 | 27 | p = r.parents(n) |
|
24 | 28 | d = r.revision(n) |
|
25 | 29 | print("node:", node.hex(n)) |
|
26 | 30 | print("linkrev:", r.linkrev(i)) |
|
27 | 31 | print("parents:", node.hex(p[0]), node.hex(p[1])) |
|
28 | 32 | print("length:", len(d)) |
|
29 | 33 | print("-start-") |
|
30 | 34 | print(d) |
|
31 | 35 | print("-end-") |
General Comments 0
You need to be logged in to leave comments.
Login now