changeset 4221:db70de7c1698

evolve: use stack template in --continue case also We use stack indexes (s#) in evolve msging when revs being evolved are in active topic. Before this patch we are not covering the --continue case. So this patch cover the same and use the stack indexes s# even when we continue an interrupted evolve. In this patch I used the same concept (to check if we should use s#) as we are using in cases other than `--continue`. Thanks to PYD for refactoring those lines. Changes in tests also reflects the expected behaviour.
author Sushil khanchi <sushilkhanchi97@gmail.com>
date Fri, 26 Oct 2018 12:54:40 +0530
parents 0e59b03afe0a
children 424b498aac00
files hgext3rd/evolve/evolvecmd.py tests/test-evolve-topic.t
diffstat 2 files changed, 17 insertions(+), 6 deletions(-) [+]
line wrap: on
line diff
--- a/hgext3rd/evolve/evolvecmd.py	Wed Oct 24 19:38:02 2018 +0530
+++ b/hgext3rd/evolve/evolvecmd.py	Fri Oct 26 12:54:40 2018 +0530
@@ -1747,14 +1747,25 @@
             # evolved to confirm that if atop msg should be suppressed to remove
             # redundancy
             lastsolved = None
+            activetopic = getattr(repo, 'currenttopic', '')
             for rev in evolvestate['revs']:
                 # XXX: prevent this lookup by storing nodes instead of revnums
                 curctx = unfi[rev]
+
+                # check if we can use stack template
+                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
+
                 if (curctx.node() not in evolvestate['replacements'] and
                     curctx.node() not in evolvestate['skippedrevs']):
                     newnode = _solveone(ui, repo, curctx, evolvestate, False,
                                         confirm, progresscb, category,
-                                        lastsolved=lastsolved)
+                                        lastsolved=lastsolved,
+                                        stacktmplt=stacktmplt)
                     if newnode[0]:
                         evolvestate['replacements'][curctx.node()] = newnode[1]
                         lastsolved = newnode[1]
--- a/tests/test-evolve-topic.t	Wed Oct 24 19:38:02 2018 +0530
+++ b/tests/test-evolve-topic.t	Fri Oct 26 12:54:40 2018 +0530
@@ -382,8 +382,8 @@
   0 files updated, 0 files merged, 1 files removed, 0 files unresolved
   [s3] add eee
 
-Test showing that currently stackaliases does not support --continue case
--------------------------------------------------------------------------
+Check stackaliases(s#) works with  --continue case also, while evolving:
+------------------------------------------------------------------------
   $ hg up 18
   switching to topic bar
   1 files updated, 0 files merged, 0 files removed, 0 files unresolved
@@ -437,7 +437,7 @@
   continue: hg evolve --continue
   $ hg evolve --continue
   evolving 23:7acd9ea5d677 "add hhh"
-  move:[24] add iii
-  atop:[28] add hhh
-  move:[25] add jjj
+  move:[s4] add iii
+  atop:[s3] add hhh
+  move:[s5] add jjj
   working directory is now at 119e4c126fb2