Mercurial > hg
comparison mercurial/windows.py @ 43904:1b26cb044097
windows: if username(uid=None) is loaded, just use getpass
This is at least consistent with what we do on other platforms in the
base case. I don't know enough about Windows to fill in other cases
that might exist here, but this at least should be a start.
Differential Revision: https://phab.mercurial-scm.org/D7679
author | Augie Fackler <augie@google.com> |
---|---|
date | Mon, 16 Dec 2019 17:10:51 -0500 |
parents | be8552f25cab |
children | 70abcb614a5c |
comparison
equal
deleted
inserted
replaced
43903:d50b4ad1d4a5 | 43904:1b26cb044097 |
---|---|
6 # GNU General Public License version 2 or any later version. | 6 # GNU General Public License version 2 or any later version. |
7 | 7 |
8 from __future__ import absolute_import | 8 from __future__ import absolute_import |
9 | 9 |
10 import errno | 10 import errno |
11 import getpass | |
11 import msvcrt | 12 import msvcrt |
12 import os | 13 import os |
13 import re | 14 import re |
14 import stat | 15 import stat |
15 import string | 16 import string |
561 | 562 |
562 def username(uid=None): | 563 def username(uid=None): |
563 """Return the name of the user with the given uid. | 564 """Return the name of the user with the given uid. |
564 | 565 |
565 If uid is None, return the name of the current user.""" | 566 If uid is None, return the name of the current user.""" |
567 if not uid: | |
568 return pycompat.fsencode(getpass.getuser()) | |
566 return None | 569 return None |
567 | 570 |
568 | 571 |
569 def groupname(gid=None): | 572 def groupname(gid=None): |
570 """Return the name of the group with the given gid. | 573 """Return the name of the group with the given gid. |