Mercurial > hg-stable
diff mercurial/bundle2.py @ 21625:511f5fa63aa2
bundle2: enforce all parameters in a part to be handled
Once we picked a handler, we check that all mandatory parameter keys are
properly supported. If not we raise an exception.
We added a test for this case.
The code now fails for any part with unknown mandatory parameters. We will
ignore such errors for advisory parts in a later changeset.
author | Pierre-Yves David <pierre-yves.david@fb.com> |
---|---|
date | Tue, 27 May 2014 12:01:00 -0700 |
parents | d61066d787c8 |
children | 985d139c8e8f |
line wrap: on
line diff
--- a/mercurial/bundle2.py Wed May 28 11:40:07 2014 -0700 +++ b/mercurial/bundle2.py Tue May 27 12:01:00 2014 -0700 @@ -306,6 +306,12 @@ part.read() continue + unknownparams = part.mandatorykeys - handler.params + if unknownparams: + unknownparams = list(unknownparams) + unknownparams.sort() + raise error.BundleValueError(parttype=key, params=unknownparams) + # handler is called outside the above try block so that we don't # risk catching KeyErrors from anything other than the # parthandlermapping lookup (any KeyError raised by handler()