evolve: make `hg evolve --continue` respect `--confirm`
authorPulkit Goyal <7895pulkit@gmail.com>
Sun, 28 Jan 2018 23:49:46 +0530
changeset 3493 4544067b831b
parent 3492 53cd61f7f9c9
child 3494 14cd04ff968e
evolve: make `hg evolve --continue` respect `--confirm` Previous patch added capability to `hg evolve --continue` to continue the rest of the stack, not just the current revision but that was missing respecting the `--confirm` flag which user passed earlier. This patch makes sure we respect the `--confirm` flag.
hgext3rd/evolve/evolvecmd.py
tests/test-evolve-continue.t
--- a/hgext3rd/evolve/evolvecmd.py	Wed Jan 24 13:20:18 2018 +0530
+++ b/hgext3rd/evolve/evolvecmd.py	Sun Jan 28 23:49:46 2018 +0530
@@ -1146,13 +1146,14 @@
                 obsolete.createmarkers(repo, [(ctx, (repo['.'],))])
             evolvestate['replacements'][ctx.node()] = node
             category = evolvestate['category']
+            confirm = evolvestate['confirm']
             unfi = repo.unfiltered()
             for rev in evolvestate['revs']:
                 # XXX: prevent this lookup by storing nodes instead of revnums
                 curctx = unfi[rev]
                 if curctx.node() not in evolvestate['replacements']:
                     newnode = _solveone(ui, repo, curctx, evolvestate, False,
-                                        False, progresscb, category)
+                                        confirm, progresscb, category)
                     if newnode[0]:
                         evolvestate['replacements'][curctx.node()] = newnode[1]
             evolvestate.delete()
@@ -1171,7 +1172,8 @@
     if targetcat == 'orphan':
         revs = _orderrevs(repo, revs)
 
-    stateopts = {'category': targetcat, 'replacements': {}, 'revs': revs}
+    stateopts = {'category': targetcat, 'replacements': {}, 'revs': revs,
+                 'confirm': confirmopt}
     evolvestate.addopts(stateopts)
     for rev in revs:
         curctx = repo[rev]
--- a/tests/test-evolve-continue.t	Wed Jan 24 13:20:18 2018 +0530
+++ b/tests/test-evolve-continue.t	Sun Jan 28 23:49:46 2018 +0530
@@ -320,10 +320,13 @@
 
 XXX: this should have asked for confirmation
 
-  $ hg evolve --continue
+  $ hg evolve --continue<<EOF
+  > y
+  > EOF
   evolving 19:981e615b14ca "added g"
   move:[20] added h
   atop:[22] added g
+  perform evolve? [Ny] y
 
   $ hg glog
   @  23:af6bd002a48d added h