Mercurial > hg > mercurial-crew-with-dirclash
diff mercurial/util.py @ 3099:c27d1e1798a3
Back out trusted hgrc change for now
Backed out changeset 494521a3f1425
author | Matt Mackall <mpm@selenic.com> |
---|---|
date | Fri, 15 Sep 2006 16:00:16 -0500 |
parents | 494521a3f142 |
children | cff3c58a5766 |
line wrap: on
line diff
--- a/mercurial/util.py +++ b/mercurial/util.py @@ -15,7 +15,7 @@ platform-specific details from the core. from i18n import gettext as _ from demandload import * demandload(globals(), "cStringIO errno getpass popen2 re shutil sys tempfile") -demandload(globals(), "os threading time pwd grp") +demandload(globals(), "os threading time") # used by parsedate defaultdateformats = ('%Y-%m-%d %H:%M:%S', '%Y-%m-%d %H:%M', @@ -509,38 +509,6 @@ def getuser(): raise Abort(_('user name not available - set USERNAME ' 'environment variable')) -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.""" - try: - # force an ImportError if there's no module pwd - getpwuid = pwd.getpwuid - if uid is None: - uid = os.getuid() - try: - return getpwuid(uid)[0] - except KeyError: - return str(uid) - except ImportError: - return None - -def groupname(gid=None): - """Return the name of the group with the given gid. - - If gid is None, return the name of the current group.""" - try: - # force an ImportError if there's no module grp - getgrgid = grp.getgrgid - if gid is None: - gid = os.getgid() - try: - return getgrgid(gid)[0] - except KeyError: - return str(gid) - except ImportError: - return None - # Platform specific variants if os.name == 'nt': demandload(globals(), "msvcrt")