diff --git a/hgext/highlight/__init__.py b/hgext/highlight/__init__.py --- a/hgext/highlight/__init__.py +++ b/hgext/highlight/__init__.py @@ -87,7 +87,7 @@ def generate_css(web): ])) return web.res.sendresponse() -def extsetup(): +def extsetup(ui): # monkeypatch in the new version extensions.wrapfunction(webcommands, '_filerevision', filerevision_highlight) diff --git a/mercurial/extensions.py b/mercurial/extensions.py --- a/mercurial/extensions.py +++ b/mercurial/extensions.py @@ -226,6 +226,8 @@ def _runextsetup(name, ui): except TypeError: if pycompat.getargspec(extsetup).args: raise + ui.deprecwarn("extsetup for '%s' must take a ui argument" + % name, "4.9") extsetup() # old extsetup with no ui argument except Exception as inst: ui.traceback(force=True) diff --git a/tests/notcapable b/tests/notcapable --- a/tests/notcapable +++ b/tests/notcapable @@ -7,7 +7,7 @@ fi cat > notcapable-$CAP.py << EOF from mercurial import extensions, localrepo, repository -def extsetup(): +def extsetup(ui): extensions.wrapfunction(repository.peer, 'capable', wrapcapable) extensions.wrapfunction(localrepo.localrepository, 'peer', wrappeer) def wrapcapable(orig, self, name, *args, **kwargs): diff --git a/tests/test-dirstate-race.t b/tests/test-dirstate-race.t --- a/tests/test-dirstate-race.t +++ b/tests/test-dirstate-race.t @@ -53,7 +53,7 @@ confused with a file with the exec bit s > context, > extensions, > ) - > def extsetup(): + > def extsetup(ui): > extensions.wrapfunction(context.workingctx, '_checklookup', overridechecklookup) > def overridechecklookup(orig, self, files): > # make an update that changes the dirstate from underneath diff --git a/tests/test-extension.t b/tests/test-extension.t --- a/tests/test-extension.t +++ b/tests/test-extension.t @@ -279,7 +279,7 @@ limit mark, regardless of importing modu > NO_CHECK_EOF $ cat > loadabs.py < import mod.ambigabs as ambigabs - > def extsetup(): + > def extsetup(ui): > print('ambigabs.s=%s' % ambigabs.s, flush=True) > NO_CHECK_EOF $ "$PYTHON" $TESTTMP/unflush.py loadabs.py @@ -295,7 +295,7 @@ limit mark, regardless of importing modu > NO_CHECK_EOF $ cat > loadrel.py < import mod.ambigrel as ambigrel - > def extsetup(): + > def extsetup(ui): > print('ambigrel.s=%s' % ambigrel.s, flush=True) > NO_CHECK_EOF $ "$PYTHON" $TESTTMP/unflush.py loadrel.py diff --git a/tests/test-http-bundle1.t b/tests/test-http-bundle1.t --- a/tests/test-http-bundle1.t +++ b/tests/test-http-bundle1.t @@ -186,7 +186,7 @@ test http authentication > if base64.b64decode(auth.split()[1]).split(b':', 1) != [b'user', > b'pass']: > raise common.ErrorResponse(common.HTTP_FORBIDDEN, b'no') - > def extsetup(): + > def extsetup(ui): > common.permhooks.insert(0, perform_authentication) > EOT $ hg serve --config extensions.x=userpass.py -p $HGPORT2 -d --pid-file=pid \ diff --git a/tests/test-http.t b/tests/test-http.t --- a/tests/test-http.t +++ b/tests/test-http.t @@ -181,7 +181,7 @@ test http authentication > [(b'WWW-Authenticate', b'Basic Realm="mercurial"')]) > if base64.b64decode(auth.split()[1]).split(b':', 1) != [b'user', b'pass']: > raise common.ErrorResponse(common.HTTP_FORBIDDEN, b'no') - > def extsetup(): + > def extsetup(ui): > common.permhooks.insert(0, perform_authentication) > EOT $ hg serve --config extensions.x=userpass.py -p $HGPORT2 -d --pid-file=pid \ @@ -526,7 +526,7 @@ We raise HTTP 500 because its message is > if not cookie: > raise common.ErrorResponse(common.HTTP_SERVER_ERROR, b'no-cookie') > raise common.ErrorResponse(common.HTTP_SERVER_ERROR, b'Cookie: %s' % cookie) - > def extsetup(): + > def extsetup(ui): > common.permhooks.insert(0, perform_authentication) > EOF diff --git a/tests/test-largefiles-wireproto.t b/tests/test-largefiles-wireproto.t --- a/tests/test-largefiles-wireproto.t +++ b/tests/test-largefiles-wireproto.t @@ -430,7 +430,7 @@ a large file from the server rather than > [(b'WWW-Authenticate', b'Basic Realm="mercurial"')]) > if base64.b64decode(auth.split()[1]).split(b':', 1) != [b'user', b'pass']: > raise common.ErrorResponse(common.HTTP_FORBIDDEN, b'no') - > def extsetup(): + > def extsetup(ui): > common.permhooks.insert(0, perform_authentication) > EOT $ hg serve --config extensions.x=userpass.py -R credentialmain \ diff --git a/tests/test-lfs-serve-access.t b/tests/test-lfs-serve-access.t --- a/tests/test-lfs-serve-access.t +++ b/tests/test-lfs-serve-access.t @@ -404,7 +404,7 @@ the GET/PUT request. > if base64.b64decode(auth.split()[1]).split(b':', 1) != [b'user', > b'pass']: > raise common.ErrorResponse(common.HTTP_FORBIDDEN, b'no') - > def extsetup(): + > def extsetup(ui): > common.permhooks.insert(0, perform_authentication) > EOF