comparison mercurial/revlog.py @ 22784:0f4e655136ef

revlog: mark nullhash as module-private No other module should ever need this, so mark it with _ so nobody tries to use it.
author Augie Fackler <raf@durin42.com>
date Wed, 24 Sep 2014 15:10:52 -0400
parents 94f77624dbb5
children abc44fcc9c57
comparison
equal deleted inserted replaced
22783:524b786bd54f 22784:0f4e655136ef
50 return int(q & 0xFFFF) 50 return int(q & 0xFFFF)
51 51
52 def offset_type(offset, type): 52 def offset_type(offset, type):
53 return long(long(offset) << 16 | type) 53 return long(long(offset) << 16 | type)
54 54
55 nullhash = _sha(nullid) 55 _nullhash = _sha(nullid)
56 56
57 def hash(text, p1, p2): 57 def hash(text, p1, p2):
58 """generate a hash from the given text and its parent hashes 58 """generate a hash from the given text and its parent hashes
59 59
60 This hash combines both the current file contents and its history 60 This hash combines both the current file contents and its history
62 content in the revision graph. 62 content in the revision graph.
63 """ 63 """
64 # As of now, if one of the parent node is null, p2 is null 64 # As of now, if one of the parent node is null, p2 is null
65 if p2 == nullid: 65 if p2 == nullid:
66 # deep copy of a hash is faster than creating one 66 # deep copy of a hash is faster than creating one
67 s = nullhash.copy() 67 s = _nullhash.copy()
68 s.update(p1) 68 s.update(p1)
69 else: 69 else:
70 # none of the parent nodes are nullid 70 # none of the parent nodes are nullid
71 l = [p1, p2] 71 l = [p1, p2]
72 l.sort() 72 l.sort()