Mercurial > hg
comparison hgext/journal.py @ 47012: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 | 59fa3890d40a |
children | 6000f5b25c9b |
comparison
equal
deleted
inserted
replaced
46992:5fa019ceb499 | 47012:d55b71393907 |
---|---|
20 | 20 |
21 from mercurial.i18n import _ | 21 from mercurial.i18n import _ |
22 from mercurial.node import ( | 22 from mercurial.node import ( |
23 bin, | 23 bin, |
24 hex, | 24 hex, |
25 nullid, | |
26 ) | 25 ) |
27 | 26 |
28 from mercurial import ( | 27 from mercurial import ( |
29 bookmarks, | 28 bookmarks, |
30 cmdutil, | 29 cmdutil, |
115 """Records all dirstate parent changes in the journal.""" | 114 """Records all dirstate parent changes in the journal.""" |
116 old = list(old) | 115 old = list(old) |
117 new = list(new) | 116 new = list(new) |
118 if util.safehasattr(dirstate, 'journalstorage'): | 117 if util.safehasattr(dirstate, 'journalstorage'): |
119 # only record two hashes if there was a merge | 118 # only record two hashes if there was a merge |
120 oldhashes = old[:1] if old[1] == nullid else old | 119 oldhashes = old[:1] if old[1] == dirstate._nodeconstants.nullid else old |
121 newhashes = new[:1] if new[1] == nullid else new | 120 newhashes = new[:1] if new[1] == dirstate._nodeconstants.nullid else new |
122 dirstate.journalstorage.record( | 121 dirstate.journalstorage.record( |
123 wdirparenttype, b'.', oldhashes, newhashes | 122 wdirparenttype, b'.', oldhashes, newhashes |
124 ) | 123 ) |
125 | 124 |
126 | 125 |
129 """Records all bookmark changes in the journal.""" | 128 """Records all bookmark changes in the journal.""" |
130 repo = store._repo | 129 repo = store._repo |
131 if util.safehasattr(repo, 'journal'): | 130 if util.safehasattr(repo, 'journal'): |
132 oldmarks = bookmarks.bmstore(repo) | 131 oldmarks = bookmarks.bmstore(repo) |
133 for mark, value in pycompat.iteritems(store): | 132 for mark, value in pycompat.iteritems(store): |
134 oldvalue = oldmarks.get(mark, nullid) | 133 oldvalue = oldmarks.get(mark, repo.nullid) |
135 if value != oldvalue: | 134 if value != oldvalue: |
136 repo.journal.record(bookmarktype, mark, oldvalue, value) | 135 repo.journal.record(bookmarktype, mark, oldvalue, value) |
137 return orig(store, fp) | 136 return orig(store, fp) |
138 | 137 |
139 | 138 |