##// END OF EJS Templates
extensions: deprecate extsetup without a `ui` argument (API)...
Matt Harbison -
r41098:28a4fb79 default
parent child Browse files
Show More
@@ -87,7 +87,7 b' def generate_css(web):'
87 ]))
87 ]))
88 return web.res.sendresponse()
88 return web.res.sendresponse()
89
89
90 def extsetup():
90 def extsetup(ui):
91 # monkeypatch in the new version
91 # monkeypatch in the new version
92 extensions.wrapfunction(webcommands, '_filerevision',
92 extensions.wrapfunction(webcommands, '_filerevision',
93 filerevision_highlight)
93 filerevision_highlight)
@@ -226,6 +226,8 b' def _runextsetup(name, ui):'
226 except TypeError:
226 except TypeError:
227 if pycompat.getargspec(extsetup).args:
227 if pycompat.getargspec(extsetup).args:
228 raise
228 raise
229 ui.deprecwarn("extsetup for '%s' must take a ui argument"
230 % name, "4.9")
229 extsetup() # old extsetup with no ui argument
231 extsetup() # old extsetup with no ui argument
230 except Exception as inst:
232 except Exception as inst:
231 ui.traceback(force=True)
233 ui.traceback(force=True)
@@ -7,7 +7,7 b' fi'
7
7
8 cat > notcapable-$CAP.py << EOF
8 cat > notcapable-$CAP.py << EOF
9 from mercurial import extensions, localrepo, repository
9 from mercurial import extensions, localrepo, repository
10 def extsetup():
10 def extsetup(ui):
11 extensions.wrapfunction(repository.peer, 'capable', wrapcapable)
11 extensions.wrapfunction(repository.peer, 'capable', wrapcapable)
12 extensions.wrapfunction(localrepo.localrepository, 'peer', wrappeer)
12 extensions.wrapfunction(localrepo.localrepository, 'peer', wrappeer)
13 def wrapcapable(orig, self, name, *args, **kwargs):
13 def wrapcapable(orig, self, name, *args, **kwargs):
@@ -53,7 +53,7 b' confused with a file with the exec bit s'
53 > context,
53 > context,
54 > extensions,
54 > extensions,
55 > )
55 > )
56 > def extsetup():
56 > def extsetup(ui):
57 > extensions.wrapfunction(context.workingctx, '_checklookup', overridechecklookup)
57 > extensions.wrapfunction(context.workingctx, '_checklookup', overridechecklookup)
58 > def overridechecklookup(orig, self, files):
58 > def overridechecklookup(orig, self, files):
59 > # make an update that changes the dirstate from underneath
59 > # make an update that changes the dirstate from underneath
@@ -279,7 +279,7 b' limit mark, regardless of importing modu'
279 > NO_CHECK_EOF
279 > NO_CHECK_EOF
280 $ cat > loadabs.py <<NO_CHECK_EOF
280 $ cat > loadabs.py <<NO_CHECK_EOF
281 > import mod.ambigabs as ambigabs
281 > import mod.ambigabs as ambigabs
282 > def extsetup():
282 > def extsetup(ui):
283 > print('ambigabs.s=%s' % ambigabs.s, flush=True)
283 > print('ambigabs.s=%s' % ambigabs.s, flush=True)
284 > NO_CHECK_EOF
284 > NO_CHECK_EOF
285 $ "$PYTHON" $TESTTMP/unflush.py loadabs.py
285 $ "$PYTHON" $TESTTMP/unflush.py loadabs.py
@@ -295,7 +295,7 b' limit mark, regardless of importing modu'
295 > NO_CHECK_EOF
295 > NO_CHECK_EOF
296 $ cat > loadrel.py <<NO_CHECK_EOF
296 $ cat > loadrel.py <<NO_CHECK_EOF
297 > import mod.ambigrel as ambigrel
297 > import mod.ambigrel as ambigrel
298 > def extsetup():
298 > def extsetup(ui):
299 > print('ambigrel.s=%s' % ambigrel.s, flush=True)
299 > print('ambigrel.s=%s' % ambigrel.s, flush=True)
300 > NO_CHECK_EOF
300 > NO_CHECK_EOF
301 $ "$PYTHON" $TESTTMP/unflush.py loadrel.py
301 $ "$PYTHON" $TESTTMP/unflush.py loadrel.py
@@ -186,7 +186,7 b' test http authentication'
186 > if base64.b64decode(auth.split()[1]).split(b':', 1) != [b'user',
186 > if base64.b64decode(auth.split()[1]).split(b':', 1) != [b'user',
187 > b'pass']:
187 > b'pass']:
188 > raise common.ErrorResponse(common.HTTP_FORBIDDEN, b'no')
188 > raise common.ErrorResponse(common.HTTP_FORBIDDEN, b'no')
189 > def extsetup():
189 > def extsetup(ui):
190 > common.permhooks.insert(0, perform_authentication)
190 > common.permhooks.insert(0, perform_authentication)
191 > EOT
191 > EOT
192 $ hg serve --config extensions.x=userpass.py -p $HGPORT2 -d --pid-file=pid \
192 $ hg serve --config extensions.x=userpass.py -p $HGPORT2 -d --pid-file=pid \
@@ -181,7 +181,7 b' test http authentication'
181 > [(b'WWW-Authenticate', b'Basic Realm="mercurial"')])
181 > [(b'WWW-Authenticate', b'Basic Realm="mercurial"')])
182 > if base64.b64decode(auth.split()[1]).split(b':', 1) != [b'user', b'pass']:
182 > if base64.b64decode(auth.split()[1]).split(b':', 1) != [b'user', b'pass']:
183 > raise common.ErrorResponse(common.HTTP_FORBIDDEN, b'no')
183 > raise common.ErrorResponse(common.HTTP_FORBIDDEN, b'no')
184 > def extsetup():
184 > def extsetup(ui):
185 > common.permhooks.insert(0, perform_authentication)
185 > common.permhooks.insert(0, perform_authentication)
186 > EOT
186 > EOT
187 $ hg serve --config extensions.x=userpass.py -p $HGPORT2 -d --pid-file=pid \
187 $ hg serve --config extensions.x=userpass.py -p $HGPORT2 -d --pid-file=pid \
@@ -526,7 +526,7 b' We raise HTTP 500 because its message is'
526 > if not cookie:
526 > if not cookie:
527 > raise common.ErrorResponse(common.HTTP_SERVER_ERROR, b'no-cookie')
527 > raise common.ErrorResponse(common.HTTP_SERVER_ERROR, b'no-cookie')
528 > raise common.ErrorResponse(common.HTTP_SERVER_ERROR, b'Cookie: %s' % cookie)
528 > raise common.ErrorResponse(common.HTTP_SERVER_ERROR, b'Cookie: %s' % cookie)
529 > def extsetup():
529 > def extsetup(ui):
530 > common.permhooks.insert(0, perform_authentication)
530 > common.permhooks.insert(0, perform_authentication)
531 > EOF
531 > EOF
532
532
@@ -430,7 +430,7 b' a large file from the server rather than'
430 > [(b'WWW-Authenticate', b'Basic Realm="mercurial"')])
430 > [(b'WWW-Authenticate', b'Basic Realm="mercurial"')])
431 > if base64.b64decode(auth.split()[1]).split(b':', 1) != [b'user', b'pass']:
431 > if base64.b64decode(auth.split()[1]).split(b':', 1) != [b'user', b'pass']:
432 > raise common.ErrorResponse(common.HTTP_FORBIDDEN, b'no')
432 > raise common.ErrorResponse(common.HTTP_FORBIDDEN, b'no')
433 > def extsetup():
433 > def extsetup(ui):
434 > common.permhooks.insert(0, perform_authentication)
434 > common.permhooks.insert(0, perform_authentication)
435 > EOT
435 > EOT
436 $ hg serve --config extensions.x=userpass.py -R credentialmain \
436 $ hg serve --config extensions.x=userpass.py -R credentialmain \
@@ -404,7 +404,7 b' the GET/PUT request.'
404 > if base64.b64decode(auth.split()[1]).split(b':', 1) != [b'user',
404 > if base64.b64decode(auth.split()[1]).split(b':', 1) != [b'user',
405 > b'pass']:
405 > b'pass']:
406 > raise common.ErrorResponse(common.HTTP_FORBIDDEN, b'no')
406 > raise common.ErrorResponse(common.HTTP_FORBIDDEN, b'no')
407 > def extsetup():
407 > def extsetup(ui):
408 > common.permhooks.insert(0, perform_authentication)
408 > common.permhooks.insert(0, perform_authentication)
409 > EOF
409 > EOF
410
410
General Comments 0
You need to be logged in to leave comments. Login now