comparison mercurial/unionrepo.py @ 39779:5ccd791344f3

localrepo: pass root manifest into manifestlog.__init__ Today, localrepository has a method that can be overloaded which returns an instance of the root manifest storage object. When a manifestlog is created, it calls this private method and stores the root manifest object on it. This "hook" on localrepository isn't part of the documented interface. It isn't compatible with our desire to make repo storage determined before the repo object is constructed. This commit changes manifestlog.__init__ to accept the root storage object instead of calling into the repo to construct it. By doing things this way, the repo instance is responsible for constructing the manifest storage object directly. This does mean that other derived repo types need to overload manifestlog(). But they should have been doing this already, as manifestlog() is typically decorated in a storage-specific way. e.g. localrepository.manifestlog() is decorated as @storecache('00manifest.i'). And this assumes that a 00manifest.i file exists in the store vfs. This condition may not hold for repository types using non-revlog storage. So it is important for special repo types to override manifestlog() to remove this file association. The code changed in perf is wrong because it isn't compatible with older Mercurial versions. But I'm pretty sure the code was broken on older versions before this commit. It only affects `hg perftags`. I don't care enough to fix that at this time. .. api:: ``manifest.manifestlog.__init__()`` now receives the root manifest storage instance instead of calling into a private method on the repo object to obtain it. Differential Revision: https://phab.mercurial-scm.org/D4641
author Gregory Szorc <gregory.szorc@gmail.com>
date Tue, 18 Sep 2018 15:15:24 -0700
parents 23f2299e9e53
children 24e493ec2229
comparison
equal deleted inserted replaced
39778:edaa40dc5fe5 39779:5ccd791344f3
205 self.ui.setconfig('phases', 'publish', False, 'unionrepo') 205 self.ui.setconfig('phases', 'publish', False, 'unionrepo')
206 206
207 @localrepo.unfilteredpropertycache 207 @localrepo.unfilteredpropertycache
208 def changelog(self): 208 def changelog(self):
209 return unionchangelog(self.svfs, self.repo2.svfs) 209 return unionchangelog(self.svfs, self.repo2.svfs)
210
211 @localrepo.unfilteredpropertycache
212 def manifestlog(self):
213 rootstore = unionmanifest(self.svfs, self.repo2.svfs,
214 self.unfiltered()._clrev)
215 return manifest.manifestlog(self.svfs, self, rootstore)
210 216
211 def _clrev(self, rev2): 217 def _clrev(self, rev2):
212 """map from repo2 changelog rev to temporary rev in self.changelog""" 218 """map from repo2 changelog rev to temporary rev in self.changelog"""
213 node = self.repo2.changelog.node(rev2) 219 node = self.repo2.changelog.node(rev2)
214 return self.changelog.rev(node) 220 return self.changelog.rev(node)