# HG changeset patch # User Patrick Mezard # Date 1273518588 -7200 # Node ID 99eee847beaab95d134eb425cd1c45b6df2d8a60 # Parent 94afe7bc87a9cedd770c16fbf904c7d1bdb880c4 acl: grp module is not available on windows diff -r 94afe7bc87a9 -r 99eee847beaa hgext/acl.py --- a/hgext/acl.py Sun May 09 22:51:25 2010 +0200 +++ b/hgext/acl.py Mon May 10 21:09:48 2010 +0200 @@ -150,7 +150,7 @@ from mercurial.i18n import _ from mercurial import util, match -import getpass, urllib, grp +import getpass, urllib def _getusers(ui, group): @@ -161,7 +161,7 @@ ui.debug('acl: "%s" not defined in [acl.groups]\n' % group) # If no users found in group definition, get users from OS-level group - return grp.getgrnam(group).gr_mem + return util.groupmembers(group) def _usermatch(ui, user, usersorgroups): diff -r 94afe7bc87a9 -r 99eee847beaa mercurial/posix.py --- a/mercurial/posix.py Sun May 09 22:51:25 2010 +0200 +++ b/mercurial/posix.py Mon May 10 21:09:48 2010 +0200 @@ -259,6 +259,12 @@ except KeyError: return str(gid) +def groupmembers(name): + """Return the list of members of the group with the given + name, KeyError if the group does not exist. + """ + return list(grp.getgrnam(name).gr_mem) + def spawndetached(args): return os.spawnvp(os.P_NOWAIT | getattr(os, 'P_DETACH', 0), args[0], args) diff -r 94afe7bc87a9 -r 99eee847beaa mercurial/windows.py --- a/mercurial/windows.py Sun May 09 22:51:25 2010 +0200 +++ b/mercurial/windows.py Mon May 10 21:09:48 2010 +0200 @@ -363,6 +363,10 @@ # current line but on the new one. Keep room for it. return 79 +def groupmembers(name): + # Don't support groups on Windows for now + raise KeyError() + try: # override functions with win32 versions if possible from win32 import *