equal
deleted
inserted
replaced
449 requirements = set() |
449 requirements = set() |
450 |
450 |
451 # The .hg/hgrc file may load extensions or contain config options |
451 # The .hg/hgrc file may load extensions or contain config options |
452 # that influence repository construction. Attempt to load it and |
452 # that influence repository construction. Attempt to load it and |
453 # process any new extensions that it may have pulled in. |
453 # process any new extensions that it may have pulled in. |
454 try: |
454 if loadhgrc(ui, wdirvfs, hgvfs, requirements): |
455 ui.readconfig(hgvfs.join(b'hgrc'), root=wdirvfs.base) |
|
456 # Run this before extensions.loadall() so extensions can be |
|
457 # automatically enabled. |
|
458 afterhgrcload(ui, wdirvfs, hgvfs, requirements) |
455 afterhgrcload(ui, wdirvfs, hgvfs, requirements) |
459 except IOError: |
|
460 pass |
|
461 else: |
|
462 extensions.loadall(ui) |
456 extensions.loadall(ui) |
463 |
457 |
464 # Set of module names of extensions loaded for this repository. |
458 # Set of module names of extensions loaded for this repository. |
465 extensionmodulenames = {m.__name__ for n, m in extensions.extensions(ui)} |
459 extensionmodulenames = {m.__name__ for n, m in extensions.extensions(ui)} |
466 |
460 |
579 sharedpath=storebasepath, |
573 sharedpath=storebasepath, |
580 store=store, |
574 store=store, |
581 cachevfs=cachevfs, |
575 cachevfs=cachevfs, |
582 features=features, |
576 features=features, |
583 intents=intents) |
577 intents=intents) |
|
578 |
|
579 def loadhgrc(ui, wdirvfs, hgvfs, requirements): |
|
580 """Load hgrc files/content into a ui instance. |
|
581 |
|
582 This is called during repository opening to load any additional |
|
583 config files or settings relevant to the current repository. |
|
584 |
|
585 Returns a bool indicating whether any additional configs were loaded. |
|
586 |
|
587 Extensions should monkeypatch this function to modify how per-repo |
|
588 configs are loaded. For example, an extension may wish to pull in |
|
589 configs from alternate files or sources. |
|
590 """ |
|
591 try: |
|
592 ui.readconfig(hgvfs.join(b'hgrc'), root=wdirvfs.base) |
|
593 return True |
|
594 except IOError: |
|
595 return False |
584 |
596 |
585 def afterhgrcload(ui, wdirvfs, hgvfs, requirements): |
597 def afterhgrcload(ui, wdirvfs, hgvfs, requirements): |
586 """Perform additional actions after .hg/hgrc is loaded. |
598 """Perform additional actions after .hg/hgrc is loaded. |
587 |
599 |
588 This function is called during repository loading immediately after |
600 This function is called during repository loading immediately after |