# HG changeset patch # User Eric Sumner # Date 2014-12-12 20:31:41 # Node ID 112f9c73a0e5a3df0ddb6a59c7f530dbecc499c2 # Parent 94b25d71dd0f32a408ec12264ea3fe6b9ca63ff1 bundle2._processpart: forcing lower-case compare is no longer necessary Encoding whether or not a part is mandatory in the capitalization of the parttype is unintuitive and error-prone. This sequence of patches separates these concerns in the API to reduce programmer error and pave the way for a potential change in how this information is transmitted over the wire. Since the parttype and mandatory bit are separated in bundle2.unbundlepart (see previous patch), there is no longer a need to remove the mandatory bit before working with the parttype. diff --git a/mercurial/bundle2.py b/mercurial/bundle2.py --- a/mercurial/bundle2.py +++ b/mercurial/bundle2.py @@ -319,19 +319,16 @@ def _processpart(op, part): The part is guaranteed to have been fully consumed when the function exits (even if an exception is raised).""" try: - parttype = part.type - # part key are matched lower case - key = parttype.lower() try: - handler = parthandlermapping.get(key) + handler = parthandlermapping.get(part.type) if handler is None: - raise error.UnsupportedPartError(parttype=key) - op.ui.debug('found a handler for part %r\n' % parttype) + raise error.UnsupportedPartError(parttype=part.type) + op.ui.debug('found a handler for part %r\n' % part.type) unknownparams = part.mandatorykeys - handler.params if unknownparams: unknownparams = list(unknownparams) unknownparams.sort() - raise error.UnsupportedPartError(parttype=key, + raise error.UnsupportedPartError(parttype=part.type, params=unknownparams) except error.UnsupportedPartError, exc: if part.mandatory: # mandatory parts