##// END OF EJS Templates
ui: refactor `readconfig()` into a form that can consume resources...
Matt Harbison -
r44482:5ac0e6f1 default
parent child Browse files
Show More
@@ -45,6 +45,7 b' from . import ('
45 45 from .utils import (
46 46 dateutil,
47 47 procutil,
48 resourceutil,
48 49 stringutil,
49 50 )
50 51
@@ -424,6 +425,20 b' class ui(object):'
424 425 )
425 426 return False
426 427
428 def read_resource_config(
429 self, name, root=None, trust=False, sections=None, remap=None
430 ):
431 try:
432 fp = resourceutil.open_resource(name[0], name[1])
433 except IOError:
434 if not sections: # ignore unless we were looking for something
435 return
436 raise
437
438 self._readconfig(
439 b'resource:%s.%s' % name, fp, root, trust, sections, remap
440 )
441
427 442 def readconfig(
428 443 self, filename, root=None, trust=False, sections=None, remap=None
429 444 ):
@@ -434,6 +449,11 b' class ui(object):'
434 449 return
435 450 raise
436 451
452 self._readconfig(filename, fp, root, trust, sections, remap)
453
454 def _readconfig(
455 self, filename, fp, root=None, trust=False, sections=None, remap=None
456 ):
437 457 with fp:
438 458 cfg = config.config()
439 459 trusted = sections or trust or self._trusted(fp, filename)
General Comments 0
You need to be logged in to leave comments. Login now