evolve: use single transaction also when continuing
authorMartin von Zweigbergk <martinvonz@google.com>
Fri, 19 Apr 2019 10:22:25 -0700
changeset 4608 fe22c36b5563
parent 4607 d314deb12f08
child 4609 fe2999627556
evolve: use single transaction also when continuing
hgext3rd/evolve/evolvecmd.py
tests/test-evolve-progress.t
--- a/hgext3rd/evolve/evolvecmd.py	Fri Apr 19 09:41:39 2019 -0700
+++ b/hgext3rd/evolve/evolvecmd.py	Fri Apr 19 10:22:25 2019 -0700
@@ -1949,30 +1949,32 @@
         # 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
+        tr = repo.transaction("evolve")
+        with util.acceptintervention(tr):
+            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']
-                and curctx.node() not in evolvestate['skippedrevs']):
-                newnode = _solveone(ui, repo, curctx, evolvestate, False,
-                                    confirm, progresscb, category,
-                                    lastsolved=lastsolved,
-                                    stacktmplt=stacktmplt)
-                if newnode[0]:
-                    evolvestate['replacements'][curctx.node()] = newnode[1]
-                    lastsolved = newnode[1]
-                else:
-                    evolvestate['skippedrevs'].append(curctx.node())
-            seen += 1
+                # 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,
+                                        stacktmplt=stacktmplt)
+                    if newnode[0]:
+                        evolvestate['replacements'][curctx.node()] = newnode[1]
+                        lastsolved = newnode[1]
+                    else:
+                        evolvestate['skippedrevs'].append(curctx.node())
+                seen += 1
 
 def _continuecontentdivergent(ui, repo, evolvestate, progresscb):
     """function to continue the interrupted content-divergence resolution."""
--- a/tests/test-evolve-progress.t	Fri Apr 19 09:41:39 2019 -0700
+++ b/tests/test-evolve-progress.t	Fri Apr 19 10:22:25 2019 -0700
@@ -165,9 +165,6 @@
   b
   committing manifest
   committing changelog
-  updating the branch cache
-  obscache is out of date
-  invalid branchheads cache (served): tip differs
   move:[7] fourth
   hg rebase -r 385376d04062 -d b2de95304e32
   evolve: 3/3 changesets (100.00%)