config: handle comment lines in continuations (issue2854)
authorMatt Mackall <mpm@selenic.com>
Thu, 16 Jun 2011 13:24:44 -0500
changeset 14642 fdcdb221a922
parent 14641 f2789767a2c4
child 14643 7e295dd10d40
config: handle comment lines in continuations (issue2854)
mercurial/config.py
--- a/mercurial/config.py	Thu Jun 16 13:24:42 2011 -0500
+++ b/mercurial/config.py	Thu Jun 16 13:24:44 2011 -0500
@@ -74,7 +74,8 @@
         sectionre = re.compile(r'\[([^\[]+)\]')
         itemre = re.compile(r'([^=\s][^=]*?)\s*=\s*(.*\S|)')
         contre = re.compile(r'\s+(\S|\S.*\S)\s*$')
-        emptyre = re.compile(r'(;|#|\s*$)')
+        emptyre = re.compile(r'\s*(;|#|\s*$)')
+        commentre = re.compile(r'(;|#)')
         unsetre = re.compile(r'%unset\s+(\S+)')
         includere = re.compile(r'%include\s+(\S|\S.*\S)\s*$')
         section = ""
@@ -85,6 +86,8 @@
         for l in data.splitlines(True):
             line += 1
             if cont:
+                if commentre.match(l):
+                    continue
                 m = contre.match(l)
                 if m:
                     if sections and section not in sections: