Mercurial > public > mercurial-scm > hg-stable
comparison mercurial/node.py @ 36275:f574cc00831a
node: make bin() be a wrapper instead of just an alias
This includes a full backout of 59affe7e and 30d0cb27. Per the review
of the former, we'd rather adapt the API to behave like it used to (at
least for now), and take a second run at it if it shows up in our
performance numbers. I ran perfrevlogindex with and without this
change and it didn't make a measurable difference, so maybe it's fine
(despite my intuition to the contrary).
Differential Revision: https://phab.mercurial-scm.org/D2279
author | Augie Fackler <augie@google.com> |
---|---|
date | Wed, 14 Feb 2018 21:34:12 -0500 |
parents | af854b1b36f8 |
children | d7114f883505 |
comparison
equal
deleted
inserted
replaced
36274:b39f0fdb0338 | 36275:f574cc00831a |
---|---|
9 | 9 |
10 import binascii | 10 import binascii |
11 | 11 |
12 # This ugly style has a noticeable effect in manifest parsing | 12 # This ugly style has a noticeable effect in manifest parsing |
13 hex = binascii.hexlify | 13 hex = binascii.hexlify |
14 bin = binascii.unhexlify | 14 # Adapt to Python 3 API changes. If this ends up showing up in |
15 # profiles, we can use this version only on Python 3, and forward | |
16 # binascii.unhexlify like we used to on Python 2. | |
17 def bin(s): | |
18 try: | |
19 return binascii.unhexlify(s) | |
20 except binascii.Error as e: | |
21 raise TypeError(e) | |
15 | 22 |
16 nullrev = -1 | 23 nullrev = -1 |
17 nullid = b"\0" * 20 | 24 nullid = b"\0" * 20 |
18 nullhex = hex(nullid) | 25 nullhex = hex(nullid) |
19 | 26 |