Patchwork [08,of,10] localrepo: move sharedpath to baselocalrepository

login
register
mail settings
Submitter Jun Wu
Date Feb. 10, 2017, 1:46 a.m.
Message ID <e042a694438fc4b35edc.1486691182@localhost.localdomain>
Download mbox | patch
Permalink /patch/18384/
State Deferred
Headers show

Comments

Jun Wu - Feb. 10, 2017, 1:46 a.m.
# HG changeset patch
# User Jun Wu <quark@fb.com>
# Date 1486689360 28800
#      Thu Feb 09 17:16:00 2017 -0800
# Node ID e042a694438fc4b35edcdcda99a4b6c4a0ce5bf2
# Parent  400747616e74d8af7ea053692e861d2495e56d78
# Available At https://bitbucket.org/quark-zju/hg-draft
#              hg pull https://bitbucket.org/quark-zju/hg-draft -r e042a694438f
localrepo: move sharedpath to baselocalrepository

See previous patches for why.

Patch

diff --git a/mercurial/localrepo.py b/mercurial/localrepo.py
--- a/mercurial/localrepo.py
+++ b/mercurial/localrepo.py
@@ -274,4 +274,17 @@  class baselocalrepository(object):
         self.requirements = self._loadrequirements(create)
 
+        self.sharedpath = self.path
+        try:
+            vfs = scmutil.vfs(self.vfs.read("sharedpath").rstrip('\n'),
+                              realpath=True)
+            s = vfs.base
+            if not vfs.exists():
+                raise error.RepoError(
+                    _('.hg/sharedpath points to nonexistent directory %s') % s)
+            self.sharedpath = s
+        except IOError as inst:
+            if inst.errno != errno.ENOENT:
+                raise
+
     def _loadextensions(self):
         # baselocalrepository is side-effect free, so "loading extensions" is a
@@ -321,17 +334,4 @@  class localrepository(baselocalrepositor
                                                 realfs=False)
 
-        self.sharedpath = self.path
-        try:
-            vfs = scmutil.vfs(self.vfs.read("sharedpath").rstrip('\n'),
-                              realpath=True)
-            s = vfs.base
-            if not vfs.exists():
-                raise error.RepoError(
-                    _('.hg/sharedpath points to nonexistent directory %s') % s)
-            self.sharedpath = s
-        except IOError as inst:
-            if inst.errno != errno.ENOENT:
-                raise
-
         self.store = store.store(
                 self.requirements, self.sharedpath, scmutil.vfs)