--- a/hgext3rd/topic/__init__.py Tue Jun 27 09:49:35 2017 +0200
+++ b/hgext3rd/topic/__init__.py Tue Jun 27 15:21:38 2017 +0200
@@ -163,6 +163,13 @@
extensions.wrapfunction(cmdutil, 'buildcommittext', committextwrap)
extensions.wrapfunction(merge, 'update', mergeupdatewrap)
+
+ try:
+ evolve = extensions.find('evolve')
+ extensions.wrapfunction(evolve, "presplitupdate", presplitupdatetopic)
+ except (KeyError, AttributeError):
+ pass
+
cmdutil.summaryhooks.add('topic', summaryhook)
@@ -524,3 +531,18 @@
cmdutil.extrapreimport.append('topic')
cmdutil.extrapreimportmap['topic'] = _importtopic
patch.patchheadermap.append(('EXP-Topic', 'topic'))
+
+## preserve topic during split
+
+def presplitupdatetopic(original, repo, ui, prev, ctx):
+ # Save topic of revision
+ topic = None
+ if util.safehasattr(ctx, 'topic'):
+ topic = ctx.topic()
+
+ # Update the working directory
+ original(repo, ui, prev, ctx)
+
+ # Restore the topic if need
+ if topic:
+ _changecurrenttopic(repo, topic)