# HG changeset patch # User Augie Fackler # Date 2019-12-16 22:10:51 # Node ID 1b26cb044097514a62da742143dbe71a874442a6 # Parent d50b4ad1d4a5d08fe8065dfb9d23bac4609f9b0d 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 diff --git a/mercurial/windows.py b/mercurial/windows.py --- a/mercurial/windows.py +++ b/mercurial/windows.py @@ -8,6 +8,7 @@ from __future__ import absolute_import import errno +import getpass import msvcrt import os import re @@ -563,6 +564,8 @@ def username(uid=None): """Return the name of the user with the given uid. If uid is None, return the name of the current user.""" + if not uid: + return pycompat.fsencode(getpass.getuser()) return None