Show More
@@ -6,7 +6,9 b' from __future__ import absolute_import, ' | |||
|
6 | 6 | |
|
7 | 7 | import sys |
|
8 | 8 | from mercurial import ( |
|
9 | encoding, | |
|
9 | 10 | node, |
|
11 | pycompat, | |
|
10 | 12 | revlog, |
|
11 | 13 | ) |
|
12 | 14 | from mercurial.utils import ( |
@@ -16,22 +18,26 b' from mercurial.utils import (' | |||
|
16 | 18 | for fp in (sys.stdin, sys.stdout, sys.stderr): |
|
17 | 19 | procutil.setbinary(fp) |
|
18 | 20 | |
|
19 | def binopen(path, mode='rb'): | |
|
20 | if 'b' not in mode: | |
|
21 | mode = mode + 'b' | |
|
22 | return open(path, mode) | |
|
21 | def binopen(path, mode=b'rb'): | |
|
22 | if b'b' not in mode: | |
|
23 | mode = mode + b'b' | |
|
24 | return open(path, pycompat.sysstr(mode)) | |
|
25 | ||
|
26 | def printb(data, end=b'\n'): | |
|
27 | sys.stdout.flush() | |
|
28 | pycompat.stdout.write(data + end) | |
|
23 | 29 | |
|
24 | 30 | for f in sys.argv[1:]: |
|
25 | r = revlog.revlog(binopen, f) | |
|
31 | r = revlog.revlog(binopen, encoding.strtolocal(f)) | |
|
26 | 32 | print("file:", f) |
|
27 | 33 | for i in r: |
|
28 | 34 | n = r.node(i) |
|
29 | 35 | p = r.parents(n) |
|
30 | 36 | d = r.revision(n) |
|
31 |
print("node: |
|
|
32 |
print("linkrev: |
|
|
33 |
print("parents:" |
|
|
34 |
print("length: |
|
|
35 | print("-start-") | |
|
36 | print(d) | |
|
37 | print("-end-") | |
|
37 | printb(b"node: %s" % node.hex(n)) | |
|
38 | printb(b"linkrev: %d" % r.linkrev(i)) | |
|
39 | printb(b"parents: %s %s" % (node.hex(p[0]), node.hex(p[1]))) | |
|
40 | printb(b"length: %d" % len(d)) | |
|
41 | printb(b"-start-") | |
|
42 | printb(d) | |
|
43 | printb(b"-end-") |
@@ -92,6 +92,7 b' test-convert-cvs-synthetic.t' | |||
|
92 | 92 | test-convert-cvs.t |
|
93 | 93 | test-convert-cvsnt-mergepoints.t |
|
94 | 94 | test-convert-datesort.t |
|
95 | test-contrib-dumprevlog.t | |
|
95 | 96 | test-convert-filemap.t |
|
96 | 97 | test-convert-hg-sink.t |
|
97 | 98 | test-convert-hg-source.t |
@@ -7,7 +7,9 b' from __future__ import absolute_import, ' | |||
|
7 | 7 | |
|
8 | 8 | import sys |
|
9 | 9 | from mercurial import ( |
|
10 | encoding, | |
|
10 | 11 | node, |
|
12 | pycompat, | |
|
11 | 13 | revlog, |
|
12 | 14 | transaction, |
|
13 | 15 | vfs as vfsmod, |
@@ -19,17 +21,17 b' from mercurial.utils import (' | |||
|
19 | 21 | for fp in (sys.stdin, sys.stdout, sys.stderr): |
|
20 | 22 | procutil.setbinary(fp) |
|
21 | 23 | |
|
22 | opener = vfsmod.vfs('.', False) | |
|
23 | tr = transaction.transaction(sys.stderr.write, opener, {'store': opener}, | |
|
24 | "undump.journal") | |
|
24 | opener = vfsmod.vfs(b'.', False) | |
|
25 | tr = transaction.transaction(sys.stderr.write, opener, {b'store': opener}, | |
|
26 | b"undump.journal") | |
|
25 | 27 | while True: |
|
26 | 28 | l = sys.stdin.readline() |
|
27 | 29 | if not l: |
|
28 | 30 | break |
|
29 | 31 | if l.startswith("file:"): |
|
30 | f = l[6:-1] | |
|
32 | f = encoding.strtolocal(l[6:-1]) | |
|
31 | 33 | r = revlog.revlog(opener, f) |
|
32 | print(f) | |
|
34 | pycompat.stdout.write(b'%s\n' % f) | |
|
33 | 35 | elif l.startswith("node:"): |
|
34 | 36 | n = node.bin(l[6:-1]) |
|
35 | 37 | elif l.startswith("linkrev:"): |
@@ -41,7 +43,7 b' while True:' | |||
|
41 | 43 | elif l.startswith("length:"): |
|
42 | 44 | length = int(l[8:-1]) |
|
43 | 45 | sys.stdin.readline() # start marker |
|
44 | d = sys.stdin.read(length) | |
|
46 | d = encoding.strtolocal(sys.stdin.read(length)) | |
|
45 | 47 | sys.stdin.readline() # end marker |
|
46 | 48 | r.addrevision(d, tr, lr, p1, p2) |
|
47 | 49 |
General Comments 0
You need to be logged in to leave comments.
Login now