Show More
@@ -19,18 +19,3 b' def bin(node):' | |||
|
19 | 19 | |
|
20 | 20 | def short(node): |
|
21 | 21 | return hex(node[:6]) |
|
22 | ||
|
23 | def hash(text, p1, p2): | |
|
24 | """generate a hash from the given text and its parent hashes | |
|
25 | ||
|
26 | This hash combines both the current file contents and its history | |
|
27 | in a manner that makes it easy to distinguish nodes with the same | |
|
28 | content in the revision graph. | |
|
29 | """ | |
|
30 | l = [p1, p2] | |
|
31 | l.sort() | |
|
32 | s = sha.new(l[0]) | |
|
33 | s.update(l[1]) | |
|
34 | s.update(text) | |
|
35 | return s.digest() | |
|
36 |
@@ -14,6 +14,20 b' import zlib, struct, sha, binascii, heap' | |||
|
14 | 14 | from mercurial import mdiff |
|
15 | 15 | from node import * |
|
16 | 16 | |
|
17 | def hash(text, p1, p2): | |
|
18 | """generate a hash from the given text and its parent hashes | |
|
19 | ||
|
20 | This hash combines both the current file contents and its history | |
|
21 | in a manner that makes it easy to distinguish nodes with the same | |
|
22 | content in the revision graph. | |
|
23 | """ | |
|
24 | l = [p1, p2] | |
|
25 | l.sort() | |
|
26 | s = sha.new(l[0]) | |
|
27 | s.update(l[1]) | |
|
28 | s.update(text) | |
|
29 | return s.digest() | |
|
30 | ||
|
17 | 31 | def compress(text): |
|
18 | 32 | """ generate a possibly-compressed representation of text """ |
|
19 | 33 | if not text: return text |
General Comments 0
You need to be logged in to leave comments.
Login now