changeset 46234:9804162a4053

localrepo: move storevfs calculation out of if statement In next patch, we will need this variable in else statement too. So, let's take it out. Differential Revision: https://phab.mercurial-scm.org/D9681
author Pulkit Goyal <7895pulkit@gmail.com>
date Wed, 06 Jan 2021 16:01:19 +0530
parents 172b294b6d65
children 0babe12ef35d
files mercurial/localrepo.py
diffstat 1 files changed, 5 insertions(+), 6 deletions(-) [+]
line wrap: on
line diff
--- a/mercurial/localrepo.py	Mon Jan 11 13:48:13 2021 +0100
+++ b/mercurial/localrepo.py	Wed Jan 06 16:01:19 2021 +0530
@@ -549,8 +549,13 @@
         requirementsmod.SHARED_REQUIREMENT in requirements
         or requirementsmod.RELATIVE_SHARED_REQUIREMENT in requirements
     )
+    storevfs = None
     if shared:
+        # This is a shared repo
         sharedvfs = _getsharedvfs(hgvfs, requirements)
+        storevfs = vfsmod.vfs(sharedvfs.join(b'store'))
+    else:
+        storevfs = vfsmod.vfs(hgvfs.join(b'store'))
 
     # if .hg/requires contains the sharesafe requirement, it means
     # there exists a `.hg/store/requires` too and we should read it
@@ -573,12 +578,6 @@
                 _(b"share source does not support exp-sharesafe requirement")
             )
 
-        if shared:
-            # This is a shared repo
-            storevfs = vfsmod.vfs(sharedvfs.join(b'store'))
-        else:
-            storevfs = vfsmod.vfs(hgvfs.join(b'store'))
-
         requirements |= _readrequires(storevfs, False)
     elif shared:
         sourcerequires = _readrequires(sharedvfs, False)