evolve: run in a single transaction
authorMartin von Zweigbergk <martinvonz@google.com>
Fri, 19 Apr 2019 09:41:39 -0700
changeset 4607 d314deb12f08
parent 4606 6c3f4cfa582e
child 4608 fe22c36b5563
evolve: run in a single transaction This speeds up `hg evolve --all` of a stack of 24 commits in the hg repo from 11.5s to 3.7s (3x). As can be seen in the tests, it also avoid some warnings about transiently unstable commits.
CHANGELOG
hgext3rd/evolve/evolvecmd.py
tests/test-evolve-content-divergent-stack.t
tests/test-evolve-phase-divergence.t
tests/test-evolve-progress.t
tests/test-evolve-public-content-divergent-corner-cases.t
--- a/CHANGELOG	Fri Apr 19 10:01:32 2019 -0700
+++ b/CHANGELOG	Fri Apr 19 09:41:39 2019 -0700
@@ -11,6 +11,7 @@
   * evolve: drop compatibility with 4.4
   * evolve: reinstalled compatibility with narrow repositories,
   * evolve: use "unstable" instead of "troubled"
+  * evolve: run multiple stabilisation in the same transaction
 
 8.5.1 -- 2019-04-23
 -------------------
--- a/hgext3rd/evolve/evolvecmd.py	Fri Apr 19 10:01:32 2019 -0700
+++ b/hgext3rd/evolve/evolvecmd.py	Fri Apr 19 09:41:39 2019 -0700
@@ -1723,11 +1723,15 @@
         lastsolved = None
 
         activetopic = getattr(repo, 'currenttopic', '')
-        for rev in revs:
-            lastsolved = _solveonerev(ui, repo, rev, evolvestate, activetopic,
-                                      dryrunopt, confirmopt, progresscb,
-                                      targetcat, lastsolved)
-            seen += 1
+        with repo.wlock(), repo.lock():
+            tr = repo.transaction("evolve")
+            with util.acceptintervention(tr):
+                for rev in revs:
+                    lastsolved = _solveonerev(ui, repo, rev, evolvestate,
+                                              activetopic, dryrunopt,
+                                              confirmopt, progresscb,
+                                              targetcat, lastsolved)
+                    seen += 1
 
         if showprogress:
             compat.progress(ui, _('evolve'), None)
--- a/tests/test-evolve-content-divergent-stack.t	Fri Apr 19 10:01:32 2019 -0700
+++ b/tests/test-evolve-content-divergent-stack.t	Fri Apr 19 09:41:39 2019 -0700
@@ -145,7 +145,6 @@
   base: [1] added a
   merging "other" content-divergent changeset '82b74d5dc678'
   0 files updated, 0 files merged, 0 files removed, 0 files unresolved
-  6 new orphan changesets
   merge:[6] added b
   with: [10] added b
   base: [2] added b
@@ -322,7 +321,6 @@
   updating to "local" side of the conflict: c04ff147ef79
   merging "other" content-divergent changeset '186bdc2cdfa2'
   1 files updated, 0 files merged, 0 files removed, 0 files unresolved
-  6 new orphan changesets
   merge:[11] added b
   with: [6] added b
   base: [2] added b
--- a/tests/test-evolve-phase-divergence.t	Fri Apr 19 10:01:32 2019 -0700
+++ b/tests/test-evolve-phase-divergence.t	Fri Apr 19 09:41:39 2019 -0700
@@ -997,7 +997,6 @@
   recreate:[2] added m
   atop:[1] added m and n
   committed as 86419909e017
-  1 new orphan changesets
   recreate:[3] added n
   atop:[1] added m and n
   rebasing to destination parent: d3873e73d99e
@@ -1258,7 +1257,6 @@
   recreate:[2] added m
   atop:[1] added m and n
   committed as 86419909e017
-  1 new orphan changesets
   recreate:[4] added n
   atop:[1] added m and n
   rebasing to destination parent: d3873e73d99e
--- a/tests/test-evolve-progress.t	Fri Apr 19 10:01:32 2019 -0700
+++ b/tests/test-evolve-progress.t	Fri Apr 19 09:41:39 2019 -0700
@@ -38,8 +38,6 @@
   a
   committing manifest
   committing changelog
-  updating the branch cache
-  obscache is out of date
   evolve: 2/3 changesets (66.67%)
   move:[2] third
   hg rebase -r 769574b07a96 -d 5f16d91ecde0
@@ -56,8 +54,6 @@
   b
   committing manifest
   committing changelog
-  updating the branch cache
-  obscache is out of date
   evolve: 3/3 changesets (100.00%)
   move:[3] fourth
   hg rebase -r 22782fddc0ab -d 53c0008d98a0
--- a/tests/test-evolve-public-content-divergent-corner-cases.t	Fri Apr 19 10:01:32 2019 -0700
+++ b/tests/test-evolve-public-content-divergent-corner-cases.t	Fri Apr 19 09:41:39 2019 -0700
@@ -643,7 +643,6 @@
   merging "other" content-divergent changeset '0773642cfa95'
   0 files updated, 0 files merged, 0 files removed, 0 files unresolved
   content divergence resolution between c7d2d47c7240 (public) and 0773642cfa95 has same content as c7d2d47c7240, discarding 0773642cfa95
-  1 new orphan changesets
   merge:[8] c_F
   with: [10] c_F
   base: [6] c_F