legacy-revlog: fix requirement computation when cloning legacy repo
authorPierre-Yves David <pierre-yves.david@octobus.net>
Tue, 11 Jan 2022 09:36:10 +0100
changeset 48667 fc80752dbb24
parent 48666 4c1135d15700
child 48668 4a9570e389b2
legacy-revlog: fix requirement computation when cloning legacy repo The oldest format of repository does not have requirements so we need to treat them differently when cloning such repository. The previous code had issue whenever we start using a working-copy-only requirements. The "legacy" format is signaled using an empty requirements list. If we add working-copy-only requirements to it, this is no longer empty, and no longer legacy. The new code fix this, and will get fully tested in a couple of changeset, once the share-safe become the default. Differential Revision: https://phab.mercurial-scm.org/D11995
mercurial/localrepo.py
--- a/mercurial/localrepo.py	Mon Jan 10 12:48:35 2022 +0100
+++ b/mercurial/localrepo.py	Tue Jan 11 09:36:10 2022 +0100
@@ -3543,6 +3543,10 @@
     depends on the configuration
     """
     target_requirements = set()
+    if not srcrepo.requirements:
+        # this is a legacy revlog "v0" repository, we cannot do anything fancy
+        # with it.
+        return target_requirements
     createopts = defaultcreateopts(ui, createopts=createopts)
     for r in newreporequirements(ui, createopts):
         if r in requirementsmod.WORKING_DIR_REQUIREMENTS: