Mercurial > hg > mercurial-crew-with-dirclash
diff mercurial/util.py @ 3721:98f2507c5551
only print a warning when no username is specified
- revert most of 8b55c0ba
- display the username during interactive commit
author | Benoit Boissinot <benoit.boissinot@ens-lyon.org> |
---|---|
date | Tue, 28 Nov 2006 21:16:05 +0100 |
parents | 1a0fa3914c46 |
children | 1861fa38a6a7 |
line wrap: on
line diff
--- a/mercurial/util.py +++ b/mercurial/util.py @@ -535,6 +535,20 @@ def is_win_9x(): except AttributeError: return os.name == 'nt' and 'command' in os.environ.get('comspec', '') +getuser_fallback = None + +def getuser(): + '''return name of current user''' + try: + return getpass.getuser() + except ImportError: + # import of pwd will fail on windows - try fallback + if getuser_fallback: + return getuser_fallback() + # raised if win32api not available + raise Abort(_('user name not available - set USERNAME ' + 'environment variable')) + def username(uid=None): """Return the name of the user with the given uid.