##// 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 hexfunc = ui.debugflag and hex or short
452 hexfunc = ui.debugflag and hex or short
453 activebranches = [encoding.tolocal(repo[n].branch())
453 activebranches = [repo[n].branch() for n in repo.heads()]
454 for n in repo.heads()]
455 def testactive(tag, node):
454 def testactive(tag, node):
456 realhead = tag in activebranches
455 realhead = tag in activebranches
457 open = node in repo.branchheads(tag, closed=False)
456 open = node in repo.branchheads(tag, closed=False)
@@ -462,8 +461,9 b' def branches(ui, repo, active=False, clo'
462
461
463 for isactive, node, tag in branches:
462 for isactive, node, tag in branches:
464 if (not active) or isactive:
463 if (not active) or isactive:
464 encodedtag = encoding.tolocal(tag)
465 if ui.quiet:
465 if ui.quiet:
466 ui.write("%s\n" % tag)
466 ui.write("%s\n" % encodedtag)
467 else:
467 else:
468 hn = repo.lookup(node)
468 hn = repo.lookup(node)
469 if isactive:
469 if isactive:
@@ -474,8 +474,8 b' def branches(ui, repo, active=False, clo'
474 notice = ' (closed)'
474 notice = ' (closed)'
475 else:
475 else:
476 notice = ' (inactive)'
476 notice = ' (inactive)'
477 rev = str(node).rjust(31 - encoding.colwidth(tag))
477 rev = str(node).rjust(31 - encoding.colwidth(encodedtag))
478 data = tag, rev, hexfunc(hn), notice
478 data = encodedtag, rev, hexfunc(hn), notice
479 ui.write("%s %s:%s%s\n" % data)
479 ui.write("%s %s:%s%s\n" % data)
480
480
481 def bundle(ui, repo, fname, dest=None, **opts):
481 def bundle(ui, repo, fname, dest=None, **opts):
@@ -1401,21 +1401,22 b' def heads(ui, repo, *branchrevs, **opts)'
1401 heads = []
1401 heads = []
1402 visitedset = set()
1402 visitedset = set()
1403 for branchrev in branchrevs:
1403 for branchrev in branchrevs:
1404 branch = repo[branchrev].branch()
1404 branch = repo[encoding.fromlocal(branchrev)].branch()
1405 encodedbranch = encoding.tolocal(branch)
1405 if branch in visitedset:
1406 if branch in visitedset:
1406 continue
1407 continue
1407 visitedset.add(branch)
1408 visitedset.add(branch)
1408 bheads = repo.branchheads(branch, start, closed=closed)
1409 bheads = repo.branchheads(branch, start, closed=closed)
1409 if not bheads:
1410 if not bheads:
1410 if not opts.get('rev'):
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 elif branch != branchrev:
1413 elif branch != branchrev:
1413 ui.warn(_("no changes on branch %s containing %s are "
1414 ui.warn(_("no changes on branch %s containing %s are "
1414 "reachable from %s\n")
1415 "reachable from %s\n")
1415 % (branch, branchrev, opts.get('rev')))
1416 % (encodedbranch, branchrev, opts.get('rev')))
1416 else:
1417 else:
1417 ui.warn(_("no changes on branch %s are reachable from %s\n")
1418 ui.warn(_("no changes on branch %s are reachable from %s\n")
1418 % (branch, opts.get('rev')))
1419 % (encodedbranch, opts.get('rev')))
1419 if hideinactive:
1420 if hideinactive:
1420 bheads = [bhead for bhead in bheads if bhead in _heads]
1421 bheads = [bhead for bhead in bheads if bhead in _heads]
1421 heads.extend(bheads)
1422 heads.extend(bheads)
@@ -318,16 +318,6 b' class localrepository(repo.repository):'
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:
@@ -351,7 +341,7 b' class localrepository(repo.repository):'
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]
@@ -1167,7 +1157,7 b' class localrepository(repo.repository):'
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
General Comments 0
You need to be logged in to leave comments. Login now