# HG changeset patch # User Matt Harbison # Date 1545965163 18000 # Node ID 28a4fb793ba1bd828192c2e2097fc214fc2d5abc # Parent f2601cbce20985b91db64665d96397b5b81f0303 extensions: deprecate extsetup without a `ui` argument (API) 9.5 years should be enough time, but there were some tests for the old style still (which are now updated). Exthelper doesn't fallback to the old API, so this is for consistency. .. api:: The extension hook ``extsetup`` without a `ui` argument has been deprecated, and will be removed in the next version. Add a `ui` argument to avoid the deprecation warning. diff -r f2601cbce209 -r 28a4fb793ba1 hgext/highlight/__init__.py --- a/hgext/highlight/__init__.py Thu Dec 27 21:27:43 2018 -0500 +++ b/hgext/highlight/__init__.py Thu Dec 27 21:46:03 2018 -0500 @@ -87,7 +87,7 @@ ])) return web.res.sendresponse() -def extsetup(): +def extsetup(ui): # monkeypatch in the new version extensions.wrapfunction(webcommands, '_filerevision', filerevision_highlight) diff -r f2601cbce209 -r 28a4fb793ba1 mercurial/extensions.py --- a/mercurial/extensions.py Thu Dec 27 21:27:43 2018 -0500 +++ b/mercurial/extensions.py Thu Dec 27 21:46:03 2018 -0500 @@ -226,6 +226,8 @@ 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 -r f2601cbce209 -r 28a4fb793ba1 tests/notcapable --- a/tests/notcapable Thu Dec 27 21:27:43 2018 -0500 +++ b/tests/notcapable Thu Dec 27 21:46:03 2018 -0500 @@ -7,7 +7,7 @@ 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 -r f2601cbce209 -r 28a4fb793ba1 tests/test-dirstate-race.t --- a/tests/test-dirstate-race.t Thu Dec 27 21:27:43 2018 -0500 +++ b/tests/test-dirstate-race.t Thu Dec 27 21:46:03 2018 -0500 @@ -53,7 +53,7 @@ > 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 -r f2601cbce209 -r 28a4fb793ba1 tests/test-extension.t --- a/tests/test-extension.t Thu Dec 27 21:27:43 2018 -0500 +++ b/tests/test-extension.t Thu Dec 27 21:46:03 2018 -0500 @@ -279,7 +279,7 @@ > 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 @@ > 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 -r f2601cbce209 -r 28a4fb793ba1 tests/test-http-bundle1.t --- a/tests/test-http-bundle1.t Thu Dec 27 21:27:43 2018 -0500 +++ b/tests/test-http-bundle1.t Thu Dec 27 21:46:03 2018 -0500 @@ -186,7 +186,7 @@ > 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 -r f2601cbce209 -r 28a4fb793ba1 tests/test-http.t --- a/tests/test-http.t Thu Dec 27 21:27:43 2018 -0500 +++ b/tests/test-http.t Thu Dec 27 21:46:03 2018 -0500 @@ -181,7 +181,7 @@ > [(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 @@ > 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 -r f2601cbce209 -r 28a4fb793ba1 tests/test-largefiles-wireproto.t --- a/tests/test-largefiles-wireproto.t Thu Dec 27 21:27:43 2018 -0500 +++ b/tests/test-largefiles-wireproto.t Thu Dec 27 21:46:03 2018 -0500 @@ -430,7 +430,7 @@ > [(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 -r f2601cbce209 -r 28a4fb793ba1 tests/test-lfs-serve-access.t --- a/tests/test-lfs-serve-access.t Thu Dec 27 21:27:43 2018 -0500 +++ b/tests/test-lfs-serve-access.t Thu Dec 27 21:46:03 2018 -0500 @@ -404,7 +404,7 @@ > 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