##// END OF EJS Templates
Handle errors in .hgtags or hgrc [tags] section more gracefully....
Thomas Arendsen Hein -
r477:520540fd default
parent child Browse files
Show More
@@ -662,15 +662,15 b' def tag(ui, repo, name, rev = None, **op'
662 662
663 663 def tags(ui, repo):
664 664 """list repository tags"""
665
665
666 666 l = repo.tagslist()
667 667 l.reverse()
668 for t,n in l:
668 for t, n in l:
669 669 try:
670 r = repo.changelog.rev(n)
670 r = "%5d:%s" % (repo.changelog.rev(n), hg.hex(n))
671 671 except KeyError:
672 r = "?"
673 print "%-30s %5d:%s" % (t, repo.changelog.rev(n), hg.hex(n))
672 r = " ?:?"
673 ui.write("%-30s %s\n" % (t, r))
674 674
675 675 def tip(ui, repo):
676 676 """show the tip revision"""
@@ -373,7 +373,7 b' class localrepository:'
373 373
374 374 def tags(self):
375 375 '''return a mapping of tag to node'''
376 if not self.tagscache:
376 if not self.tagscache:
377 377 self.tagscache = {}
378 378 try:
379 379 # read each head of the tags file, ending with the tip
@@ -386,11 +386,20 b' class localrepository:'
386 386 for l in fl.revision(r).splitlines():
387 387 if l:
388 388 n, k = l.split(" ", 1)
389 self.tagscache[k.strip()] = bin(n)
390 except KeyError: pass
389 try:
390 bin_n = bin(n)
391 except TypeError:
392 bin_n = ''
393 self.tagscache[k.strip()] = bin_n
394 except KeyError:
395 pass
391 396 for k, n in self.ui.configitems("tags"):
392 self.tagscache[k] = bin(n)
393
397 try:
398 bin_n = bin(n)
399 except TypeError:
400 bin_n = ''
401 self.tagscache[k] = bin_n
402
394 403 self.tagscache['tip'] = self.changelog.tip()
395 404
396 405 return self.tagscache
@@ -398,7 +407,7 b' class localrepository:'
398 407 def tagslist(self):
399 408 '''return a list of tags ordered by revision'''
400 409 l = []
401 for t,n in self.tags().items():
410 for t, n in self.tags().items():
402 411 try:
403 412 r = self.changelog.rev(n)
404 413 except:
General Comments 0
You need to be logged in to leave comments. Login now