changeset 14038:0e6f622f31ca

tags: loosen IOError filtering when reading localtags
author Idan Kamara <idankk86@gmail.com>
date Fri, 29 Apr 2011 18:44:56 +0300
parents 4ab1e987941b
children 3fc7154396d2
files mercurial/tags.py
diffstat 1 files changed, 12 insertions(+), 9 deletions(-) [+]
line wrap: on
line diff
--- a/mercurial/tags.py	Fri Apr 29 20:29:22 2011 +0300
+++ b/mercurial/tags.py	Fri Apr 29 18:44:56 2011 +0300
@@ -12,9 +12,9 @@
 
 from node import nullid, bin, hex, short
 from i18n import _
-import os.path
 import encoding
 import error
+import errno
 
 def findglobaltags(ui, repo, alltags, tagtypes):
     '''Find global tags in repo by reading .hgtags from every head that
@@ -60,15 +60,18 @@
 def readlocaltags(ui, repo, alltags, tagtypes):
     '''Read local tags in repo.  Update alltags and tagtypes.'''
     try:
-        # localtags is in the local encoding; re-encode to UTF-8 on
-        # input for consistency with the rest of this module.
         data = repo.opener("localtags").read()
-        filetags = _readtags(
-            ui, repo, data.splitlines(), "localtags",
-            recode=encoding.fromlocal)
-        _updatetags(filetags, "local", alltags, tagtypes)
-    except IOError:
-        pass
+    except IOError, inst:
+        if inst.errno != errno.ENOENT:
+            raise
+        return
+
+    # localtags is in the local encoding; re-encode to UTF-8 on
+    # input for consistency with the rest of this module.
+    filetags = _readtags(
+        ui, repo, data.splitlines(), "localtags",
+        recode=encoding.fromlocal)
+    _updatetags(filetags, "local", alltags, tagtypes)
 
 def _readtags(ui, repo, lines, fn, recode=None):
     '''Read tag definitions from a file (or any source of lines).