D11995: legacy-revlog: fix requirement computation when cloning legacy repo

marmoute (Pierre-Yves David) phabricator at mercurial-scm.org
Wed Jan 12 14:11:39 UTC 2022


marmoute created this revision.
Herald added a reviewer: hg-reviewers.
Herald added a subscriber: mercurial-patches.

REVISION SUMMARY
  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.

REPOSITORY
  rHG Mercurial

BRANCH
  default

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

AFFECTED FILES
  mercurial/localrepo.py

CHANGE DETAILS

diff --git a/mercurial/localrepo.py b/mercurial/localrepo.py
--- a/mercurial/localrepo.py
+++ b/mercurial/localrepo.py
@@ -3550,6 +3550,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:



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


More information about the Mercurial-devel mailing list