##// END OF EJS Templates
nodes: expand/comment the magic nodes so they are more easily searchable...
Kyle Lippincott -
r39178:b623c7b2 default
parent child Browse files
Show More
@@ -1,42 +1,47 b''
1 1 # node.py - basic nodeid manipulation for mercurial
2 2 #
3 3 # Copyright 2005, 2006 Matt Mackall <mpm@selenic.com>
4 4 #
5 5 # This software may be used and distributed according to the terms of the
6 6 # GNU General Public License version 2 or any later version.
7 7
8 8 from __future__ import absolute_import
9 9
10 10 import binascii
11 11
12 12 # This ugly style has a noticeable effect in manifest parsing
13 13 hex = binascii.hexlify
14 14 # Adapt to Python 3 API changes. If this ends up showing up in
15 15 # profiles, we can use this version only on Python 3, and forward
16 16 # binascii.unhexlify like we used to on Python 2.
17 17 def bin(s):
18 18 try:
19 19 return binascii.unhexlify(s)
20 20 except binascii.Error as e:
21 21 raise TypeError(e)
22 22
23 23 nullrev = -1
24 # In hex, this is '0000000000000000000000000000000000000000'
24 25 nullid = b"\0" * 20
25 26 nullhex = hex(nullid)
26 27
27 28 # Phony node value to stand-in for new files in some uses of
28 29 # manifests.
29 newnodeid = '!' * 20
30 addednodeid = ('0' * 15) + 'added'
31 modifiednodeid = ('0' * 12) + 'modified'
30 # In hex, this is '2121212121212121212121212121212121212121'
31 newnodeid = '!!!!!!!!!!!!!!!!!!!!'
32 # In hex, this is '0000000000000000000000000000006164646564'
33 addednodeid = '000000000000000added'
34 # In hex, this is '0000000000000000000000006d6f646966696564'
35 modifiednodeid = '000000000000modified'
32 36
33 37 wdirfilenodeids = {newnodeid, addednodeid, modifiednodeid}
34 38
35 39 # pseudo identifiers for working directory
36 40 # (they are experimental, so don't add too many dependencies on them)
37 41 wdirrev = 0x7fffffff
42 # In hex, this is 'ffffffffffffffffffffffffffffffffffffffff'
38 43 wdirid = b"\xff" * 20
39 44 wdirhex = hex(wdirid)
40 45
41 46 def short(node):
42 47 return hex(node[:6])
General Comments 0
You need to be logged in to leave comments. Login now