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

login
register
mail settings
Submitter phabricator
Date Jan. 12, 2022, 2:11 p.m.
Message ID <differential-rev-PHID-DREV-cjhfxvtfjrjckyumfj6e-req@mercurial-scm.org>
Download mbox | patch
Permalink /patch/50321/
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
  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




To: marmoute, #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
@@ -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: