changeset 14642:fdcdb221a922

config: handle comment lines in continuations (issue2854)
author Matt Mackall <mpm@selenic.com>
date Thu, 16 Jun 2011 13:24:44 -0500
parents f2789767a2c4
children 7e295dd10d40
files mercurial/config.py
diffstat 1 files changed, 4 insertions(+), 1 deletions(-) [+]
line wrap: on
line diff
--- 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: