config: handle comment lines in continuations (
issue2854)
--- 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: