Mercurial > public > mercurial-scm > hg
diff mercurial/config.py @ 8180:6fc30fe7f3e7
hgweb: use config.config
author | Matt Mackall <mpm@selenic.com> |
---|---|
date | Sun, 26 Apr 2009 16:50:43 -0500 |
parents | fca54469480e |
children | 2858ab754995 |
line wrap: on
line diff
--- a/mercurial/config.py Sun Apr 26 16:50:43 2009 -0500 +++ b/mercurial/config.py Sun Apr 26 16:50:43 2009 -0500 @@ -57,7 +57,7 @@ self._data[section] = sortdict() self._data[section][item] = (value, source) - def read(self, path, fp): + def read(self, path, fp=None): sectionre = re.compile(r'\[([^\[]+)\]') itemre = re.compile(r'([^=\s]+)\s*=\s*(.*)') contre = re.compile(r'\s+(\S.*)') @@ -66,6 +66,10 @@ item = None line = 0 cont = 0 + + if not fp: + fp = open(path) + for l in fp: line += 1 if cont: