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