mercurial/node.py
changeset 36238 f574cc00831a
parent 32684 af854b1b36f8
child 37448 d7114f883505
equal deleted inserted replaced
36237:b39f0fdb0338 36238: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