Show More
@@ -42,6 +42,8 b' def gettype(q):' | |||
|
42 | 42 | def offset_type(offset, type): |
|
43 | 43 | return long(long(offset) << 16 | type) |
|
44 | 44 | |
|
45 | nullhash = _sha(nullid) | |
|
46 | ||
|
45 | 47 | def hash(text, p1, p2): |
|
46 | 48 | """generate a hash from the given text and its parent hashes |
|
47 | 49 | |
@@ -49,6 +51,13 b' def hash(text, p1, p2):' | |||
|
49 | 51 | in a manner that makes it easy to distinguish nodes with the same |
|
50 | 52 | content in the revision graph. |
|
51 | 53 | """ |
|
54 | # As of now, if one of the parent node is null, p2 is null | |
|
55 | if p2 == nullid: | |
|
56 | # deep copy of a hash is faster than creating one | |
|
57 | s = nullhash.copy() | |
|
58 | s.update(p1) | |
|
59 | else: | |
|
60 | # none of the parent nodes are nullid | |
|
52 | 61 | l = [p1, p2] |
|
53 | 62 | l.sort() |
|
54 | 63 | s = _sha(l[0]) |
General Comments 0
You need to be logged in to leave comments.
Login now