[PATCH 2 of 6 RFC] manifest: break reference cycle of manifestaccessor and localrepo
Durham Goode
durham at fb.com
Thu Nov 3 18:27:38 EDT 2016
# HG changeset patch
# User Durham Goode <durham at fb.com>
# Date 1478211020 25200
# Thu Nov 03 15:10:20 2016 -0700
# Branch stable
# Node ID 89ee090611f9eecbab008678174b16b692b5c3c9
# Parent 1788ee9e1df92ac94b9be84eac6d16e3bad903a9
manifest: break reference cycle of manifestaccessor and localrepo
Since our manifestaccessor held a reference to localrepo._constructmanifest, it
caused a reference cycle. This patch breaks that cycle.
bundlerepo and unionrepo abuse the manifest/repo relationship a bit more, so for
now they maintain the reference cycle.
diff --git a/mercurial/bundlerepo.py b/mercurial/bundlerepo.py
--- a/mercurial/bundlerepo.py
+++ b/mercurial/bundlerepo.py
@@ -353,6 +353,11 @@ class bundlerepository(localrepo.localre
return m
@localrepo.unfilteredpropertycache
+ def manifestaccessor(self):
+ return localrepo.revlogaccessor('00manifest.i', self.svfs,
+ self._constructmanifest)
+
+ @localrepo.unfilteredpropertycache
def manstart(self):
self.changelog
return self.manstart
diff --git a/mercurial/localrepo.py b/mercurial/localrepo.py
--- a/mercurial/localrepo.py
+++ b/mercurial/localrepo.py
@@ -508,16 +508,14 @@ class localrepository(object):
def manifest(self):
return self.manifestlog._oldmanifest
- def _constructmanifest(self):
- # This is a temporary function while we migrate from manifest to
- # manifestlog. It allows bundlerepo and unionrepo to intercept the
- # manifest creation.
- return manifest.manifest(self.svfs)
-
@unfilteredpropertycache
def manifestaccessor(self):
- return revlogaccessor('00manifest.i', self.svfs,
- self._constructmanifest)
+ svfs = self.svfs
+ def _constructmanifest():
+ return manifest.manifest(svfs)
+
+ return revlogaccessor('00manifest.i', svfs,
+ _constructmanifest)
@storecache('00manifest.i')
def manifestlog(self):
diff --git a/mercurial/unionrepo.py b/mercurial/unionrepo.py
--- a/mercurial/unionrepo.py
+++ b/mercurial/unionrepo.py
@@ -212,6 +212,11 @@ class unionrepository(localrepo.localrep
return unionmanifest(self.svfs, self.repo2.svfs,
self.unfiltered()._clrev)
+ @localrepo.unfilteredpropertycache
+ def manifestaccessor(self):
+ return localrepo.revlogaccessor('00manifest.i', self.svfs,
+ self._constructmanifest)
+
def url(self):
return self._url
More information about the Mercurial-devel
mailing list