Show More
@@ -1,46 +1,46 b'' | |||
|
1 | 1 | #!/usr/bin/env python |
|
2 | 2 | # Undump a dump from dumprevlog |
|
3 | 3 | # $ hg init |
|
4 | 4 | # $ undumprevlog < repo.dump |
|
5 | 5 | |
|
6 | from __future__ import absolute_import | |
|
6 | from __future__ import absolute_import, print_function | |
|
7 | 7 | |
|
8 | 8 | import sys |
|
9 | 9 | from mercurial import ( |
|
10 | 10 | node, |
|
11 | 11 | revlog, |
|
12 | 12 | transaction, |
|
13 | 13 | util, |
|
14 | 14 | vfs as vfsmod, |
|
15 | 15 | ) |
|
16 | 16 | |
|
17 | 17 | for fp in (sys.stdin, sys.stdout, sys.stderr): |
|
18 | 18 | util.setbinary(fp) |
|
19 | 19 | |
|
20 | 20 | opener = vfsmod.vfs('.', False) |
|
21 | 21 | tr = transaction.transaction(sys.stderr.write, opener, {'store': opener}, |
|
22 | 22 | "undump.journal") |
|
23 | 23 | while True: |
|
24 | 24 | l = sys.stdin.readline() |
|
25 | 25 | if not l: |
|
26 | 26 | break |
|
27 | 27 | if l.startswith("file:"): |
|
28 | 28 | f = l[6:-1] |
|
29 | 29 | r = revlog.revlog(opener, f) |
|
30 |
print |
|
|
30 | print(f) | |
|
31 | 31 | elif l.startswith("node:"): |
|
32 | 32 | n = node.bin(l[6:-1]) |
|
33 | 33 | elif l.startswith("linkrev:"): |
|
34 | 34 | lr = int(l[9:-1]) |
|
35 | 35 | elif l.startswith("parents:"): |
|
36 | 36 | p = l[9:-1].split() |
|
37 | 37 | p1 = node.bin(p[0]) |
|
38 | 38 | p2 = node.bin(p[1]) |
|
39 | 39 | elif l.startswith("length:"): |
|
40 | 40 | length = int(l[8:-1]) |
|
41 | 41 | sys.stdin.readline() # start marker |
|
42 | 42 | d = sys.stdin.read(length) |
|
43 | 43 | sys.stdin.readline() # end marker |
|
44 | 44 | r.addrevision(d, tr, lr, p1, p2) |
|
45 | 45 | |
|
46 | 46 | tr.close() |
General Comments 0
You need to be logged in to leave comments.
Login now