# HG changeset patch # User Martin von Zweigbergk # Date 1577384491 28800 # Node ID d8ea3c829477d54f001a7dd992808e4a0232fcbd # Parent 95af630d913a7b86a7962f03929f572b04458785 topic: make in-memory rebase preserve topic The override code thought that `__init__` would return the runtime instance, but it's actually the first argument to the function (the `self` argument), so the code had no effect at all before this patch. I think the bug only affected in-memory rebase because the in-working-copy rebase used the current topic, which was set correctly since 5156a67f66a6 (topics: update current topic to the topic of newly rebased commit (issue5551), 2017-06-29). diff -r 95af630d913a -r d8ea3c829477 hgext3rd/topic/__init__.py --- a/hgext3rd/topic/__init__.py Thu Dec 19 21:36:59 2019 -0800 +++ b/hgext3rd/topic/__init__.py Thu Dec 26 10:21:31 2019 -0800 @@ -1282,13 +1282,11 @@ source=b'topic-extension') return orig(ui, repo, **opts) - def new_init(orig, *args, **kwargs): - runtime = orig(*args, **kwargs) + def new_init(orig, self, *args, **kwargs): + orig(self, *args, **kwargs) - if util.safehasattr(runtime, 'extrafns'): - runtime.extrafns.append(savetopic) - - return runtime + if util.safehasattr(self, 'extrafns'): + self.extrafns.append(savetopic) try: rebase = extensions.find(b"rebase")