comparison mercurial/node.py @ 39145:b623c7b23695

nodes: expand/comment the magic nodes so they are more easily searchable We just encountered `000000000000modified`, and it was quite annoying to search for these, even though I knew they existed. For those that don't know that they exist, this is essentially impossible to search for :) (Technically we encountered it in its hex form, 3030303030303030303030306d6f646966696564, so I'm adding comments with those forms in case that's helpful to people in the future). Differential Revision: https://phab.mercurial-scm.org/D4331
author Kyle Lippincott <spectral@google.com>
date Fri, 17 Aug 2018 15:32:38 -0700
parents d7114f883505
children 1e7a462cb946
comparison
equal deleted inserted replaced
39144:5f924aa0567c 39145:b623c7b23695
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 nullrev = -1 23 nullrev = -1
24 # In hex, this is '0000000000000000000000000000000000000000'
24 nullid = b"\0" * 20 25 nullid = b"\0" * 20
25 nullhex = hex(nullid) 26 nullhex = hex(nullid)
26 27
27 # Phony node value to stand-in for new files in some uses of 28 # Phony node value to stand-in for new files in some uses of
28 # manifests. 29 # manifests.
29 newnodeid = '!' * 20 30 # In hex, this is '2121212121212121212121212121212121212121'
30 addednodeid = ('0' * 15) + 'added' 31 newnodeid = '!!!!!!!!!!!!!!!!!!!!'
31 modifiednodeid = ('0' * 12) + 'modified' 32 # In hex, this is '0000000000000000000000000000006164646564'
33 addednodeid = '000000000000000added'
34 # In hex, this is '0000000000000000000000006d6f646966696564'
35 modifiednodeid = '000000000000modified'
32 36
33 wdirfilenodeids = {newnodeid, addednodeid, modifiednodeid} 37 wdirfilenodeids = {newnodeid, addednodeid, modifiednodeid}
34 38
35 # pseudo identifiers for working directory 39 # pseudo identifiers for working directory
36 # (they are experimental, so don't add too many dependencies on them) 40 # (they are experimental, so don't add too many dependencies on them)
37 wdirrev = 0x7fffffff 41 wdirrev = 0x7fffffff
42 # In hex, this is 'ffffffffffffffffffffffffffffffffffffffff'
38 wdirid = b"\xff" * 20 43 wdirid = b"\xff" * 20
39 wdirhex = hex(wdirid) 44 wdirhex = hex(wdirid)
40 45
41 def short(node): 46 def short(node):
42 return hex(node[:6]) 47 return hex(node[:6])