Comments
Patch
new file mode 100644
@@ -0,0 +1,15 @@
+# nodemap.py - nodemap related code and utilities
+#
+# Copyright 2019 Pierre-Yves David <pierre-yves.david@octobus.net>
+# Copyright 2019 George Racinet <georges.racinet@octobus.net>
+#
+# This software may be used and distributed according to the terms of the
+# GNU General Public License version 2 or any later version.
+
+from __future__ import absolute_import
+from .. import error
+
+
+class NodeMap(dict):
+ def __missing__(self, x):
+ raise error.RevlogError(b'unknown node: %s' % x)
@@ -6,9 +6,3 @@
# GNU General Public License version 2 or any later version.
from __future__ import absolute_import
-from .. import error
-
-
-class NodeMap(dict):
- def __missing__(self, x):
- raise error.RevlogError(b'unknown node: %s' % x)
@@ -65,7 +65,6 @@
mdiff,
policy,
pycompat,
- revlogutils,
templatefilters,
util,
)
@@ -76,6 +75,7 @@
from .revlogutils import (
deltas as deltautil,
flagutil,
+ nodemap as nodemaputil,
sidedata as sidedatautil,
)
from .utils import (
@@ -223,7 +223,7 @@
@util.propertycache
def _nodemap(self):
- nodemap = revlogutils.NodeMap({nullid: nullrev})
+ nodemap = nodemaputil.NodeMap({nullid: nullrev})
for r in range(0, len(self)):
n = self[r][7]
nodemap[n] = r
@@ -272,7 +272,7 @@
def parseindex(self, data, inline):
s = self.size
index = []
- nodemap = revlogutils.NodeMap({nullid: nullrev})
+ nodemap = nodemaputil.NodeMap({nullid: nullrev})
n = off = 0
l = len(data)
while off + s <= l:
@@ -13,10 +13,11 @@
from ..node import nullid, nullrev
from .. import (
pycompat,
- revlogutils,
util,
)
+from ..revlogutils import nodemap as nodemaputil
+
stringio = pycompat.bytesio
@@ -55,7 +56,7 @@
@util.propertycache
def _nodemap(self):
- nodemap = revlogutils.NodeMap({nullid: nullrev})
+ nodemap = nodemaputil.NodeMap({nullid: nullrev})
for r in range(0, len(self)):
n = self[r][7]
nodemap[n] = r