# HG changeset patch # User Boris Feld # Date 1522325593 -7200 # Node ID 33b718191bc9796fd1d5b52de6a8463fa260091c # Parent 145dab8c60c9e79ae28f8f8b7be52e0a83b7cffe rebase: update the rebase wrapping to works with hg 4.6 Mercurial core commit bd0086bd3af4 removed _makeextrafn hence breaking our wrapping. Update the code to wrap rebaseruntime directly in a way that's compatible with hg 4.1+. diff -r 145dab8c60c9 -r 33b718191bc9 hgext3rd/topic/__init__.py --- a/hgext3rd/topic/__init__.py Fri Mar 23 12:44:06 2018 +0530 +++ b/hgext3rd/topic/__init__.py Thu Mar 29 14:13:13 2018 +0200 @@ -1178,17 +1178,22 @@ if ctx.topic(): extra[constants.extrakey] = ctx.topic() - def newmakeextrafn(orig, copiers): - return orig(copiers + [savetopic]) - def setrebaseconfig(orig, ui, repo, **opts): repo.ui.setconfig('experimental', 'topicrebase', 'yes', source='topic-extension') return orig(ui, repo, **opts) + def new_init(orig, *args, **kwargs): + runtime = orig(*args, **kwargs) + + if util.safehasattr(runtime, 'extrafns'): + runtime.extrafns.append(savetopic) + + return runtime + try: rebase = extensions.find("rebase") - extensions.wrapfunction(rebase, '_makeextrafn', newmakeextrafn) + extensions.wrapfunction(rebase.rebaseruntime, '__init__', new_init) # This exists to store in the config that rebase is running so that we can # update the topic according to rebase. This is a hack and should be removed # when we have better options.