##// END OF EJS Templates
templater: simplify merge of __base__ dicts by reading it first
Yuya Nishihara -
r34713:56f08533 default
parent child Browse files
Show More
@@ -1344,15 +1344,9 b' def _readmapfile(mapfile):'
1344
1344
1345 cache = {}
1345 cache = {}
1346 tmap = {}
1346 tmap = {}
1347 for key, val in conf[''].items():
1347
1348 if not val:
1348 val = conf.get('', '__base__')
1349 raise error.ParseError(_('missing value'), conf.source('', key))
1349 if val and val[0] not in "'\"":
1350 if val[0] in "'\"":
1351 if val[0] != val[-1]:
1352 raise error.ParseError(_('unmatched quotes'),
1353 conf.source('', key))
1354 cache[key] = unquotestring(val)
1355 elif key == "__base__":
1356 # treat as a pointer to a base class for this style
1350 # treat as a pointer to a base class for this style
1357 path = util.normpath(os.path.join(base, val))
1351 path = util.normpath(os.path.join(base, val))
1358
1352
@@ -1368,14 +1362,17 b' def _readmapfile(mapfile):'
1368 path = p3
1362 path = p3
1369 break
1363 break
1370
1364
1371 bcache, btmap = _readmapfile(path)
1365 cache, tmap = _readmapfile(path)
1372 for k in bcache:
1366
1373 if k not in cache:
1367 for key, val in conf[''].items():
1374 cache[k] = bcache[k]
1368 if not val:
1375 for k in btmap:
1369 raise error.ParseError(_('missing value'), conf.source('', key))
1376 if k not in tmap:
1370 if val[0] in "'\"":
1377 tmap[k] = btmap[k]
1371 if val[0] != val[-1]:
1378 else:
1372 raise error.ParseError(_('unmatched quotes'),
1373 conf.source('', key))
1374 cache[key] = unquotestring(val)
1375 elif key != '__base__':
1379 val = 'default', val
1376 val = 'default', val
1380 if ':' in val[1]:
1377 if ':' in val[1]:
1381 val = val[1].split(':', 1)
1378 val = val[1].split(':', 1)
General Comments 0
You need to be logged in to leave comments. Login now