Show More
@@ -528,7 +528,7 b' class changectx(basectx):' | |||||
528 |
|
528 | |||
529 | @propertycache |
|
529 | @propertycache | |
530 | def _manifest(self): |
|
530 | def _manifest(self): | |
531 | return self._repo.manifestlog[self._changeset.manifest] |
|
531 | return self._repo.manifestlog[self._changeset.manifest].read() | |
532 |
|
532 | |||
533 | @propertycache |
|
533 | @propertycache | |
534 | def _manifestdelta(self): |
|
534 | def _manifestdelta(self): |
@@ -962,12 +962,13 b' class manifestlog(object):' | |||||
962 | self._mancache[node] = m |
|
962 | self._mancache[node] = m | |
963 | return m |
|
963 | return m | |
964 |
|
964 | |||
965 |
class manifestctx( |
|
965 | class manifestctx(object): | |
966 | """A class representing a single revision of a manifest, including its |
|
966 | """A class representing a single revision of a manifest, including its | |
967 | contents, its parent revs, and its linkrev. |
|
967 | contents, its parent revs, and its linkrev. | |
968 | """ |
|
968 | """ | |
969 | def __init__(self, revlog, node): |
|
969 | def __init__(self, revlog, node): | |
970 | self._revlog = revlog |
|
970 | self._revlog = revlog | |
|
971 | self._data = None | |||
971 |
|
972 | |||
972 | self._node = node |
|
973 | self._node = node | |
973 |
|
974 | |||
@@ -978,21 +979,26 b' class manifestctx(manifestdict):' | |||||
978 | #rev = revlog.rev(node) |
|
979 | #rev = revlog.rev(node) | |
979 | #self.linkrev = revlog.linkrev(rev) |
|
980 | #self.linkrev = revlog.linkrev(rev) | |
980 |
|
981 | |||
981 | # This should eventually be made lazy loaded, so consumers can access |
|
|||
982 | # the node/p1/linkrev data without having to parse the whole manifest. |
|
|||
983 | data = revlog.revision(node) |
|
|||
984 | arraytext = array.array('c', data) |
|
|||
985 | revlog._fulltextcache[node] = arraytext |
|
|||
986 | super(manifestctx, self).__init__(data) |
|
|||
987 |
|
||||
988 | def node(self): |
|
982 | def node(self): | |
989 | return self._node |
|
983 | return self._node | |
990 |
|
984 | |||
991 | class treemanifestctx(treemanifest): |
|
985 | def read(self): | |
|
986 | if not self._data: | |||
|
987 | if self._node == revlog.nullid: | |||
|
988 | self._data = manifestdict() | |||
|
989 | else: | |||
|
990 | text = self._revlog.revision(self._node) | |||
|
991 | arraytext = array.array('c', text) | |||
|
992 | self._revlog._fulltextcache[self._node] = arraytext | |||
|
993 | self._data = manifestdict(text) | |||
|
994 | return self._data | |||
|
995 | ||||
|
996 | class treemanifestctx(object): | |||
992 | def __init__(self, revlog, dir, node): |
|
997 | def __init__(self, revlog, dir, node): | |
993 | revlog = revlog.dirlog(dir) |
|
998 | revlog = revlog.dirlog(dir) | |
994 | self._revlog = revlog |
|
999 | self._revlog = revlog | |
995 | self._dir = dir |
|
1000 | self._dir = dir | |
|
1001 | self._data = None | |||
996 |
|
1002 | |||
997 | self._node = node |
|
1003 | self._node = node | |
998 |
|
1004 | |||
@@ -1003,19 +1009,26 b' class treemanifestctx(treemanifest):' | |||||
1003 | #rev = revlog.rev(node) |
|
1009 | #rev = revlog.rev(node) | |
1004 | #self.linkrev = revlog.linkrev(rev) |
|
1010 | #self.linkrev = revlog.linkrev(rev) | |
1005 |
|
1011 | |||
1006 | if revlog._treeondisk: |
|
1012 | def read(self): | |
1007 | super(treemanifestctx, self).__init__(dir=dir) |
|
1013 | if not self._data: | |
1008 | def gettext(): |
|
1014 | if self._node == revlog.nullid: | |
1009 | return revlog.revision(node) |
|
1015 | self._data = treemanifest() | |
1010 |
|
|
1016 | elif self._revlog._treeondisk: | |
1011 | return revlog.dirlog(dir).read(subm) |
|
1017 | m = treemanifest(dir=self._dir) | |
1012 |
|
|
1018 | def gettext(): | |
1013 | self.setnode(node) |
|
1019 | return self._revlog.revision(self._node) | |
1014 | else: |
|
1020 | def readsubtree(dir, subm): | |
1015 | text = revlog.revision(node) |
|
1021 | return treemanifestctx(self._revlog, dir, subm).read() | |
1016 | arraytext = array.array('c', text) |
|
1022 | m.read(gettext, readsubtree) | |
1017 | revlog.fulltextcache[node] = arraytext |
|
1023 | m.setnode(self._node) | |
1018 | super(treemanifestctx, self).__init__(dir=dir, text=text) |
|
1024 | self._data = m | |
|
1025 | else: | |||
|
1026 | text = self._revlog.revision(self._node) | |||
|
1027 | arraytext = array.array('c', text) | |||
|
1028 | self._revlog.fulltextcache[self._node] = arraytext | |||
|
1029 | self._data = treemanifest(dir=self._dir, text=text) | |||
|
1030 | ||||
|
1031 | return self._data | |||
1019 |
|
1032 | |||
1020 | def node(self): |
|
1033 | def node(self): | |
1021 | return self._node |
|
1034 | return self._node | |
@@ -1130,7 +1143,11 b' class manifest(manifestrevlog):' | |||||
1130 | if node == revlog.nullid: |
|
1143 | if node == revlog.nullid: | |
1131 | return self._newmanifest() # don't upset local cache |
|
1144 | return self._newmanifest() # don't upset local cache | |
1132 | if node in self._mancache: |
|
1145 | if node in self._mancache: | |
1133 |
|
|
1146 | cached = self._mancache[node] | |
|
1147 | if (isinstance(cached, manifestctx) or | |||
|
1148 | isinstance(cached, treemanifestctx)): | |||
|
1149 | cached = cached.read() | |||
|
1150 | return cached | |||
1134 | if self._treeondisk: |
|
1151 | if self._treeondisk: | |
1135 | def gettext(): |
|
1152 | def gettext(): | |
1136 | return self.revision(node) |
|
1153 | return self.revision(node) |
General Comments 0
You need to be logged in to leave comments.
Login now