equal
deleted
inserted
replaced
5 # This software may be used and distributed according to the terms of the |
5 # This software may be used and distributed according to the terms of the |
6 # GNU General Public License version 2 or any later version. |
6 # GNU General Public License version 2 or any later version. |
7 |
7 |
8 from __future__ import absolute_import |
8 from __future__ import absolute_import |
9 |
9 |
10 import hashlib |
|
11 import re |
10 import re |
12 import struct |
11 import struct |
13 |
12 |
14 from ..i18n import _ |
13 from ..i18n import _ |
15 from ..node import ( |
14 from ..node import ( |
22 error, |
21 error, |
23 mdiff, |
22 mdiff, |
24 pycompat, |
23 pycompat, |
25 ) |
24 ) |
26 from ..interfaces import repository |
25 from ..interfaces import repository |
27 |
26 from ..utils import hashutil |
28 _nullhash = hashlib.sha1(nullid) |
27 |
|
28 _nullhash = hashutil.sha1(nullid) |
29 |
29 |
30 |
30 |
31 def hashrevisionsha1(text, p1, p2): |
31 def hashrevisionsha1(text, p1, p2): |
32 """Compute the SHA-1 for revision data and its parents. |
32 """Compute the SHA-1 for revision data and its parents. |
33 |
33 |
46 a = p1 |
46 a = p1 |
47 b = p2 |
47 b = p2 |
48 else: |
48 else: |
49 a = p2 |
49 a = p2 |
50 b = p1 |
50 b = p1 |
51 s = hashlib.sha1(a) |
51 s = hashutil.sha1(a) |
52 s.update(b) |
52 s.update(b) |
53 s.update(text) |
53 s.update(text) |
54 return s.digest() |
54 return s.digest() |
55 |
55 |
56 |
56 |