Show More
@@ -504,6 +504,10 b' class localrepository(object):' | |||||
504 | def manifest(self): |
|
504 | def manifest(self): | |
505 | return manifest.manifest(self.svfs) |
|
505 | return manifest.manifest(self.svfs) | |
506 |
|
506 | |||
|
507 | @storecache('00manifest.i') | |||
|
508 | def manifestlog(self): | |||
|
509 | return manifest.manifestlog(self.svfs, self.manifest) | |||
|
510 | ||||
507 | @repofilecache('dirstate') |
|
511 | @repofilecache('dirstate') | |
508 | def dirstate(self): |
|
512 | def dirstate(self): | |
509 | return dirstate.dirstate(self.vfs, self.ui, self.root, |
|
513 | return dirstate.dirstate(self.vfs, self.ui, self.root, |
@@ -914,6 +914,70 b' class manifestrevlog(revlog.revlog):' | |||||
914 | super(manifestrevlog, self).clearcaches() |
|
914 | super(manifestrevlog, self).clearcaches() | |
915 | self._fulltextcache.clear() |
|
915 | self._fulltextcache.clear() | |
916 |
|
916 | |||
|
917 | class manifestlog(object): | |||
|
918 | """A collection class representing the collection of manifest snapshots | |||
|
919 | referenced by commits in the repository. | |||
|
920 | ||||
|
921 | In this situation, 'manifest' refers to the abstract concept of a snapshot | |||
|
922 | of the list of files in the given commit. Consumers of the output of this | |||
|
923 | class do not care about the implementation details of the actual manifests | |||
|
924 | they receive (i.e. tree or flat or lazily loaded, etc).""" | |||
|
925 | def __init__(self, opener, oldmanifest): | |||
|
926 | self._revlog = oldmanifest | |||
|
927 | ||||
|
928 | # We'll separate this into it's own cache once oldmanifest is no longer | |||
|
929 | # used | |||
|
930 | self._mancache = oldmanifest._mancache | |||
|
931 | ||||
|
932 | # _revlog is the same as _oldmanifest right now, but we eventually want | |||
|
933 | # to delete _oldmanifest while still allowing manifestlog to access the | |||
|
934 | # revlog specific apis. | |||
|
935 | self._oldmanifest = oldmanifest | |||
|
936 | ||||
|
937 | def __getitem__(self, node): | |||
|
938 | """Retrieves the manifest instance for the given node. Throws a KeyError | |||
|
939 | if not found. | |||
|
940 | """ | |||
|
941 | if (self._oldmanifest._treeondisk | |||
|
942 | or self._oldmanifest._treeinmem): | |||
|
943 | # TODO: come back and support tree manifests directly | |||
|
944 | return self._oldmanifest.read(node) | |||
|
945 | ||||
|
946 | if node == revlog.nullid: | |||
|
947 | return manifestdict() | |||
|
948 | if node in self._mancache: | |||
|
949 | cachemf = self._mancache[node] | |||
|
950 | # The old manifest may put non-ctx manifests in the cache, so skip | |||
|
951 | # those since they don't implement the full api. | |||
|
952 | if isinstance(cachemf, manifestctx): | |||
|
953 | return cachemf | |||
|
954 | ||||
|
955 | m = manifestctx(self._revlog, node) | |||
|
956 | self._mancache[node] = m | |||
|
957 | return m | |||
|
958 | ||||
|
959 | class manifestctx(manifestdict): | |||
|
960 | """A class representing a single revision of a manifest, including its | |||
|
961 | contents, its parent revs, and its linkrev. | |||
|
962 | """ | |||
|
963 | def __init__(self, revlog, node): | |||
|
964 | self._revlog = revlog | |||
|
965 | ||||
|
966 | self._node = node | |||
|
967 | self.p1, self.p2 = revlog.parents(node) | |||
|
968 | rev = revlog.rev(node) | |||
|
969 | self.linkrev = revlog.linkrev(rev) | |||
|
970 | ||||
|
971 | # This should eventually be made lazy loaded, so consumers can access | |||
|
972 | # the node/p1/linkrev data without having to parse the whole manifest. | |||
|
973 | data = revlog.revision(node) | |||
|
974 | arraytext = array.array('c', data) | |||
|
975 | revlog._fulltextcache[node] = arraytext | |||
|
976 | super(manifestctx, self).__init__(data) | |||
|
977 | ||||
|
978 | def node(self): | |||
|
979 | return self._node | |||
|
980 | ||||
917 | class manifest(manifestrevlog): |
|
981 | class manifest(manifestrevlog): | |
918 | def __init__(self, opener, dir='', dirlogcache=None): |
|
982 | def __init__(self, opener, dir='', dirlogcache=None): | |
919 | '''The 'dir' and 'dirlogcache' arguments are for internal use by |
|
983 | '''The 'dir' and 'dirlogcache' arguments are for internal use by |
General Comments 0
You need to be logged in to leave comments.
Login now