# HG changeset patch # User Matt Harbison # Date 1675121111 18000 # Node ID 84680c003d449ae4387f8be479a7a6ab3a05eb9b # Parent 566f7dd563c19d3ca535c140fd1e41208fedf156 bundlerepo: enforce the requirements declared by the underlying repository Previously, `hg log -r 'bundle()' -R bundle.hg` was failing for me when run from source, complaining about an unknown parent, when the system installed `hg` didn't. Some debugging showed the index was 0 length. It turned out that I didn't have the C extensions compiled, which a simple `hg log -r .` was able to indicate. The problem being that the RequirementError got handled by RepoError, which uses an empty directory as a fallback to process the bundle. diff -r 566f7dd563c1 -r 84680c003d44 mercurial/bundlerepo.py --- a/mercurial/bundlerepo.py Sat Jan 28 18:26:28 2023 +0400 +++ b/mercurial/bundlerepo.py Mon Jan 30 18:25:11 2023 -0500 @@ -533,6 +533,8 @@ try: repo = localrepo.instance(ui, repopath, create=False) tempparent = None + except error.RequirementError: + raise # no fallback if the backing repo is unsupported except error.RepoError: tempparent = pycompat.mkdtemp() try: diff -r 566f7dd563c1 -r 84680c003d44 tests/test-requires.t --- a/tests/test-requires.t Sat Jan 28 18:26:28 2023 +0400 +++ b/tests/test-requires.t Mon Jan 30 18:25:11 2023 -0500 @@ -81,4 +81,14 @@ abort: required features are not supported in the destination: featuresetup-test [255] +Bundlerepo also enforces the underlying repo requirements + + $ hg --cwd supported bundle --all ../bundle.hg + 1 changesets found + $ echo outdoor-pool > push-dst/.hg/requires + $ hg --cwd push-dst log -R ../bundle.hg -T phases + abort: repository requires features unknown to this Mercurial: outdoor-pool + (see https://mercurial-scm.org/wiki/MissingRequirement for more information) + [255] + $ cd ..