# HG changeset patch # User Gregory Szorc # Date 1535385324 25200 # Node ID 53363a8eff57db4e0039693119dde92f405aebe5 # Parent 57c3864f3aad83939c1d5cb339395bbaead1524e manifest: don't go through revlog to access node symbols The revlog module re-exports some node.* symbols courtesy of importing them. Let's access the node.* symbols via our local import. Differential Revision: https://phab.mercurial-scm.org/D4388 diff -r 57c3864f3aad -r 53363a8eff57 mercurial/manifest.py --- a/mercurial/manifest.py Wed Aug 15 16:50:44 2018 +0000 +++ b/mercurial/manifest.py Mon Aug 27 08:55:24 2018 -0700 @@ -16,6 +16,8 @@ from .node import ( bin, hex, + nullid, + nullrev, ) from . import ( error, @@ -55,12 +57,11 @@ def _text(it): files = [] lines = [] - _hex = revlog.hex for f, n, fl in it: files.append(f) # if this is changed to support newlines in filenames, # be sure to check the templates/ dir again (especially *-raw.tmpl) - lines.append("%s\0%s%s\n" % (f, _hex(n), fl)) + lines.append("%s\0%s%s\n" % (f, hex(n), fl)) _checkforbidden(files) return ''.join(lines) @@ -566,7 +567,7 @@ start, end = _msearch(addbuf, f, start) if not todelete: h, fl = self._lm[f] - l = "%s\0%s%s\n" % (f, revlog.hex(h), fl) + l = "%s\0%s%s\n" % (f, hex(h), fl) else: if start == end: # item we want to delete was not found, error out @@ -680,7 +681,7 @@ class treemanifest(object): def __init__(self, dir='', text=''): self._dir = dir - self._node = revlog.nullid + self._node = nullid self._loadfunc = _noop self._copyfunc = _noop self._dirty = False @@ -718,7 +719,7 @@ def __repr__(self): return ('' % - (self._dir, revlog.hex(self._node), + (self._dir, hex(self._node), bool(self._loadfunc is _noop), self._dirty, id(self))) @@ -1117,7 +1118,7 @@ for d, subm in self._dirs.iteritems(): subp1 = m1._dirs.get(d, emptytree)._node subp2 = m2._dirs.get(d, emptytree)._node - if subp1 == revlog.nullid: + if subp1 == nullid: subp1, subp2 = subp2, subp1 writesubtree(subm, subp1, subp2) @@ -1557,7 +1558,7 @@ else: m = manifestctx(self, node) - if node != revlog.nullid: + if node != nullid: mancache = self._dirmancache.get(tree) if not mancache: mancache = util.lrucachedict(self._cachesize) @@ -1637,7 +1638,7 @@ def read(self): if self._data is None: - if self._node == revlog.nullid: + if self._node == nullid: self._data = manifestdict() else: rl = self._revlog() @@ -1660,7 +1661,7 @@ rl = self._revlog() r = rl.rev(self._node) deltaparent = rl.deltaparent(r) - if deltaparent != revlog.nullrev and deltaparent in rl.parentrevs(r): + if deltaparent != nullrev and deltaparent in rl.parentrevs(r): return self.readdelta() return self.read() @@ -1732,7 +1733,7 @@ def read(self): if self._data is None: rl = self._revlog() - if self._node == revlog.nullid: + if self._node == nullid: self._data = treemanifest() elif rl._treeondisk: m = treemanifest(dir=self._dir) @@ -1811,7 +1812,7 @@ rl = self._revlog() r = rl.rev(self._node) deltaparent = rl.deltaparent(r) - if (deltaparent != revlog.nullrev and + if (deltaparent != nullrev and deltaparent in rl.parentrevs(r)): return self.readdelta(shallow=shallow)