##// END OF EJS Templates
manifest: don't go through revlog to access node symbols...
Gregory Szorc -
r39352:53363a8e default
parent child Browse files
Show More
@@ -16,6 +16,8 from .i18n import _
16 from .node import (
16 from .node import (
17 bin,
17 bin,
18 hex,
18 hex,
19 nullid,
20 nullrev,
19 )
21 )
20 from . import (
22 from . import (
21 error,
23 error,
@@ -55,12 +57,11 def _parse(data):
55 def _text(it):
57 def _text(it):
56 files = []
58 files = []
57 lines = []
59 lines = []
58 _hex = revlog.hex
59 for f, n, fl in it:
60 for f, n, fl in it:
60 files.append(f)
61 files.append(f)
61 # if this is changed to support newlines in filenames,
62 # if this is changed to support newlines in filenames,
62 # be sure to check the templates/ dir again (especially *-raw.tmpl)
63 # be sure to check the templates/ dir again (especially *-raw.tmpl)
63 lines.append("%s\0%s%s\n" % (f, _hex(n), fl))
64 lines.append("%s\0%s%s\n" % (f, hex(n), fl))
64
65
65 _checkforbidden(files)
66 _checkforbidden(files)
66 return ''.join(lines)
67 return ''.join(lines)
@@ -566,7 +567,7 class manifestdict(object):
566 start, end = _msearch(addbuf, f, start)
567 start, end = _msearch(addbuf, f, start)
567 if not todelete:
568 if not todelete:
568 h, fl = self._lm[f]
569 h, fl = self._lm[f]
569 l = "%s\0%s%s\n" % (f, revlog.hex(h), fl)
570 l = "%s\0%s%s\n" % (f, hex(h), fl)
570 else:
571 else:
571 if start == end:
572 if start == end:
572 # item we want to delete was not found, error out
573 # item we want to delete was not found, error out
@@ -680,7 +681,7 def _splittopdir(f):
680 class treemanifest(object):
681 class treemanifest(object):
681 def __init__(self, dir='', text=''):
682 def __init__(self, dir='', text=''):
682 self._dir = dir
683 self._dir = dir
683 self._node = revlog.nullid
684 self._node = nullid
684 self._loadfunc = _noop
685 self._loadfunc = _noop
685 self._copyfunc = _noop
686 self._copyfunc = _noop
686 self._dirty = False
687 self._dirty = False
@@ -718,7 +719,7 class treemanifest(object):
718
719
719 def __repr__(self):
720 def __repr__(self):
720 return ('<treemanifest dir=%s, node=%s, loaded=%s, dirty=%s at 0x%x>' %
721 return ('<treemanifest dir=%s, node=%s, loaded=%s, dirty=%s at 0x%x>' %
721 (self._dir, revlog.hex(self._node),
722 (self._dir, hex(self._node),
722 bool(self._loadfunc is _noop),
723 bool(self._loadfunc is _noop),
723 self._dirty, id(self)))
724 self._dirty, id(self)))
724
725
@@ -1117,7 +1118,7 class treemanifest(object):
1117 for d, subm in self._dirs.iteritems():
1118 for d, subm in self._dirs.iteritems():
1118 subp1 = m1._dirs.get(d, emptytree)._node
1119 subp1 = m1._dirs.get(d, emptytree)._node
1119 subp2 = m2._dirs.get(d, emptytree)._node
1120 subp2 = m2._dirs.get(d, emptytree)._node
1120 if subp1 == revlog.nullid:
1121 if subp1 == nullid:
1121 subp1, subp2 = subp2, subp1
1122 subp1, subp2 = subp2, subp1
1122 writesubtree(subm, subp1, subp2)
1123 writesubtree(subm, subp1, subp2)
1123
1124
@@ -1557,7 +1558,7 class manifestlog(object):
1557 else:
1558 else:
1558 m = manifestctx(self, node)
1559 m = manifestctx(self, node)
1559
1560
1560 if node != revlog.nullid:
1561 if node != nullid:
1561 mancache = self._dirmancache.get(tree)
1562 mancache = self._dirmancache.get(tree)
1562 if not mancache:
1563 if not mancache:
1563 mancache = util.lrucachedict(self._cachesize)
1564 mancache = util.lrucachedict(self._cachesize)
@@ -1637,7 +1638,7 class manifestctx(object):
1637
1638
1638 def read(self):
1639 def read(self):
1639 if self._data is None:
1640 if self._data is None:
1640 if self._node == revlog.nullid:
1641 if self._node == nullid:
1641 self._data = manifestdict()
1642 self._data = manifestdict()
1642 else:
1643 else:
1643 rl = self._revlog()
1644 rl = self._revlog()
@@ -1660,7 +1661,7 class manifestctx(object):
1660 rl = self._revlog()
1661 rl = self._revlog()
1661 r = rl.rev(self._node)
1662 r = rl.rev(self._node)
1662 deltaparent = rl.deltaparent(r)
1663 deltaparent = rl.deltaparent(r)
1663 if deltaparent != revlog.nullrev and deltaparent in rl.parentrevs(r):
1664 if deltaparent != nullrev and deltaparent in rl.parentrevs(r):
1664 return self.readdelta()
1665 return self.readdelta()
1665 return self.read()
1666 return self.read()
1666
1667
@@ -1732,7 +1733,7 class treemanifestctx(object):
1732 def read(self):
1733 def read(self):
1733 if self._data is None:
1734 if self._data is None:
1734 rl = self._revlog()
1735 rl = self._revlog()
1735 if self._node == revlog.nullid:
1736 if self._node == nullid:
1736 self._data = treemanifest()
1737 self._data = treemanifest()
1737 elif rl._treeondisk:
1738 elif rl._treeondisk:
1738 m = treemanifest(dir=self._dir)
1739 m = treemanifest(dir=self._dir)
@@ -1811,7 +1812,7 class treemanifestctx(object):
1811 rl = self._revlog()
1812 rl = self._revlog()
1812 r = rl.rev(self._node)
1813 r = rl.rev(self._node)
1813 deltaparent = rl.deltaparent(r)
1814 deltaparent = rl.deltaparent(r)
1814 if (deltaparent != revlog.nullrev and
1815 if (deltaparent != nullrev and
1815 deltaparent in rl.parentrevs(r)):
1816 deltaparent in rl.parentrevs(r)):
1816 return self.readdelta(shallow=shallow)
1817 return self.readdelta(shallow=shallow)
1817
1818
General Comments 0
You need to be logged in to leave comments. Login now