##// END OF EJS Templates
revlogutils: move the NodeMap class in a dedicated nodemap module...
marmoute -
r44486:ab595920 default
parent child Browse files
Show More
@@ -0,0 +1,15 b''
1 # nodemap.py - nodemap related code and utilities
2 #
3 # Copyright 2019 Pierre-Yves David <pierre-yves.david@octobus.net>
4 # Copyright 2019 George Racinet <georges.racinet@octobus.net>
5 #
6 # This software may be used and distributed according to the terms of the
7 # GNU General Public License version 2 or any later version.
8
9 from __future__ import absolute_import
10 from .. import error
11
12
13 class NodeMap(dict):
14 def __missing__(self, x):
15 raise error.RevlogError(b'unknown node: %s' % x)
@@ -13,10 +13,11 b' import zlib'
13 13 from ..node import nullid, nullrev
14 14 from .. import (
15 15 pycompat,
16 revlogutils,
17 16 util,
18 17 )
19 18
19 from ..revlogutils import nodemap as nodemaputil
20
20 21 stringio = pycompat.bytesio
21 22
22 23
@@ -55,7 +56,7 b' class BaseIndexObject(object):'
55 56
56 57 @util.propertycache
57 58 def _nodemap(self):
58 nodemap = revlogutils.NodeMap({nullid: nullrev})
59 nodemap = nodemaputil.NodeMap({nullid: nullrev})
59 60 for r in range(0, len(self)):
60 61 n = self[r][7]
61 62 nodemap[n] = r
@@ -65,7 +65,6 b' from . import ('
65 65 mdiff,
66 66 policy,
67 67 pycompat,
68 revlogutils,
69 68 templatefilters,
70 69 util,
71 70 )
@@ -76,6 +75,7 b' from .interfaces import ('
76 75 from .revlogutils import (
77 76 deltas as deltautil,
78 77 flagutil,
78 nodemap as nodemaputil,
79 79 sidedata as sidedatautil,
80 80 )
81 81 from .utils import (
@@ -224,7 +224,7 b' class revlogoldindex(list):'
224 224
225 225 @util.propertycache
226 226 def _nodemap(self):
227 nodemap = revlogutils.NodeMap({nullid: nullrev})
227 nodemap = nodemaputil.NodeMap({nullid: nullrev})
228 228 for r in range(0, len(self)):
229 229 n = self[r][7]
230 230 nodemap[n] = r
@@ -273,7 +273,7 b' class revlogoldio(object):'
273 273 def parseindex(self, data, inline):
274 274 s = self.size
275 275 index = []
276 nodemap = revlogutils.NodeMap({nullid: nullrev})
276 nodemap = nodemaputil.NodeMap({nullid: nullrev})
277 277 n = off = 0
278 278 l = len(data)
279 279 while off + s <= l:
@@ -6,9 +6,3 b''
6 6 # GNU General Public License version 2 or any later version.
7 7
8 8 from __future__ import absolute_import
9 from .. import error
10
11
12 class NodeMap(dict):
13 def __missing__(self, x):
14 raise error.RevlogError(b'unknown node: %s' % x)
General Comments 0
You need to be logged in to leave comments. Login now