Mercurial > hg
changeset 477:520540fd6b64
Handle errors in .hgtags or hgrc [tags] section more gracefully.
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1
Handle errors in .hgtags or hgrc [tags] section more gracefully.
manifest hash: 85c62e1bf3ad78b243ee60f43c3c577700a8c96d
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.1 (GNU/Linux)
iD8DBQFCvp6jW7P1GVgWeRoRAo23AKCZRU22IweynNtf9k3q4pEyqEaozACeMIRV
6tNOkr3h6jTiMZ2bJgPeabg=
=+U5s
-----END PGP SIGNATURE-----
author | Thomas Arendsen Hein <thomas@intevation.de> |
---|---|
date | Sun, 26 Jun 2005 13:25:07 +0100 |
parents | 0a338d506268 |
children | f1804f2e7f35 |
files | mercurial/commands.py mercurial/hg.py |
diffstat | 2 files changed, 20 insertions(+), 11 deletions(-) [+] |
line wrap: on
line diff
--- a/mercurial/commands.py Sun Jun 26 12:04:59 2005 +0100 +++ b/mercurial/commands.py Sun Jun 26 13:25:07 2005 +0100 @@ -662,15 +662,15 @@ def tags(ui, repo): """list repository tags""" - + l = repo.tagslist() l.reverse() - for t,n in l: + for t, n in l: try: - r = repo.changelog.rev(n) + r = "%5d:%s" % (repo.changelog.rev(n), hg.hex(n)) except KeyError: - r = "?" - print "%-30s %5d:%s" % (t, repo.changelog.rev(n), hg.hex(n)) + r = " ?:?" + ui.write("%-30s %s\n" % (t, r)) def tip(ui, repo): """show the tip revision"""
--- a/mercurial/hg.py Sun Jun 26 12:04:59 2005 +0100 +++ b/mercurial/hg.py Sun Jun 26 13:25:07 2005 +0100 @@ -373,7 +373,7 @@ def tags(self): '''return a mapping of tag to node''' - if not self.tagscache: + if not self.tagscache: self.tagscache = {} try: # read each head of the tags file, ending with the tip @@ -386,11 +386,20 @@ for l in fl.revision(r).splitlines(): if l: n, k = l.split(" ", 1) - self.tagscache[k.strip()] = bin(n) - except KeyError: pass + try: + bin_n = bin(n) + except TypeError: + bin_n = '' + self.tagscache[k.strip()] = bin_n + except KeyError: + pass for k, n in self.ui.configitems("tags"): - self.tagscache[k] = bin(n) - + try: + bin_n = bin(n) + except TypeError: + bin_n = '' + self.tagscache[k] = bin_n + self.tagscache['tip'] = self.changelog.tip() return self.tagscache @@ -398,7 +407,7 @@ def tagslist(self): '''return a list of tags ordered by revision''' l = [] - for t,n in self.tags().items(): + for t, n in self.tags().items(): try: r = self.changelog.rev(n) except: