Mercurial > evolve
changeset 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 | b0443b54160c |
children | 5d1bfde39b95 |
files | hgext3rd/topic/__init__.py tests/test-issue6550.t |
diffstat | 2 files changed, 25 insertions(+), 3 deletions(-) [+] |
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
--- a/tests/test-issue6550.t Fri Jan 07 17:18:47 2022 +0100 +++ b/tests/test-issue6550.t Fri Jan 07 17:52:34 2022 +0100 @@ -37,12 +37,12 @@ > pick 8a25a1549e46 B > EOF -Topics of B and C have incorrectly be set to topic1: +Topic of B and C is preserved $ hg glog - @ 4:3bf79df9dd38 [topic1] B (known-bad-output !) + @ 4:065a99df807b [topic2] B | - o 3:c51ea384abdd [topic1] C (known-bad-output !) + o 3:43dddca3e1d1 [topic2] C | o 0:c051488dac25 [topic1] A