Mercurial > hg
comparison contrib/undumprevlog @ 43659: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 | a063b84ce064 |
children | 4c1b4805db57 |
comparison
equal
deleted
inserted
replaced
43658:0796e266d26b | 43659:99e231afc29c |
---|---|
12 pycompat, | 12 pycompat, |
13 revlog, | 13 revlog, |
14 transaction, | 14 transaction, |
15 vfs as vfsmod, | 15 vfs as vfsmod, |
16 ) | 16 ) |
17 from mercurial.utils import ( | 17 from mercurial.utils import procutil |
18 procutil, | |
19 ) | |
20 | 18 |
21 for fp in (sys.stdin, sys.stdout, sys.stderr): | 19 for fp in (sys.stdin, sys.stdout, sys.stderr): |
22 procutil.setbinary(fp) | 20 procutil.setbinary(fp) |
23 | 21 |
24 opener = vfsmod.vfs(b'.', False) | 22 opener = vfsmod.vfs(b'.', False) |
25 tr = transaction.transaction(sys.stderr.write, opener, {b'store': opener}, | 23 tr = transaction.transaction( |
26 b"undump.journal") | 24 sys.stderr.write, opener, {b'store': opener}, b"undump.journal" |
25 ) | |
27 while True: | 26 while True: |
28 l = sys.stdin.readline() | 27 l = sys.stdin.readline() |
29 if not l: | 28 if not l: |
30 break | 29 break |
31 if l.startswith("file:"): | 30 if l.startswith("file:"): |
40 p = l[9:-1].split() | 39 p = l[9:-1].split() |
41 p1 = node.bin(p[0]) | 40 p1 = node.bin(p[0]) |
42 p2 = node.bin(p[1]) | 41 p2 = node.bin(p[1]) |
43 elif l.startswith("length:"): | 42 elif l.startswith("length:"): |
44 length = int(l[8:-1]) | 43 length = int(l[8:-1]) |
45 sys.stdin.readline() # start marker | 44 sys.stdin.readline() # start marker |
46 d = encoding.strtolocal(sys.stdin.read(length)) | 45 d = encoding.strtolocal(sys.stdin.read(length)) |
47 sys.stdin.readline() # end marker | 46 sys.stdin.readline() # end marker |
48 r.addrevision(d, tr, lr, p1, p2) | 47 r.addrevision(d, tr, lr, p1, p2) |
49 | 48 |
50 tr.close() | 49 tr.close() |