This is an archive of the discontinued Mercurial Phabricator instance.

ui: convert to/from Optional[bytes] to Optional[str] in password manager
ClosedPublic

Authored by durin42 on Oct 1 2017, 12:43 PM.

Details

Summary

This password manager proxy is roughly the right-looking layer to
convert between strings and bytes. Many of these arguments can be
None, so we have a helper method to make the conversion preserve Nones
without exploding.

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

durin42 created this revision.Oct 1 2017, 12:43 PM
yuja requested changes to this revision.Oct 2 2017, 5:38 AM
yuja added a subscriber: yuja.
yuja added inline comments.
mercurial/ui.py
141

Nit: no need to check if ispy3.

165

No idea how user and passwd are encoded, but encoding.strfromlocal() might
be better because strurl() can raise unicode exception if non-ascii string is passed.

This revision now requires changes to proceed.Oct 2 2017, 5:38 AM
durin42 added inline comments.Oct 2 2017, 5:45 AM
mercurial/ui.py
141

Experimentally not true: if I don't do the ispy3 check, tests fail.

165

I think the password can come from either a URL or explicit end-user input. I'll have to look more closely.

yuja added inline comments.Oct 2 2017, 11:48 AM
mercurial/ui.py
141

No idea why. strurl() should just return the input on Py2.

durin42 marked 3 inline comments as done.Oct 4 2017, 12:26 PM
durin42 updated this revision to Diff 2421.

Oddly, this is now working correctly for me. I'm baffled why it was broken previously.

yuja accepted this revision.Oct 5 2017, 9:42 AM

Queued, thanks.

This revision is now accepted and ready to land.Oct 5 2017, 9:42 AM
This revision was automatically updated to reflect the committed changes.