evolve: check if we should use stack template for each item in the stack stable
authorPierre-Yves David <pierre-yves.david@octobus.net>
Thu, 25 Oct 2018 18:08:34 +0200
branchstable
changeset 4209 aa9f33078157
parent 4201 46cef25fbd96
child 4210 470ba668687a
evolve: check if we should use stack template for each item in the stack We should probably just track the current topic and move all the logic in the template itself. However, this is a good first step.
hgext3rd/evolve/evolvecmd.py
--- a/hgext3rd/evolve/evolvecmd.py	Thu Oct 25 10:01:58 2018 +0200
+++ b/hgext3rd/evolve/evolvecmd.py	Thu Oct 25 18:08:34 2018 +0200
@@ -1583,15 +1583,13 @@
         # check if revs to be evolved are in active topic to make sure that we
         # can use stack aliases s# in evolve msgs.
         activetopic = getattr(repo, 'currenttopic', '')
-        rev = revs[0]
-        revtopic = getattr(repo[rev], 'topic', '')
-        if revtopic:
-            revtopic = revtopic()
-        stacktmplt = False
-        if activetopic and revtopic and (activetopic == revtopic):
-            stacktmplt = True
         for rev in revs:
             curctx = repo[rev]
+            revtopic = getattr(curctx, 'topic', lambda: '')()
+            topicidx = getattr(curctx, 'topicidx', lambda: None)()
+            stacktmplt = False
+            if activetopic and (activetopic == revtopic) and topicidx is not None:
+                stacktmplt = True
             progresscb()
             ret = _solveone(ui, repo, curctx, evolvestate, dryrunopt,
                             confirmopt, progresscb, targetcat,