changeset 48465:7964a2dbde12

share: move the requirement initialisation code around We will make this logic more flexible in the next patch. We start by moving it at the end of the function without any other change for clarity. Differential Revision: https://phab.mercurial-scm.org/D11891
author Pierre-Yves David <pierre-yves.david@octobus.net>
date Tue, 07 Dec 2021 14:51:45 +0100
parents 5e6542143d40
children bf2738e03e96
files mercurial/localrepo.py
diffstat 1 files changed, 11 insertions(+), 10 deletions(-) [+]
line wrap: on
line diff
--- a/mercurial/localrepo.py	Wed Dec 08 05:35:32 2021 +0100
+++ b/mercurial/localrepo.py	Tue Dec 07 14:51:45 2021 +0100
@@ -3566,16 +3566,6 @@
     Extensions can wrap this function to specify custom requirements for
     new repositories.
     """
-    # If the repo is being created from a shared repository, we copy
-    # its requirements.
-    if b'sharedrepo' in createopts:
-        requirements = set(createopts[b'sharedrepo'].requirements)
-        if createopts.get(b'sharedrelative'):
-            requirements.add(requirementsmod.RELATIVE_SHARED_REQUIREMENT)
-        else:
-            requirements.add(requirementsmod.SHARED_REQUIREMENT)
-
-        return requirements
 
     if b'backend' not in createopts:
         raise error.ProgrammingError(
@@ -3671,6 +3661,17 @@
     if ui.configbool(b'format', b'use-share-safe'):
         requirements.add(requirementsmod.SHARESAFE_REQUIREMENT)
 
+    # If the repo is being created from a shared repository, we copy
+    # its requirements.
+    if b'sharedrepo' in createopts:
+        requirements = set(createopts[b'sharedrepo'].requirements)
+        if createopts.get(b'sharedrelative'):
+            requirements.add(requirementsmod.RELATIVE_SHARED_REQUIREMENT)
+        else:
+            requirements.add(requirementsmod.SHARED_REQUIREMENT)
+
+        return requirements
+
     return requirements