D4566: localrepo: load extensions in makelocalrepository()

indygreg (Gregory Szorc) phabricator at mercurial-scm.org
Tue Sep 18 17:59:56 EDT 2018


This revision was automatically updated to reflect the committed changes.
Closed by commit rHGe0c5017124b3: localrepo: load extensions in makelocalrepository() (authored by indygreg, committed by ).

REPOSITORY
  rHG Mercurial

CHANGES SINCE LAST UPDATE
  https://phab.mercurial-scm.org/D4566?vs=11004&id=11164

REVISION DETAIL
  https://phab.mercurial-scm.org/D4566

AFFECTED FILES
  mercurial/localrepo.py

CHANGE DETAILS

diff --git a/mercurial/localrepo.py b/mercurial/localrepo.py
--- a/mercurial/localrepo.py
+++ b/mercurial/localrepo.py
@@ -397,6 +397,16 @@
     hgpath = wdirvfs.join(b'.hg')
     hgvfs = vfsmod.vfs(hgpath, cacheaudited=True)
 
+    # The .hg/hgrc file may load extensions or contain config options
+    # that influence repository construction. Attempt to load it and
+    # process any new extensions that it may have pulled in.
+    try:
+        ui.readconfig(hgvfs.join(b'hgrc'), root=wdirvfs.base)
+    except IOError:
+        pass
+    else:
+        extensions.loadall(ui)
+
     return localrepository(
         baseui=baseui,
         ui=ui,
@@ -507,11 +517,6 @@
         # Callback are in the form: func(repo, roots) --> processed root.
         # This list it to be filled by extension during repo setup
         self._phasedefaults = []
-        try:
-            self.ui.readconfig(self.vfs.join("hgrc"), self.root)
-            self._loadextensions()
-        except IOError:
-            pass
 
         if featuresetupfuncs:
             self.supported = set(self._basesupported) # use private copy
@@ -675,9 +680,6 @@
     def close(self):
         self._writecaches()
 
-    def _loadextensions(self):
-        extensions.loadall(self.ui)
-
     def _writecaches(self):
         if self._revbranchcache:
             self._revbranchcache.write()



To: indygreg, #hg-reviewers
Cc: mercurial-devel


More information about the Mercurial-devel mailing list