Mercurial > hg-stable
changeset 23586:112f9c73a0e5
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.
author | Eric Sumner <ericsumner@fb.com> |
---|---|
date | Fri, 12 Dec 2014 12:31:41 -0800 |
parents | 94b25d71dd0f |
children | 8063901e56cd |
files | mercurial/bundle2.py |
diffstat | 1 files changed, 4 insertions(+), 7 deletions(-) [+] |
line wrap: on
line diff
--- a/mercurial/bundle2.py Fri Dec 12 11:26:56 2014 -0800 +++ b/mercurial/bundle2.py Fri Dec 12 12:31:41 2014 -0800 @@ -319,19 +319,16 @@ 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