# HG changeset patch # User Mads Kiilerich # Date 1552961111 -3600 # Node ID 927b7934b86706b9acdb16bd2a67b825f0ef3830 # Parent b650b42025671fa98a81dc0965d418c0d9b31da8 utils: let make_ui return an empty ui.ui() object if the requested hgrc file isn't present 89c30b145bb8 lost an "if repoui" in simplehg, and Kallithea would thus fail on serving repos without a .hg/hgrc : File ".../kallithea/lib/middleware/simplehg.py", line 285, in _augment_hgrc for k, v in repoui.configitems(section): AttributeError: 'bool' object has no attribute 'configitems' It is *only* simplehg that invoke make_ui with read_from 'file'. In this case it could return False if the requested file wasn't present. It was odd and inconsistent that make_ui with read_from 'file' either returned an ui object or the value False. To fix the problem, just let make_ui return the empty ui.ui() if no .hg/hgrc is present. An ui object that just doesn't have any config sections is much better than any alternative. diff -r b650b4202567 -r 927b7934b867 kallithea/lib/utils.py --- a/kallithea/lib/utils.py Sat Mar 16 21:07:30 2019 +0100 +++ b/kallithea/lib/utils.py Tue Mar 19 03:05:11 2019 +0100 @@ -334,7 +334,7 @@ if read_from == 'file': if not os.path.isfile(path): log.debug('hgrc file is not present at %s, skipping...', path) - return False + return baseui log.debug('reading hgrc from %s', path) cfg = config.config() cfg.read(path)