changeset 23556:7e1da5d004eb

namespaces: pass repo to __init__ We store repo as a weakref so that we can prevent a cycle between namespaces and localrepo.
author Sean Farley <sean.michael.farley@gmail.com>
date Sun, 14 Dec 2014 15:35:57 -0800
parents f08f6a7d4d5f
children b04b27aa6da3
files mercurial/namespaces.py
diffstat 1 files changed, 3 insertions(+), 1 deletions(-) [+]
line wrap: on
line diff
--- a/mercurial/namespaces.py	Sun Dec 14 15:04:40 2014 -0800
+++ b/mercurial/namespaces.py	Sun Dec 14 15:35:57 2014 -0800
@@ -1,4 +1,5 @@
 from mercurial import util
+import weakref
 
 def tolist(val):
     """
@@ -30,8 +31,9 @@
 
     _names_version = 0
 
-    def __init__(self):
+    def __init__(self, repo):
         self._names = util.sortdict()
+        self._repo = weakref.ref(repo)
 
     def addnamespace(self, namespace, namemap, order=None):
         """