[PATCH 2 of 2] commands: tags point to valid nodes

Idan Kamara idankk86 at gmail.com
Tue Apr 5 15:14:48 CDT 2011


# HG changeset patch
# User Idan Kamara <idankk86 at gmail.com>
# Date 1301949802 -10800
# Node ID 7a9f722acdffa523ab62fc2f2ae69ba1cd85369b
# Parent  8336b69f5fdd194c14ced20251a0b79fa12306a2
commands: tags point to valid nodes

_findtags in localrepo checks that nodes exist in the revlog so we can't get a LookupError here.

The output of 'hg tags' stays the same since tags to unknown nodes didn't get printed before anyway due to ae3089cefaab.

diff -r 8336b69f5fdd -r 7a9f722acdff mercurial/commands.py
--- a/mercurial/commands.py	Mon Apr 04 22:51:10 2011 +0300
+++ b/mercurial/commands.py	Mon Apr 04 23:43:22 2011 +0300
@@ -4060,19 +4060,16 @@
             ui.write("%s\n" % t)
             continue
 
-        try:
-            hn = hexfunc(n)
-            r = "%5d:%s" % (repo.changelog.rev(n), hn)
-        except error.LookupError:
-            r = "    ?:%s" % hn
-        else:
-            spaces = " " * (30 - encoding.colwidth(t))
-            if ui.verbose:
-                if repo.tagtype(t) == 'local':
-                    tagtype = " local"
-                else:
-                    tagtype = ""
-            ui.write("%s%s %s%s\n" % (t, spaces, r, tagtype))
+        hn = hexfunc(n)
+        r = "%5d:%s" % (repo.changelog.rev(n), hn)
+        spaces = " " * (30 - encoding.colwidth(t))
+
+        if ui.verbose:
+            if repo.tagtype(t) == 'local':
+                tagtype = " local"
+            else:
+                tagtype = ""
+        ui.write("%s%s %s%s\n" % (t, spaces, r, tagtype))
 
 def tip(ui, repo, **opts):
     """show the tip revision


More information about the Mercurial-devel mailing list