Mercurial > public > mercurial-scm > hg
comparison mercurial/util.py @ 3551:3b07e223534b
Only read .hg/hgrc files from trusted users/groups
The list of trusted users and groups is specified in the [trusted]
section of a hgrc; the current user is always trusted; "*" can be
used to trust all users/groups.
Global hgrc files are always read.
On Windows (and other systems that don't have the pwd and grp modules),
all .hg/hgrc files are read.
This is essentially the same patch that was previously applied as
revision 494521a3f142.
author | Alexis S. L. Carvalho <alexis@cecm.usp.br> |
---|---|
date | Thu, 26 Oct 2006 19:25:44 +0200 |
parents | 8b55c0ba8048 |
children | eda9e7c9300d |
comparison
equal
deleted
inserted
replaced
3550:ef80b13df85a | 3551:3b07e223534b |
---|---|
517 try: | 517 try: |
518 return sys.getwindowsversion()[3] == 1 | 518 return sys.getwindowsversion()[3] == 1 |
519 except AttributeError: | 519 except AttributeError: |
520 return os.name == 'nt' and 'command' in os.environ.get('comspec', '') | 520 return os.name == 'nt' and 'command' in os.environ.get('comspec', '') |
521 | 521 |
522 def username(uid=None): | |
523 """Return the name of the user with the given uid. | |
524 | |
525 If uid is None, return the name of the current user.""" | |
526 try: | |
527 import pwd | |
528 if uid is None: | |
529 uid = os.getuid() | |
530 try: | |
531 return pwd.getpwuid(uid)[0] | |
532 except KeyError: | |
533 return str(uid) | |
534 except ImportError: | |
535 return None | |
536 | |
537 def groupname(gid=None): | |
538 """Return the name of the group with the given gid. | |
539 | |
540 If gid is None, return the name of the current group.""" | |
541 try: | |
542 import grp | |
543 if gid is None: | |
544 gid = os.getgid() | |
545 try: | |
546 return grp.getgrgid(gid)[0] | |
547 except KeyError: | |
548 return str(gid) | |
549 except ImportError: | |
550 return None | |
551 | |
522 # Platform specific variants | 552 # Platform specific variants |
523 if os.name == 'nt': | 553 if os.name == 'nt': |
524 demandload(globals(), "msvcrt") | 554 demandload(globals(), "msvcrt") |
525 nulldev = 'NUL:' | 555 nulldev = 'NUL:' |
526 | 556 |