Show More
@@ -946,21 +946,19 b' class manifestlog(object):' | |||||
946 | """Retrieves the manifest instance for the given node. Throws a KeyError |
|
946 | """Retrieves the manifest instance for the given node. Throws a KeyError | |
947 | if not found. |
|
947 | if not found. | |
948 | """ |
|
948 | """ | |
949 | if (self._oldmanifest._treeondisk |
|
|||
950 | or self._oldmanifest._treeinmem): |
|
|||
951 | # TODO: come back and support tree manifests directly |
|
|||
952 | return self._oldmanifest.read(node) |
|
|||
953 |
|
||||
954 | if node == revlog.nullid: |
|
|||
955 | return manifestdict() |
|
|||
956 | if node in self._mancache: |
|
949 | if node in self._mancache: | |
957 | cachemf = self._mancache[node] |
|
950 | cachemf = self._mancache[node] | |
958 | # The old manifest may put non-ctx manifests in the cache, so skip |
|
951 | # The old manifest may put non-ctx manifests in the cache, so skip | |
959 | # those since they don't implement the full api. |
|
952 | # those since they don't implement the full api. | |
960 |
if isinstance(cachemf, manifestctx) |
|
953 | if (isinstance(cachemf, manifestctx) or | |
|
954 | isinstance(cachemf, treemanifestctx)): | |||
961 | return cachemf |
|
955 | return cachemf | |
962 |
|
956 | |||
|
957 | if self._oldmanifest._treeinmem: | |||
|
958 | m = treemanifestctx(self._revlog, '', node) | |||
|
959 | else: | |||
963 | m = manifestctx(self._revlog, node) |
|
960 | m = manifestctx(self._revlog, node) | |
|
961 | if node != revlog.nullid: | |||
964 | self._mancache[node] = m |
|
962 | self._mancache[node] = m | |
965 | return m |
|
963 | return m | |
966 |
|
964 | |||
@@ -972,9 +970,13 b' class manifestctx(manifestdict):' | |||||
972 | self._revlog = revlog |
|
970 | self._revlog = revlog | |
973 |
|
971 | |||
974 | self._node = node |
|
972 | self._node = node | |
975 | self.p1, self.p2 = revlog.parents(node) |
|
973 | ||
976 | rev = revlog.rev(node) |
|
974 | # TODO: We eventually want p1, p2, and linkrev exposed on this class, | |
977 | self.linkrev = revlog.linkrev(rev) |
|
975 | # but let's add it later when something needs it and we can load it | |
|
976 | # lazily. | |||
|
977 | #self.p1, self.p2 = revlog.parents(node) | |||
|
978 | #rev = revlog.rev(node) | |||
|
979 | #self.linkrev = revlog.linkrev(rev) | |||
978 |
|
980 | |||
979 | # This should eventually be made lazy loaded, so consumers can access |
|
981 | # This should eventually be made lazy loaded, so consumers can access | |
980 | # the node/p1/linkrev data without having to parse the whole manifest. |
|
982 | # the node/p1/linkrev data without having to parse the whole manifest. | |
@@ -986,6 +988,38 b' class manifestctx(manifestdict):' | |||||
986 | def node(self): |
|
988 | def node(self): | |
987 | return self._node |
|
989 | return self._node | |
988 |
|
990 | |||
|
991 | class treemanifestctx(treemanifest): | |||
|
992 | def __init__(self, revlog, dir, node): | |||
|
993 | revlog = revlog.dirlog(dir) | |||
|
994 | self._revlog = revlog | |||
|
995 | self._dir = dir | |||
|
996 | ||||
|
997 | self._node = node | |||
|
998 | ||||
|
999 | # TODO: Load p1/p2/linkrev lazily. They need to be lazily loaded so that | |||
|
1000 | # we can instantiate treemanifestctx objects for directories we don't | |||
|
1001 | # have on disk. | |||
|
1002 | #self.p1, self.p2 = revlog.parents(node) | |||
|
1003 | #rev = revlog.rev(node) | |||
|
1004 | #self.linkrev = revlog.linkrev(rev) | |||
|
1005 | ||||
|
1006 | if revlog._treeondisk: | |||
|
1007 | super(treemanifestctx, self).__init__(dir=dir) | |||
|
1008 | def gettext(): | |||
|
1009 | return revlog.revision(node) | |||
|
1010 | def readsubtree(dir, subm): | |||
|
1011 | return revlog.dirlog(dir).read(subm) | |||
|
1012 | self.read(gettext, readsubtree) | |||
|
1013 | self.setnode(node) | |||
|
1014 | else: | |||
|
1015 | text = revlog.revision(node) | |||
|
1016 | arraytext = array.array('c', text) | |||
|
1017 | revlog.fulltextcache[node] = arraytext | |||
|
1018 | super(treemanifestctx, self).__init__(dir=dir, text=text) | |||
|
1019 | ||||
|
1020 | def node(self): | |||
|
1021 | return self._node | |||
|
1022 | ||||
989 | class manifest(manifestrevlog): |
|
1023 | class manifest(manifestrevlog): | |
990 | def __init__(self, opener, dir='', dirlogcache=None): |
|
1024 | def __init__(self, opener, dir='', dirlogcache=None): | |
991 | '''The 'dir' and 'dirlogcache' arguments are for internal use by |
|
1025 | '''The 'dir' and 'dirlogcache' arguments are for internal use by |
General Comments 0
You need to be logged in to leave comments.
Login now