comparison contrib/dumprevlog @ 43703:99e231afc29c

black: blacken scripts test-check-format.t doesn't appear to detect Python scripts with shebangs. But my editor which is configured to auto run black on Python files does and it appears some files are not blackened. This commit blackens scripts that need it. # skip-blame reformatting Differential Revision: https://phab.mercurial-scm.org/D7420
author Gregory Szorc <gregory.szorc@gmail.com>
date Thu, 14 Nov 2019 20:35:11 -0800
parents 3518da504303
children 4c1b4805db57
comparison
equal deleted inserted replaced
43702:0796e266d26b 43703:99e231afc29c
9 encoding, 9 encoding,
10 node, 10 node,
11 pycompat, 11 pycompat,
12 revlog, 12 revlog,
13 ) 13 )
14 from mercurial.utils import ( 14 from mercurial.utils import procutil
15 procutil,
16 )
17 15
18 for fp in (sys.stdin, sys.stdout, sys.stderr): 16 for fp in (sys.stdin, sys.stdout, sys.stderr):
19 procutil.setbinary(fp) 17 procutil.setbinary(fp)
18
20 19
21 def binopen(path, mode=b'rb'): 20 def binopen(path, mode=b'rb'):
22 if b'b' not in mode: 21 if b'b' not in mode:
23 mode = mode + b'b' 22 mode = mode + b'b'
24 return open(path, pycompat.sysstr(mode)) 23 return open(path, pycompat.sysstr(mode))
24
25
25 binopen.options = {} 26 binopen.options = {}
27
26 28
27 def printb(data, end=b'\n'): 29 def printb(data, end=b'\n'):
28 sys.stdout.flush() 30 sys.stdout.flush()
29 pycompat.stdout.write(data + end) 31 pycompat.stdout.write(data + end)
32
30 33
31 for f in sys.argv[1:]: 34 for f in sys.argv[1:]:
32 r = revlog.revlog(binopen, encoding.strtolocal(f)) 35 r = revlog.revlog(binopen, encoding.strtolocal(f))
33 print("file:", f) 36 print("file:", f)
34 for i in r: 37 for i in r: