mercurial/hg.py
changeset 656 147d2fa2d766
parent 652 a54a1c101a9a
child 657 22bc6fb9aefc
--- a/mercurial/hg.py
+++ b/mercurial/hg.py
@@ -504,7 +504,14 @@ class localrepository:
                 l = file(self.wjoin(".hgignore"))
                 for pat in l:
                     if pat != "\n":
-                        bigpat.append(util.pconvert(pat[:-1]))
+                        p = util.pconvert(pat[:-1])
+                        try:
+                            r = re.compile(p)
+                        except:
+                            self.ui.warn("ignoring invalid ignore"
+                                         + " regular expression '%s'\n" % p)
+                        else:
+                            bigpat.append(util.pconvert(pat[:-1]))
             except IOError: pass
             if bigpat:
                 s = "(?:%s)" % (")|(?:".join(bigpat))