Mercurial > public > mercurial-scm > hg-stable
comparison mercurial/node.py @ 43075:57875cf423c9
style: run a patched black on a subset of mercurial
This applied black to the 20 smallest files in mercurial/:
ls -S1 mercurial/*.py | tail -n20 | xargs black --skip-string-normalization
Note that a few files failed to format, presumably due to a bug in my
patch. The intent is to be able to compare results to D5064 with
https://github.com/python/black/pull/826 applied to black.
I skipped string normalization on this patch for clarity - in reality
I think we'd want one pass without string normalization, followed by
another to normalize strings (which is basically replacing ' with "
globally.)
# skip-blame mass-reformatting only
Differential Revision: https://phab.mercurial-scm.org/D6342
author | Augie Fackler <augie@google.com> |
---|---|
date | Sat, 05 Oct 2019 10:29:34 -0400 |
parents | 1e7a462cb946 |
children | 687b865b95ad |
comparison
equal
deleted
inserted
replaced
43074:9cc55b743713 | 43075:57875cf423c9 |
---|---|
18 try: | 18 try: |
19 return binascii.unhexlify(s) | 19 return binascii.unhexlify(s) |
20 except binascii.Error as e: | 20 except binascii.Error as e: |
21 raise TypeError(e) | 21 raise TypeError(e) |
22 | 22 |
23 | |
23 nullrev = -1 | 24 nullrev = -1 |
24 # In hex, this is '0000000000000000000000000000000000000000' | 25 # In hex, this is '0000000000000000000000000000000000000000' |
25 nullid = b"\0" * 20 | 26 nullid = b"\0" * 20 |
26 nullhex = hex(nullid) | 27 nullhex = hex(nullid) |
27 | 28 |
36 | 37 |
37 wdirfilenodeids = {newnodeid, addednodeid, modifiednodeid} | 38 wdirfilenodeids = {newnodeid, addednodeid, modifiednodeid} |
38 | 39 |
39 # pseudo identifiers for working directory | 40 # pseudo identifiers for working directory |
40 # (they are experimental, so don't add too many dependencies on them) | 41 # (they are experimental, so don't add too many dependencies on them) |
41 wdirrev = 0x7fffffff | 42 wdirrev = 0x7FFFFFFF |
42 # In hex, this is 'ffffffffffffffffffffffffffffffffffffffff' | 43 # In hex, this is 'ffffffffffffffffffffffffffffffffffffffff' |
43 wdirid = b"\xff" * 20 | 44 wdirid = b"\xff" * 20 |
44 wdirhex = hex(wdirid) | 45 wdirhex = hex(wdirid) |
45 | 46 |
47 | |
46 def short(node): | 48 def short(node): |
47 return hex(node[:6]) | 49 return hex(node[:6]) |