[PATCH 1 of 4 stable] tags: silence cache parsing errors

Matt Mackall mpm at selenic.com
Thu Apr 28 21:54:27 UTC 2016


# HG changeset patch
# User Matt Mackall <mpm at selenic.com>
# Date 1461875754 18000
#      Thu Apr 28 15:35:54 2016 -0500
# Branch stable
# Node ID 30ea1355f34f85f4d7b5b0f4c8816fa44a35a8ed
# Parent  94451300f3ec4a81135d3cf86ca3dce13e53837b
tags: silence cache parsing errors

Follow our standard STFU cache-handling pattern

diff -r 94451300f3ec -r 30ea1355f34f mercurial/tags.py
--- a/mercurial/tags.py	Sun Apr 24 21:35:30 2016 +0900
+++ b/mercurial/tags.py	Thu Apr 28 15:35:54 2016 -0500
@@ -176,8 +176,8 @@
     hextaglines = util.sortdict()
     count = 0
 
-    def warn(msg):
-        ui.warn(_("%s, line %s: %s\n") % (fn, count, msg))
+    def dbg(msg):
+        ui.debug("%s, line %s: %s\n" % (fn, count, msg))
 
     for nline, line in enumerate(lines):
         count += 1
@@ -186,7 +186,7 @@
         try:
             (nodehex, name) = line.split(" ", 1)
         except ValueError:
-            warn(_("cannot parse entry"))
+            dbg("cannot parse entry")
             continue
         name = name.strip()
         if recode:
@@ -194,7 +194,7 @@
         try:
             nodebin = bin(nodehex)
         except TypeError:
-            warn(_("node '%s' is not well formed") % nodehex)
+            dbg("node '%s' is not well formed" % nodehex)
             continue
 
         # update filetags
diff -r 94451300f3ec -r 30ea1355f34f tests/test-tags.t
--- a/tests/test-tags.t	Sun Apr 24 21:35:30 2016 +0900
+++ b/tests/test-tags.t	Thu Apr 28 15:35:54 2016 -0500
@@ -262,12 +262,12 @@
   $ hg commit -m "head"
   created new head
 
-  $ hg tags
+  $ hg tags --debug
   .hgtags at 75d9f02dfe28, line 2: cannot parse entry
   .hgtags at 75d9f02dfe28, line 4: node 'foo' is not well formed
   .hgtags at c4be69a18c11, line 2: node 'x' is not well formed
-  tip                                8:c4be69a18c11
-  first                              0:acb14030fe0a
+  tip                                8:c4be69a18c11e8bc3a5fdbb576017c25f7d84663
+  first                              0:acb14030fe0a21b60322c440ad2d20cf7685a376
   $ hg tip
   changeset:   8:c4be69a18c11
   tag:         tip


More information about the Mercurial-devel mailing list