Mercurial > public > mercurial-scm > hg-stable
comparison mercurial/extensions.py @ 41071:28a4fb793ba1
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.
author | Matt Harbison <matt_harbison@yahoo.com> |
---|---|
date | Thu, 27 Dec 2018 21:46:03 -0500 |
parents | 6f2510b581a0 |
children | 38b7b45627a2 |
comparison
equal
deleted
inserted
replaced
41070:f2601cbce209 | 41071:28a4fb793ba1 |
---|---|
224 try: | 224 try: |
225 extsetup(ui) | 225 extsetup(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) |
232 msg = stringutil.forcebytestr(inst) | 234 msg = stringutil.forcebytestr(inst) |
233 ui.warn(_("*** failed to set up extension %s: %s\n") % (name, msg)) | 235 ui.warn(_("*** failed to set up extension %s: %s\n") % (name, msg)) |