Page MenuHomePhabricator

windows: continue looking at `%HOME%` for user config files with py3.8+

Authored by mharbison72 on Dec 9 2020, 11:28 PM.



The %HOME% variable is explicitly called out in hg help config as a location
that is consulted when reading user files, but python stopped looking at it
when expanding '~' in py3.8+.[1] Restore that old functionality by copying in
the old implementation (and simplifying it to just use bytes). It could be
simplfied further, since only '~' is passed, but I'm not sure yet if we need to
make this a generic utility function on Windows. There are other uses of
os.path.expanduser(), but this is the only case I know of that documents
%HOME% usage.

(The reason for removing it was that it typically isn't set, but it actually is
set in MSYS and PowerShell, and %HOME% and %USERPROFILE% are different in
MSYS. I could be convinced to just replace all uses with this as a general
utility, so we don't have to think too hard about BC.)


Diff Detail

rHG Mercurial
Automatic diff as part of commit; lint not applicable.
Automatic diff as part of commit; unit tests not applicable.

Event Timeline

mharbison72 created this revision.Dec 9 2020, 11:28 PM
pulkit accepted this revision.Dec 10 2020, 3:47 AM
This revision is now accepted and ready to land.Dec 10 2020, 3:47 AM