##// END OF EJS Templates
config: use level to properly deal with value priority...
marmoute -
r47368:b91a695b default
parent child Browse files
Show More
@@ -662,11 +662,18 b' class ui(object):'
662 msg %= (section, name, pycompat.bytestr(default))
662 msg %= (section, name, pycompat.bytestr(default))
663 self.develwarn(msg, 2, b'warn-config-default')
663 self.develwarn(msg, 2, b'warn-config-default')
664
664
665 candidates = []
666 config = self._data(untrusted)
665 for s, n in alternates:
667 for s, n in alternates:
666 candidate = self._data(untrusted).get(s, n, None)
668 candidate = config.get(s, n, None)
667 if candidate is not None:
669 if candidate is not None:
668 value = candidate
670 candidates.append((s, n, candidate))
669 break
671 if candidates:
672
673 def level(x):
674 return config.level(x[0], x[1])
675
676 value = max(candidates, key=level)[2]
670
677
671 if self.debugflag and not untrusted and self._reportuntrusted:
678 if self.debugflag and not untrusted and self._reportuntrusted:
672 for s, n in alternates:
679 for s, n in alternates:
@@ -476,15 +476,12 b' being true if the config have other alia'
476 earlier will be considered "lower level" and the config read later would be
476 earlier will be considered "lower level" and the config read later would be
477 considered "higher level". And higher level values wins.
477 considered "higher level". And higher level values wins.
478
478
479 BROKEN: currently not the case.
480
481 $ HGRCPATH="file-A.rc" hg log -r .
479 $ HGRCPATH="file-A.rc" hg log -r .
482 value-A
480 value-A
483 $ HGRCPATH="file-B.rc" hg log -r .
481 $ HGRCPATH="file-B.rc" hg log -r .
484 value-B
482 value-B
485 $ HGRCPATH="file-A.rc:file-B.rc" hg log -r .
483 $ HGRCPATH="file-A.rc:file-B.rc" hg log -r .
486 value-A (known-bad-output !)
484 value-B
487 value-B (missing-correct-output !)
488
485
489 Alias and include
486 Alias and include
490 -----------------
487 -----------------
@@ -493,15 +490,12 b' The pre/post include priority should als'
493 See the case above for details about the two config options used.
490 See the case above for details about the two config options used.
494
491
495 $ HGRCPATH="file-C.rc" hg log -r .
492 $ HGRCPATH="file-C.rc" hg log -r .
496 value-included (known-bad-output !)
493 value-C
497 value-C (missing-correct-output !)
498 $ HGRCPATH="file-D.rc" hg log -r .
494 $ HGRCPATH="file-D.rc" hg log -r .
499 value-D (known-bad-output !)
495 value-included
500 value-included (missing-correct-output !)
501
496
502 command line override
497 command line override
503 ---------------------
498 ---------------------
504
499
505 $ HGRCPATH="file-A.rc:file-B.rc" hg log -r . --config ui.logtemplate="value-CLI\n"
500 $ HGRCPATH="file-A.rc:file-B.rc" hg log -r . --config ui.logtemplate="value-CLI\n"
506 value-A (known-bad-output !)
501 value-CLI
507 value-CLI (missing-correct-output !)
General Comments 0
You need to be logged in to leave comments. Login now