##// END OF EJS Templates
remotenames: don't inherit the remotenames class from dict class...
Pulkit Goyal -
r36481:1bd132a0 default
parent child Browse files
Show More
@@ -147,7 +147,7 b' class lazyremotenamedict(collections.Mut'
147 for k, vtup in self.potentialentries.iteritems():
147 for k, vtup in self.potentialentries.iteritems():
148 yield (k, [bin(vtup[0])])
148 yield (k, [bin(vtup[0])])
149
149
150 class remotenames(dict):
150 class remotenames(object):
151 """
151 """
152 This class encapsulates all the remotenames state. It also contains
152 This class encapsulates all the remotenames state. It also contains
153 methods to access that state in convenient ways. Remotenames are lazy
153 methods to access that state in convenient ways. Remotenames are lazy
@@ -156,14 +156,13 b' class remotenames(dict):'
156 """
156 """
157
157
158 def __init__(self, repo, *args):
158 def __init__(self, repo, *args):
159 dict.__init__(self, *args)
160 self._repo = repo
159 self._repo = repo
161 self.clearnames()
160 self.clearnames()
162
161
163 def clearnames(self):
162 def clearnames(self):
164 """ Clear all remote names state """
163 """ Clear all remote names state """
165 self['bookmarks'] = lazyremotenamedict("bookmarks", self._repo)
164 self.bookmarks = lazyremotenamedict("bookmarks", self._repo)
166 self['branches'] = lazyremotenamedict("branches", self._repo)
165 self.branches = lazyremotenamedict("branches", self._repo)
167 self._invalidatecache()
166 self._invalidatecache()
168
167
169 def _invalidatecache(self):
168 def _invalidatecache(self):
@@ -171,7 +170,7 b' class remotenames(dict):'
171 self._nodetobranch = None
170 self._nodetobranch = None
172
171
173 def bmarktonodes(self):
172 def bmarktonodes(self):
174 return self['bookmarks']
173 return self.bookmarks
175
174
176 def nodetobmarks(self):
175 def nodetobmarks(self):
177 if not self._nodetobmarks:
176 if not self._nodetobmarks:
@@ -182,7 +181,7 b' class remotenames(dict):'
182 return self._nodetobmarks
181 return self._nodetobmarks
183
182
184 def branchtonodes(self):
183 def branchtonodes(self):
185 return self['branches']
184 return self.branches
186
185
187 def nodetobranch(self):
186 def nodetobranch(self):
188 if not self._nodetobranch:
187 if not self._nodetobranch:
General Comments 0
You need to be logged in to leave comments. Login now