mercurial/config.py
changeset 45208 f7f142d74df3
parent 43506 9f70512ae2cf
child 45254 3f54242781e9
equal deleted inserted replaced
45207:4489e9a22763 45208:f7f142d74df3
   166 
   166 
   167                 for base in includepaths:
   167                 for base in includepaths:
   168                     inc = os.path.normpath(os.path.join(base, expanded))
   168                     inc = os.path.normpath(os.path.join(base, expanded))
   169 
   169 
   170                     try:
   170                     try:
   171                         include(inc, remap=remap, sections=sections)
   171                         include(expanded, inc, remap=remap, sections=sections)
   172                         break
   172                         break
   173                     except IOError as inst:
   173                     except IOError as inst:
   174                         if inst.errno != errno.ENOENT:
   174                         if inst.errno != errno.ENOENT:
   175                             raise error.ParseError(
   175                             raise error.ParseError(
   176                                 _(b"cannot include %s (%s)")
   176                                 _(b"cannot include %s (%s)")
   214             fp = util.posixfile(path, b'rb')
   214             fp = util.posixfile(path, b'rb')
   215         assert getattr(fp, 'mode', 'rb') == 'rb', (
   215         assert getattr(fp, 'mode', 'rb') == 'rb', (
   216             b'config files must be opened in binary mode, got fp=%r mode=%r'
   216             b'config files must be opened in binary mode, got fp=%r mode=%r'
   217             % (fp, fp.mode,)
   217             % (fp, fp.mode,)
   218         )
   218         )
       
   219 
       
   220         def include(rel, abs, remap, sections):
       
   221             self.read(abs, remap=remap, sections=sections)
       
   222 
   219         self.parse(
   223         self.parse(
   220             path, fp.read(), sections=sections, remap=remap, include=self.read
   224             path, fp.read(), sections=sections, remap=remap, include=include
   221         )
   225         )
   222 
   226 
   223 
   227 
   224 def parselist(value):
   228 def parselist(value):
   225     """parse a configuration value as a list of comma/space separated strings
   229     """parse a configuration value as a list of comma/space separated strings