##// END OF EJS Templates
branchcache: make entries a private attribute...
Pulkit Goyal -
r42172:b137a679 default
parent child Browse files
Show More
@@ -161,23 +161,23 b' class branchcache(object):'
161 161 self._closednodes = set()
162 162 else:
163 163 self._closednodes = closednodes
164 self.entries = dict(entries)
164 self._entries = dict(entries)
165 165
166 166 def __iter__(self):
167 return iter(self.entries)
167 return iter(self._entries)
168 168
169 169 def __setitem__(self, key, value):
170 self.entries[key] = value
170 self._entries[key] = value
171 171
172 172 def __getitem__(self, key):
173 return self.entries[key]
173 return self._entries[key]
174 174
175 175 def iteritems(self):
176 return self.entries.iteritems()
176 return self._entries.iteritems()
177 177
178 178 def hasbranch(self, label):
179 179 """ checks whether a branch of this name exists or not """
180 return label in self.entries
180 return label in self._entries
181 181
182 182 @classmethod
183 183 def fromfile(cls, repo):
@@ -230,7 +230,7 b' class branchcache(object):'
230 230 if not cl.hasnode(node):
231 231 raise ValueError(
232 232 r'node %s does not exist' % pycompat.sysstr(hex(node)))
233 self.entries.setdefault(label, []).append(node)
233 self._entries.setdefault(label, []).append(node)
234 234 if state == 'c':
235 235 self._closednodes.add(node)
236 236
@@ -287,12 +287,12 b' class branchcache(object):'
287 287
288 288 def iterheads(self):
289 289 """ returns all the heads """
290 return self.entries.itervalues()
290 return self._entries.itervalues()
291 291
292 292 def copy(self):
293 293 """return an deep copy of the branchcache object"""
294 294 return branchcache(
295 self.entries, self.tipnode, self.tiprev, self.filteredhash,
295 self._entries, self.tipnode, self.tiprev, self.filteredhash,
296 296 self._closednodes)
297 297
298 298 def write(self, repo):
@@ -315,7 +315,7 b' class branchcache(object):'
315 315 f.close()
316 316 repo.ui.log('branchcache',
317 317 'wrote %s branch cache with %d labels and %d nodes\n',
318 repo.filtername, len(self.entries), nodecount)
318 repo.filtername, len(self._entries), nodecount)
319 319 except (IOError, OSError, error.Abort) as inst:
320 320 # Abort may be raised by read only opener, so log and continue
321 321 repo.ui.debug("couldn't write branch cache: %s\n" %
@@ -344,7 +344,7 b' class branchcache(object):'
344 344 # really branchheads. Note checking parents is insufficient:
345 345 # 1 (branch a) -> 2 (branch b) -> 3 (branch a)
346 346 for branch, newheadrevs in newbranches.iteritems():
347 bheads = self.entries.setdefault(branch, [])
347 bheads = self._entries.setdefault(branch, [])
348 348 bheadset = set(cl.rev(node) for node in bheads)
349 349
350 350 # This have been tested True on all internal usage of this function.
General Comments 0
You need to be logged in to leave comments. Login now