comparison mercurial/config.py @ 45256:83ca8d6f3206

config: re-calculate absolute %include path in `include` callback This removes the last user of the `abs` argument for the `include` callback. The next patch will remove the argument. Differential Revision: https://phab.mercurial-scm.org/D8795
author Martin von Zweigbergk <martinvonz@google.com>
date Wed, 22 Jul 2020 10:32:28 -0700
parents 3f54242781e9
children 668af67bfd18
comparison
equal deleted inserted replaced
45255:0323972f78f3 45256:83ca8d6f3206
211 assert getattr(fp, 'mode', 'rb') == 'rb', ( 211 assert getattr(fp, 'mode', 'rb') == 'rb', (
212 b'config files must be opened in binary mode, got fp=%r mode=%r' 212 b'config files must be opened in binary mode, got fp=%r mode=%r'
213 % (fp, fp.mode,) 213 % (fp, fp.mode,)
214 ) 214 )
215 215
216 dir = os.path.dirname(path)
217
216 def include(rel, abs, remap, sections): 218 def include(rel, abs, remap, sections):
219 abs = os.path.normpath(os.path.join(dir, rel))
217 self.read(abs, remap=remap, sections=sections) 220 self.read(abs, remap=remap, sections=sections)
218 221
219 self.parse( 222 self.parse(
220 path, fp.read(), sections=sections, remap=remap, include=include 223 path, fp.read(), sections=sections, remap=remap, include=include
221 ) 224 )