This commit is contained in:
Brett Cannon 2012-04-27 14:02:33 -04:00
commit 9e66ac683c
1 changed files with 8 additions and 4 deletions

View File

@ -7,15 +7,19 @@ syntax of make rules.
In addition to the dependency syntax, #-comments are supported.
"""
import errno
import os
def parse_config(repo):
configfile = repo.wjoin(".hgtouch")
if not os.path.exists(configfile):
try:
fp = repo.wfile(".hgtouch")
except IOError, e:
if e.errno != errno.ENOENT:
raise
return {}
result = {}
with open(configfile) as f:
for line in f:
with fp:
for line in fp:
# strip comments
line = line.split('#')[0].strip()
if ':' not in line: