comparison mercurial/manifest.py @ 29826:93b44aa17691

manifest: use property instead of field for manifest revlog storage The file caches we're using to avoid reloading the manifest from disk everytime has an annoying bug that causes the in memory structure to not be reloaded if the mtime and the size haven't changed. This causes a breakage in the tests because the manifestlog is not being reloaded after a commit+strip operation in mq (the mtime is the same because it all happens in the same second, and the resulting size is the same because we add 1 and remove 1). The only reason this doesn't affect the manifest itself is because we touch it so often that we had already reloaded it after the commit, but before the strip. Once the entire manifest has migrated to manifestlog, we can get rid of these properties, since then the manifestlog will be touched after the commit, but before the strip, as well.
author Durham Goode <durham@fb.com>
date Wed, 17 Aug 2016 13:25:13 -0700
parents 426d931e5db2
children 8a84347b9907
comparison
equal deleted inserted replaced
29825:426d931e5db2 29826:93b44aa17691
920 920
921 In this situation, 'manifest' refers to the abstract concept of a snapshot 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 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 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).""" 924 they receive (i.e. tree or flat or lazily loaded, etc)."""
925 def __init__(self, opener, oldmanifest): 925 def __init__(self, opener, repo):
926 self._revlog = oldmanifest 926 self._repo = repo
927 927
928 # We'll separate this into it's own cache once oldmanifest is no longer 928 # We'll separate this into it's own cache once oldmanifest is no longer
929 # used 929 # used
930 self._mancache = oldmanifest._mancache 930 self._mancache = repo.manifest._mancache
931 931
932 @property
933 def _revlog(self):
934 return self._repo.manifest
935
936 @property
937 def _oldmanifest(self):
932 # _revlog is the same as _oldmanifest right now, but we eventually want 938 # _revlog is the same as _oldmanifest right now, but we eventually want
933 # to delete _oldmanifest while still allowing manifestlog to access the 939 # to delete _oldmanifest while still allowing manifestlog to access the
934 # revlog specific apis. 940 # revlog specific apis.
935 self._oldmanifest = oldmanifest 941 return self._repo.manifest
936 942
937 def __getitem__(self, node): 943 def __getitem__(self, node):
938 """Retrieves the manifest instance for the given node. Throws a KeyError 944 """Retrieves the manifest instance for the given node. Throws a KeyError
939 if not found. 945 if not found.
940 """ 946 """