Mercurial > public > mercurial-scm > evolve
diff hgext3rd/topic/__init__.py @ 6117:a27bdd116761 stable
topic: wrap applychange from histedit to preserve topics
This should fix https://bz.mercurial-scm.org/show_bug.cgi?id=6550
author | Simon Sapin <simon.sapin@octobus.net> |
---|---|
date | Fri, 07 Jan 2022 17:52:34 +0100 |
parents | ee1097379752 |
children | 5d1bfde39b95 |
line wrap: on
line diff
--- a/hgext3rd/topic/__init__.py Fri Jan 07 17:18:47 2022 +0100 +++ b/hgext3rd/topic/__init__.py Fri Jan 07 17:52:34 2022 +0100 @@ -440,6 +440,15 @@ except (KeyError, AttributeError): pass + try: + histedit = extensions.find(b'histedit') + except KeyError: + pass + else: + # Make histedit preserve topics of edited commits + extensions.wrapfunction(histedit.histeditaction, 'applychange', + applychangewrap) + server.setupserver(ui) def reposetup(ui, repo): @@ -732,6 +741,19 @@ return orig(cl, manifest, files, desc, transaction, p1, p2, user, date=date, extra=extra, **kwargs) +def applychangewrap(orig, self): + orig(self) + repo = self.repo + rulectx = repo[self.node] + + topic = None + if util.safehasattr(rulectx, 'topic'): + topic = rulectx.topic() + + if topic: + _changecurrenttopic(repo, topic) + + # revset predicates are automatically registered at loading via this symbol revsetpredicate = topicrevset.revsetpredicate