diff hgext3rd/topic/__init__.py @ 6423:b71d6235fa01 mercurial-5.9

test-compat: merge mercurial-6.0 into mercurial-5.9
author Anton Shestakov <av6@dwimlabs.net>
date Fri, 24 Feb 2023 19:44:10 +0400
parents faea18a26188 50c4ed02ac6d
children 96749dc32fa1
line wrap: on
line diff
--- a/hgext3rd/topic/__init__.py	Mon Feb 06 18:56:14 2023 +0400
+++ b/hgext3rd/topic/__init__.py	Fri Feb 24 19:44:10 2023 +0400
@@ -233,7 +233,7 @@
               b'log.topic': b'green_background',
               }
 
-__version__ = b'1.0.0.dev'
+__version__ = b'1.0.0.dev0'
 
 testedwith = b'4.8 4.9 5.0 5.1 5.2 5.3 5.4 5.5 5.6 5.7 5.8 5.9 6.0 6.1 6.2 6.3'
 minimumhgversion = b'4.8'
@@ -470,7 +470,7 @@
     try:
         evolve = extensions.find(b'evolve')
         extensions.wrapfunction(evolve.rewriteutil, "presplitupdate",
-                                presplitupdatetopic)
+                                wrappresplitupdate)
     except (KeyError, AttributeError):
         pass
 
@@ -786,25 +786,25 @@
 
 @templatekeyword(b'topic', requires={b'ctx'})
 def topickw(context, mapping):
-    """:topic: String. The topic of the changeset"""
+    """String. The topic of the changeset"""
     ctx = context.resource(mapping, b'ctx')
     return ctx.topic()
 
 @templatekeyword(b'topicidx', requires={b'ctx'})
 def topicidxkw(context, mapping):
-    """:topicidx: Integer. Index of the changeset as a stack alias"""
+    """Integer. Index of the changeset as a stack alias"""
     ctx = context.resource(mapping, b'ctx')
     return ctx.topicidx()
 
 @templatekeyword(b'topic_namespace', requires={b'ctx'})
 def topicnamespacekw(context, mapping):
-    """:topic_namespace: String. The topic namespace of the changeset"""
+    """String. The topic namespace of the changeset"""
     ctx = context.resource(mapping, b'ctx')
     return ctx.topic_namespace()
 
 @templatekeyword(b'fqbn', requires={b'ctx'})
 def fqbnkw(context, mapping):
-    """:fqbn: String. The branch//namespace/topic of the changeset"""
+    """String. The branch//namespace/topic of the changeset"""
     ctx = context.resource(mapping, b'ctx')
     return ctx.fqbn()
 
@@ -1604,9 +1604,12 @@
 
 ## preserve topic during split
 
-def presplitupdatetopic(original, repo, ui, prev, ctx):
+def wrappresplitupdate(original, repo, ui, prev, ctx):
     # Save topic of revision
+    tns = None
     topic = None
+    if util.safehasattr(ctx, 'topic_namespace'):
+        tns = ctx.topic_namespace()
     if util.safehasattr(ctx, 'topic'):
         topic = ctx.topic()
 
@@ -1614,6 +1617,8 @@
     original(repo, ui, prev, ctx)
 
     # Restore the topic if need
+    if tns:
+        _changecurrenttns(repo, tns)
     if topic:
         _changecurrenttopic(repo, topic)