comparison mercurial/node.py @ 28585:a3f3fdac8433

node: use byte literals to construct nullid and wdirid Python 3's hex() insists on operating on bytes. This patch gives it what it wants. '' and b'' in Python 2 are equivalent, so this has no impact on Python 2.
author Gregory Szorc <gregory.szorc@gmail.com>
date Sat, 12 Mar 2016 14:04:57 -0800
parents 18f50b8cbf1e
children 0298a07f64d9
comparison
equal deleted inserted replaced
28584:d69172ddfdca 28585:a3f3fdac8433
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 bin = binascii.unhexlify
15 15
16 nullrev = -1 16 nullrev = -1
17 nullid = "\0" * 20 17 nullid = b"\0" * 20
18 nullhex = hex(nullid) 18 nullhex = hex(nullid)
19 19
20 # pseudo identifiers for working directory 20 # pseudo identifiers for working directory
21 # (they are experimental, so don't add too many dependencies on them) 21 # (they are experimental, so don't add too many dependencies on them)
22 wdirrev = 0x7fffffff 22 wdirrev = 0x7fffffff
23 wdirid = "\xff" * 20 23 wdirid = b"\xff" * 20
24 24
25 def short(node): 25 def short(node):
26 return hex(node[:6]) 26 return hex(node[:6])