comparison mercurial/extensions.py @ 42335:38b7b45627a2

extensions: drop support for extsetup() without `ui` argument (API)
author Matt Harbison <matt_harbison@yahoo.com>
date Sat, 18 May 2019 19:33:48 -0400
parents 28a4fb793ba1
children 6a3872e34503
comparison
equal deleted inserted replaced
42334:bcb1a2b6cd00 42335:38b7b45627a2
219 219
220 def _runextsetup(name, ui): 220 def _runextsetup(name, ui):
221 extsetup = getattr(_extensions[name], 'extsetup', None) 221 extsetup = getattr(_extensions[name], 'extsetup', None)
222 if extsetup: 222 if extsetup:
223 try: 223 try:
224 try: 224 extsetup(ui)
225 extsetup(ui)
226 except TypeError:
227 if pycompat.getargspec(extsetup).args:
228 raise
229 ui.deprecwarn("extsetup for '%s' must take a ui argument"
230 % name, "4.9")
231 extsetup() # old extsetup with no ui argument
232 except Exception as inst: 225 except Exception as inst:
233 ui.traceback(force=True) 226 ui.traceback(force=True)
234 msg = stringutil.forcebytestr(inst) 227 msg = stringutil.forcebytestr(inst)
235 ui.warn(_("*** failed to set up extension %s: %s\n") % (name, msg)) 228 ui.warn(_("*** failed to set up extension %s: %s\n") % (name, msg))
236 return False 229 return False