Mercurial > public > mercurial-scm > hg
diff mercurial/encoding.py @ 39818:24e493ec2229
py3: rename pycompat.getcwd() to encoding.getcwd() (API)
We need to avoid os.getcwdb() on Windows to avoid DeprecationWarnings, and we
need encoding.strtolocal() to encode the result of os.getcwd().
author | Matt Harbison <matt_harbison@yahoo.com> |
---|---|
date | Fri, 21 Sep 2018 19:48:23 -0400 |
parents | e7aa113b14f7 |
children | fb628c048d64 |
line wrap: on
line diff
--- a/mercurial/encoding.py Mon Sep 24 22:46:22 2018 -0400 +++ b/mercurial/encoding.py Fri Sep 21 19:48:23 2018 -0400 @@ -233,6 +233,13 @@ environ = dict((tolocal(k.encode(u'utf-8')), tolocal(v.encode(u'utf-8'))) for k, v in os.environ.items()) # re-exports +if pycompat.ispy3: + # os.getcwd() on Python 3 returns string, but it has os.getcwdb() which + # returns bytes. + getcwd = os.getcwdb # re-exports +else: + getcwd = os.getcwd # re-exports + # How to treat ambiguous-width characters. Set to 'wide' to treat as wide. _wide = _sysstr(environ.get("HGENCODINGAMBIGUOUS", "narrow") == "wide" and "WFA" or "WF")