Patchwork D9681: localrepo: move storevfs calculation out of if statement

login
register
mail settings
Submitter phabricator
Date Jan. 6, 2021, 1:24 p.m.
Message ID <differential-rev-PHID-DREV-6t6yxvtyrfywu2ivog23-req@mercurial-scm.org>
Download mbox | patch
Permalink /patch/47992/
State Superseded
Headers show

Comments

phabricator - Jan. 6, 2021, 1:24 p.m.
pulkit created this revision.
Herald added a reviewer: hg-reviewers.
Herald added a subscriber: mercurial-patches.

REVISION SUMMARY
  In next patch, we will need this variable in else statement too. So, let's take
  it out.

REPOSITORY
  rHG Mercurial

BRANCH
  default

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

AFFECTED FILES
  mercurial/localrepo.py

CHANGE DETAILS




To: pulkit, #hg-reviewers
Cc: mercurial-patches, mercurial-devel

Patch

diff --git a/mercurial/localrepo.py b/mercurial/localrepo.py
--- a/mercurial/localrepo.py
+++ b/mercurial/localrepo.py
@@ -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)