comparison mercurial/localrepo.py @ 9675:ee913987e4b0

localrepo/branchcache: remove lbranchmap(), convert users to use utf-8 names We don't need a "local-charset" aware branchmap() function, we can convert the names when needed during the output.
author Benoit Boissinot <benoit.boissinot@ens-lyon.org>
date Sat, 31 Oct 2009 00:31:08 +0100
parents 603b23c6967b
children f8e1456e1c2c
comparison
equal deleted inserted replaced
9674:603b23c6967b 9675:ee913987e4b0
316 self._updatebranchcache(partial, lrev+1, tiprev+1) 316 self._updatebranchcache(partial, lrev+1, tiprev+1)
317 self._writebranchcache(partial, self.changelog.tip(), tiprev) 317 self._writebranchcache(partial, self.changelog.tip(), tiprev)
318 318
319 return partial 319 return partial
320 320
321 def lbranchmap(self):
322 branchcache = {}
323 partial = self.branchmap()
324
325 # the branch cache is stored on disk as UTF-8, but in the local
326 # charset internally
327 for k, v in partial.iteritems():
328 branchcache[encoding.tolocal(k)] = v
329 return branchcache
330
331 def branchmap(self): 321 def branchmap(self):
332 tip = self.changelog.tip() 322 tip = self.changelog.tip()
333 if self._branchcache is not None and self._branchcachetip == tip: 323 if self._branchcache is not None and self._branchcachetip == tip:
334 return self._branchcache 324 return self._branchcache
335 325
349 339
350 def branchtags(self): 340 def branchtags(self):
351 '''return a dict where branch names map to the tipmost head of 341 '''return a dict where branch names map to the tipmost head of
352 the branch, open heads come before closed''' 342 the branch, open heads come before closed'''
353 bt = {} 343 bt = {}
354 for bn, heads in self.lbranchmap().iteritems(): 344 for bn, heads in self.branchmap().iteritems():
355 head = None 345 head = None
356 for i in range(len(heads)-1, -1, -1): 346 for i in range(len(heads)-1, -1, -1):
357 h = heads[i] 347 h = heads[i]
358 if 'close' not in self.changelog.read(h)[5]: 348 if 'close' not in self.changelog.read(h)[5]:
359 head = h 349 head = h
1165 If start is not None, return only heads reachable from start. 1155 If start is not None, return only heads reachable from start.
1166 If closed is True, return heads that are marked as closed as well. 1156 If closed is True, return heads that are marked as closed as well.
1167 ''' 1157 '''
1168 if branch is None: 1158 if branch is None:
1169 branch = self[None].branch() 1159 branch = self[None].branch()
1170 branches = self.lbranchmap() 1160 branches = self.branchmap()
1171 if branch not in branches: 1161 if branch not in branches:
1172 return [] 1162 return []
1173 # the cache returns heads ordered lowest to highest 1163 # the cache returns heads ordered lowest to highest
1174 bheads = list(reversed(branches[branch])) 1164 bheads = list(reversed(branches[branch]))
1175 if start is not None: 1165 if start is not None: