config: ignore include errors for nonexistent files
authorMatt Mackall <mpm@selenic.com>
Tue, 31 May 2011 16:00:39 -0500
changeset 14486 4e3eda05189b
parent 14485 610873cf064a
child 14487 37901cf0680b
config: ignore include errors for nonexistent files
mercurial/config.py
--- a/mercurial/config.py	Tue May 31 11:52:22 2011 -0700
+++ b/mercurial/config.py	Tue May 31 16:00:39 2011 -0500
@@ -7,7 +7,7 @@
 
 from i18n import _
 import error, util
-import re, os
+import re, os, errno
 
 class sortdict(dict):
     'a simple sorted dictionary'
@@ -103,9 +103,10 @@
                     try:
                         include(inc, remap=remap, sections=sections)
                     except IOError, inst:
-                        raise error.ParseError(_("cannot include %s (%s)")
-                                               % (inc, inst.strerror),
-                                               "%s:%s" % (src, line))
+                        if inst.errno != errno.ENOENT:
+                            raise error.ParseError(_("cannot include %s (%s)")
+                                                   % (inc, inst.strerror),
+                                                   "%s:%s" % (src, line))
                 continue
             if emptyre.match(l):
                 continue