##// END OF EJS Templates
localrepo/branchcache: remove lbranchmap(), convert users to use utf-8 names...
Benoit Boissinot -
r9675:ee913987 default
parent child Browse files
Show More
@@ -450,8 +450,7 b' def branches(ui, repo, active=False, clo'
450 450 """
451 451
452 452 hexfunc = ui.debugflag and hex or short
453 activebranches = [encoding.tolocal(repo[n].branch())
454 for n in repo.heads()]
453 activebranches = [repo[n].branch() for n in repo.heads()]
455 454 def testactive(tag, node):
456 455 realhead = tag in activebranches
457 456 open = node in repo.branchheads(tag, closed=False)
@@ -462,8 +461,9 b' def branches(ui, repo, active=False, clo'
462 461
463 462 for isactive, node, tag in branches:
464 463 if (not active) or isactive:
464 encodedtag = encoding.tolocal(tag)
465 465 if ui.quiet:
466 ui.write("%s\n" % tag)
466 ui.write("%s\n" % encodedtag)
467 467 else:
468 468 hn = repo.lookup(node)
469 469 if isactive:
@@ -474,8 +474,8 b' def branches(ui, repo, active=False, clo'
474 474 notice = ' (closed)'
475 475 else:
476 476 notice = ' (inactive)'
477 rev = str(node).rjust(31 - encoding.colwidth(tag))
478 data = tag, rev, hexfunc(hn), notice
477 rev = str(node).rjust(31 - encoding.colwidth(encodedtag))
478 data = encodedtag, rev, hexfunc(hn), notice
479 479 ui.write("%s %s:%s%s\n" % data)
480 480
481 481 def bundle(ui, repo, fname, dest=None, **opts):
@@ -1401,21 +1401,22 b' def heads(ui, repo, *branchrevs, **opts)'
1401 1401 heads = []
1402 1402 visitedset = set()
1403 1403 for branchrev in branchrevs:
1404 branch = repo[branchrev].branch()
1404 branch = repo[encoding.fromlocal(branchrev)].branch()
1405 encodedbranch = encoding.tolocal(branch)
1405 1406 if branch in visitedset:
1406 1407 continue
1407 1408 visitedset.add(branch)
1408 1409 bheads = repo.branchheads(branch, start, closed=closed)
1409 1410 if not bheads:
1410 1411 if not opts.get('rev'):
1411 ui.warn(_("no open branch heads on branch %s\n") % branch)
1412 ui.warn(_("no open branch heads on branch %s\n") % encodedbranch)
1412 1413 elif branch != branchrev:
1413 1414 ui.warn(_("no changes on branch %s containing %s are "
1414 1415 "reachable from %s\n")
1415 % (branch, branchrev, opts.get('rev')))
1416 % (encodedbranch, branchrev, opts.get('rev')))
1416 1417 else:
1417 1418 ui.warn(_("no changes on branch %s are reachable from %s\n")
1418 % (branch, opts.get('rev')))
1419 % (encodedbranch, opts.get('rev')))
1419 1420 if hideinactive:
1420 1421 bheads = [bhead for bhead in bheads if bhead in _heads]
1421 1422 heads.extend(bheads)
@@ -318,16 +318,6 b' class localrepository(repo.repository):'
318 318
319 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 321 def branchmap(self):
332 322 tip = self.changelog.tip()
333 323 if self._branchcache is not None and self._branchcachetip == tip:
@@ -351,7 +341,7 b' class localrepository(repo.repository):'
351 341 '''return a dict where branch names map to the tipmost head of
352 342 the branch, open heads come before closed'''
353 343 bt = {}
354 for bn, heads in self.lbranchmap().iteritems():
344 for bn, heads in self.branchmap().iteritems():
355 345 head = None
356 346 for i in range(len(heads)-1, -1, -1):
357 347 h = heads[i]
@@ -1167,7 +1157,7 b' class localrepository(repo.repository):'
1167 1157 '''
1168 1158 if branch is None:
1169 1159 branch = self[None].branch()
1170 branches = self.lbranchmap()
1160 branches = self.branchmap()
1171 1161 if branch not in branches:
1172 1162 return []
1173 1163 # the cache returns heads ordered lowest to highest
General Comments 0
You need to be logged in to leave comments. Login now