]> granicus.if.org Git - python/commitdiff
use wfile api
authorBenjamin Peterson <benjamin@python.org>
Fri, 27 Apr 2012 15:56:30 +0000 (11:56 -0400)
committerBenjamin Peterson <benjamin@python.org>
Fri, 27 Apr 2012 15:56:30 +0000 (11:56 -0400)
Tools/hg/hgtouch.py

index c7fde1057d443332be0d57581d79b05e43466aa2..5961a10ad02ac2e19bc07751d84942f8ab584f7b 100644 (file)
@@ -7,15 +7,19 @@ syntax of make rules.
 
 In addition to the dependency syntax, #-comments are supported.
 """
+import errno
 import os
 
 def parse_config(repo):
-    configfile = repo.wjoin(".hgtouch")
-    if not os.path.exists(configfile):
+    try:
+        fp = repo.wfile(".hgtouch")
+    except IOError, e:
+        if e.errno != errno.ENOENT:
+            raise
         return {}
     result = {}
-    with open(configfile) as f:
-        for line in f:
+    with fp:
+        for line in fp:
             # strip comments
             line = line.split('#')[0].strip()
             if ':' not in line: