diff mercurial/ignore.py @ 25163:3139900f31b1

ignore: remove .hgignore from ignore list if nonexistent Previously we would always pass the root .hgignore path to the ignore parser. The parser then had to be aware that the first path was special, and not warn if it didn't exist. In preparation for making the ignore file parser more generically usable, let's make the parse logic not aware of this special case, and instead just not pass the root .hgignore in if it doesn't exist.
author Durham Goode <durham@fb.com>
date Sat, 16 May 2015 15:24:43 -0700
parents e91b32d3c67b
children 1e86bb282c71
line wrap: on
line diff
--- a/mercurial/ignore.py	Sun May 17 21:47:18 2015 -0400
+++ b/mercurial/ignore.py	Sat May 16 15:24:43 2015 -0700
@@ -55,7 +55,7 @@
 
     return patterns, warnings
 
-def readignorefile(filepath, warn, skipwarning=False):
+def readignorefile(filepath, warn):
     try:
         pats = []
         fp = open(filepath)
@@ -64,9 +64,8 @@
         for warning in warnings:
             warn("%s: %s\n" % (filepath, warning))
     except IOError, inst:
-        if not skipwarning:
-            warn(_("skipping unreadable ignore file '%s': %s\n") %
-                 (filepath, inst.strerror))
+        warn(_("skipping unreadable ignore file '%s': %s\n") %
+             (filepath, inst.strerror))
     return pats
 
 def readpats(root, files, warn):
@@ -76,8 +75,7 @@
     for f in files:
         if f in pats:
             continue
-        skipwarning = f == files[0]
-        pats[f] = readignorefile(f, warn, skipwarning=skipwarning)
+        pats[f] = readignorefile(f, warn)
 
     return [(f, pats[f]) for f in files if f in pats]