Mercurial > public > mercurial-scm > hg-stable
diff mercurial/bundlecaches.py @ 53028:89ab2459f62a stable 6.9.3
stream-bundle: properly process requirements
When the manifest bundle constain some known requirement that does not affect
the stream clone, we used to crash. However since we know them and know they
don't affect the stream clone, we can ignore them.
Mozilla generated such buggy manifest bundle for a time which allowed us to
catch this error. The issue was not caught until 961900fbd67c (released in
6.9.2) as the requirements information were ignored for stream-v2 until then.
We fix the issue, refactor the code for robustness and adds more tests to better
catch this kind of issue in the future.
author | Pierre-Yves David <pierre-yves.david@octobus.net> |
---|---|
date | Wed, 05 Mar 2025 11:41:45 +0100 |
parents | 961900fbd67c |
children | e705fec4a03f |
line wrap: on
line diff
--- a/mercurial/bundlecaches.py Tue Feb 25 20:21:43 2025 -0500 +++ b/mercurial/bundlecaches.py Wed Mar 05 11:41:45 2025 +0100 @@ -323,11 +323,18 @@ # repo supports and error if the bundle isn't compatible. if b'requirements' in params: requirements = set(cast(bytes, params[b'requirements']).split(b',')) - missingreqs = requirements - requirementsmod.STREAM_FIXED_REQUIREMENTS - if missingreqs: + relevant_reqs = ( + requirements - requirementsmod.STREAM_IGNORABLE_REQUIREMENTS + ) + # avoid cycle (not great for pytype) + from . import localrepo + + supported_req = localrepo.gathersupportedrequirements(repo.ui) + missing_reqs = relevant_reqs - supported_req + if missing_reqs: raise error.UnsupportedBundleSpecification( _(b'missing support for repository features: %s') - % b', '.join(sorted(missingreqs)) + % b', '.join(sorted(missing_reqs)) ) # Compute contentopts based on the version