Patchwork D11996: share-safe: add support for static-http repository

login
register
mail settings
Submitter phabricator
Date Jan. 12, 2022, 2:11 p.m.
Message ID <differential-rev-PHID-DREV-4xrnguo63dmybx3laazx-req@mercurial-scm.org>
Download mbox | patch
Permalink /patch/50319/
State New
Headers show

Comments

phabricator - Jan. 12, 2022, 2:11 p.m.
marmoute created this revision.
Herald added a reviewer: hg-reviewers.
Herald added a subscriber: mercurial-patches.

REVISION SUMMARY
  We need to read the second requirements file in the static-http case too. Otherwise, static-http would miss most of the requirements and misbehave.

REPOSITORY
  rHG Mercurial

BRANCH
  default

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

AFFECTED FILES
  mercurial/statichttprepo.py

CHANGE DETAILS




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

Patch

diff --git a/mercurial/statichttprepo.py b/mercurial/statichttprepo.py
--- a/mercurial/statichttprepo.py
+++ b/mercurial/statichttprepo.py
@@ -22,6 +22,7 @@ 
     namespaces,
     pathutil,
     pycompat,
+    requirements as requirementsmod,
     url,
     util,
     vfs as vfsmod,
@@ -197,6 +198,9 @@ 
                 # we do not care about empty old-style repositories here
                 msg = _(b"'%s' does not appear to be an hg repository") % path
                 raise error.RepoError(msg)
+        if requirementsmod.SHARESAFE_REQUIREMENT in requirements:
+            storevfs = vfsclass(self.vfs.join(b'store'))
+            requirements |= set(storevfs.read(b'requires').splitlines())
 
         supportedrequirements = localrepo.gathersupportedrequirements(ui)
         localrepo.ensurerequirementsrecognized(