# HG changeset patch # User Pierre-Yves David # Date 1555113239 -7200 # Node ID 4bddc2f7287905586045fde71e10cab9636f2180 # Parent 315f537627c116913d76095341150a980feda40a hgweb: move ismember from `hgweb.common` to `scmutil` To implement hidden access control for other protocol than http, we need code outside of hgweb to access this logic. diff -r 315f537627c1 -r 4bddc2f72879 mercurial/hgweb/common.py --- a/mercurial/hgweb/common.py Fri Apr 05 01:17:15 2019 +0200 +++ b/mercurial/hgweb/common.py Sat Apr 13 01:53:59 2019 +0200 @@ -21,6 +21,7 @@ from .. import ( encoding, pycompat, + scmutil, templater, util, ) @@ -39,15 +40,7 @@ HTTP_UNSUPPORTED_MEDIA_TYPE = 415 HTTP_SERVER_ERROR = 500 - -def ismember(ui, username, userlist): - """Check if username is a member of userlist. - - If userlist has a single '*' member, all users are considered members. - Can be overridden by extensions to provide more complex authorization - schemes. - """ - return userlist == [b'*'] or username in userlist +ismember = scmutil.ismember def hashiddenaccess(repo, req): diff -r 315f537627c1 -r 4bddc2f72879 mercurial/scmutil.py --- a/mercurial/scmutil.py Fri Apr 05 01:17:15 2019 +0200 +++ b/mercurial/scmutil.py Sat Apr 13 01:53:59 2019 +0200 @@ -2313,3 +2313,13 @@ mark, mark, ) + + +def ismember(ui, username, userlist): + """Check if username is a member of userlist. + + If userlist has a single '*' member, all users are considered members. + Can be overridden by extensions to provide more complex authorization + schemes. + """ + return userlist == [b'*'] or username in userlist