The description from conduit is a unicode.
Details
- Reviewers
- None
- Group Reviewers
hg-reviewers - Commits
- rHG0dce1297dd01: phabricator: convert description into local
Diff Detail
- Repository
- rHG Mercurial
- Lint
Automatic diff as part of commit; lint not applicable. - Unit
Automatic diff as part of commit; unit tests not applicable.
Event Timeline
newdesc = getdescfromdrev(drev)+ newdesc = encoding.unitolocal(newdesc)
Perhaps encoding stuff should be handled in getdescfromdrev() before
concatenating received data with bytes.
getdescfromdrev is also used in readpatch which call encoding.unitolocal after.
So it looks like it is designed to be converted after the call.
getdescfromdrev is also used in readpatch which call encoding.unitolocal after. So it looks like it is designed to be converted after the call.
Can you fix them all? A general guideline for Mercurial codebase is converting
unicodes to byte strings as early as possible.
I do not know enough the internal of the extensions to know if all other strings in readpatch need to be converted or not.
Yeah, if only there is a json.loadb function. That could replace json.loads at line 211. I guess it could be done by using a function that recursively convert strings.
That could replace json.loads at line 211. I guess it could be done by using a function that recursively convert strings.
Could be.
def _maybeunitolocal(u): if isinstance(u, pycompat.unicode): return encoding.unitolocal(u) return u pycompat.rapply(_maybeunitolocal, json.loads(...))
I've pushed this with no modification as it should fix a problem, thanks.
Further cleanups are welcome.