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