Mercurial > hg
comparison contrib/undumprevlog @ 46113:59fa3890d40a
node: import symbols explicitly
There is no point in lazy importing mercurial.node, it is used all over
the place anyway. So consistently import the used symbols directly.
Fix one file using symbols indirectly via mercurial.revlog.
Differential Revision: https://phab.mercurial-scm.org/D9480
author | Joerg Sonnenberger <joerg@bec.de> |
---|---|
date | Tue, 01 Dec 2020 21:54:46 +0100 |
parents | c102b704edb5 |
children | 4c041c71ec01 |
comparison
equal
deleted
inserted
replaced
46112:d6afa9c149c3 | 46113:59fa3890d40a |
---|---|
4 # $ undumprevlog < repo.dump | 4 # $ undumprevlog < repo.dump |
5 | 5 |
6 from __future__ import absolute_import, print_function | 6 from __future__ import absolute_import, print_function |
7 | 7 |
8 import sys | 8 import sys |
9 from mercurial.node import bin | |
9 from mercurial import ( | 10 from mercurial import ( |
10 encoding, | 11 encoding, |
11 node, | |
12 revlog, | 12 revlog, |
13 transaction, | 13 transaction, |
14 vfs as vfsmod, | 14 vfs as vfsmod, |
15 ) | 15 ) |
16 from mercurial.utils import procutil | 16 from mercurial.utils import procutil |
29 if l.startswith("file:"): | 29 if l.startswith("file:"): |
30 f = encoding.strtolocal(l[6:-1]) | 30 f = encoding.strtolocal(l[6:-1]) |
31 r = revlog.revlog(opener, f) | 31 r = revlog.revlog(opener, f) |
32 procutil.stdout.write(b'%s\n' % f) | 32 procutil.stdout.write(b'%s\n' % f) |
33 elif l.startswith("node:"): | 33 elif l.startswith("node:"): |
34 n = node.bin(l[6:-1]) | 34 n = bin(l[6:-1]) |
35 elif l.startswith("linkrev:"): | 35 elif l.startswith("linkrev:"): |
36 lr = int(l[9:-1]) | 36 lr = int(l[9:-1]) |
37 elif l.startswith("parents:"): | 37 elif l.startswith("parents:"): |
38 p = l[9:-1].split() | 38 p = l[9:-1].split() |
39 p1 = node.bin(p[0]) | 39 p1 = bin(p[0]) |
40 p2 = node.bin(p[1]) | 40 p2 = bin(p[1]) |
41 elif l.startswith("length:"): | 41 elif l.startswith("length:"): |
42 length = int(l[8:-1]) | 42 length = int(l[8:-1]) |
43 sys.stdin.readline() # start marker | 43 sys.stdin.readline() # start marker |
44 d = encoding.strtolocal(sys.stdin.read(length)) | 44 d = encoding.strtolocal(sys.stdin.read(length)) |
45 sys.stdin.readline() # end marker | 45 sys.stdin.readline() # end marker |