Mercurial > public > mercurial-scm > hg-stable
comparison mercurial/patch.py @ 47055:d55b71393907
node: replace nullid and friends with nodeconstants class
The introduction of 256bit hashes require changes to nullid and other
constant magic values. Start pushing them down from repository and
revlog where sensible.
Differential Revision: https://phab.mercurial-scm.org/D9465
author | Joerg Sonnenberger <joerg@bec.de> |
---|---|
date | Mon, 29 Mar 2021 01:52:06 +0200 |
parents | 5f86765c9707 |
children | e0d566f3ffce |
comparison
equal
deleted
inserted
replaced
46992:5fa019ceb499 | 47055:d55b71393907 |
---|---|
18 import zlib | 18 import zlib |
19 | 19 |
20 from .i18n import _ | 20 from .i18n import _ |
21 from .node import ( | 21 from .node import ( |
22 hex, | 22 hex, |
23 nullhex, | 23 sha1nodeconstants, |
24 short, | 24 short, |
25 ) | 25 ) |
26 from .pycompat import open | 26 from .pycompat import open |
27 from . import ( | 27 from . import ( |
28 copies, | 28 copies, |
3098 it and use the file content directly. | 3098 it and use the file content directly. |
3099 """ | 3099 """ |
3100 | 3100 |
3101 ctx1, fctx1, path1, flag1, content1, date1 = data1 | 3101 ctx1, fctx1, path1, flag1, content1, date1 = data1 |
3102 ctx2, fctx2, path2, flag2, content2, date2 = data2 | 3102 ctx2, fctx2, path2, flag2, content2, date2 = data2 |
3103 index1 = _gitindex(content1) if path1 in ctx1 else nullhex | 3103 index1 = _gitindex(content1) if path1 in ctx1 else sha1nodeconstants.nullhex |
3104 index2 = _gitindex(content2) if path2 in ctx2 else nullhex | 3104 index2 = _gitindex(content2) if path2 in ctx2 else sha1nodeconstants.nullhex |
3105 if binary and opts.git and not opts.nobinary: | 3105 if binary and opts.git and not opts.nobinary: |
3106 text = mdiff.b85diff(content1, content2) | 3106 text = mdiff.b85diff(content1, content2) |
3107 if text: | 3107 if text: |
3108 header.append(b'index %s..%s' % (index1, index2)) | 3108 header.append(b'index %s..%s' % (index1, index2)) |
3109 hunks = ((None, [text]),) | 3109 hunks = ((None, [text]),) |