Page MenuHomePhabricator

py3: use pycompat.fsencode to convert path to bytes
ClosedPublic

Authored by pulkit on May 20 2018, 8:24 AM.

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

pulkit created this revision.May 20 2018, 8:24 AM
indygreg accepted this revision.May 21 2018, 2:24 PM
This revision is now accepted and ready to land.May 21 2018, 2:24 PM
This revision was automatically updated to reflect the committed changes.
yuja added a subscriber: yuja.May 22 2018, 7:20 AM
  • a/contrib/hg-ssh

+++ b/contrib/hg-ssh
@@ -39,6 +39,7 @@
from mercurial import (

dispatch,

+ pycompat,

ui as uimod,

)
@@ -69,7 +70,7 @@

path = cmdargv[2]
repo = os.path.normpath(os.path.join(cwd, os.path.expanduser(path)))
if repo in allowed_paths:
  • cmd = [b'-R', repo, b'serve', b'--stdio']

+ cmd = [b'-R', pycompat.fsencode(repo), b'serve', b'--stdio']

It's probably better to convert sys.argv and cwd to bytes. Otherwise we'll
have to be a human type checker.