Mercurial > hg
comparison mercurial/namespaces.py @ 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 |
comparison
equal
deleted
inserted
replaced
23555:f08f6a7d4d5f | 23556:7e1da5d004eb |
---|---|
1 from mercurial import util | 1 from mercurial import util |
2 import weakref | |
2 | 3 |
3 def tolist(val): | 4 def tolist(val): |
4 """ | 5 """ |
5 a convenience method to return an empty list instead of None | 6 a convenience method to return an empty list instead of None |
6 """ | 7 """ |
28 'namemap': function that takes a name and returns a list of nodes | 29 'namemap': function that takes a name and returns a list of nodes |
29 """ | 30 """ |
30 | 31 |
31 _names_version = 0 | 32 _names_version = 0 |
32 | 33 |
33 def __init__(self): | 34 def __init__(self, repo): |
34 self._names = util.sortdict() | 35 self._names = util.sortdict() |
36 self._repo = weakref.ref(repo) | |
35 | 37 |
36 def addnamespace(self, namespace, namemap, order=None): | 38 def addnamespace(self, namespace, namemap, order=None): |
37 """ | 39 """ |
38 register a namespace | 40 register a namespace |
39 | 41 |