evolve: drop nested locks and transactions
authorMartin von Zweigbergk <martinvonz@google.com>
Fri, 19 Apr 2019 10:23:53 -0700
changeset 4610 c54d4c2c2846
parent 4609 fe2999627556
child 4611 c3fb96f9c8de
evolve: drop nested locks and transactions All callers of _solveone() now take the locks and start the transactions, so there's no need to do that anymore.
hgext3rd/evolve/evolvecmd.py
--- a/hgext3rd/evolve/evolvecmd.py	Fri Apr 19 11:12:00 2019 -0700
+++ b/hgext3rd/evolve/evolvecmd.py	Fri Apr 19 10:23:53 2019 -0700
@@ -64,6 +64,8 @@
                  formed. newnode can be node, when resolution led to no new
                  commit. If bool is False, this is ".".
     """
+    tr = repo.currenttransaction()
+    assert tr is not None
     displayer = None
     if stacktmplt:
         displayer = compat.changesetdisplayer(ui, repo,
@@ -71,23 +73,20 @@
     else:
         displayer = compat.changesetdisplayer(ui, repo,
                                               {'template': shorttemplate})
-    with repo.wlock(), repo.lock():
-        tr = repo.transaction("evolve")
-        with util.acceptintervention(tr):
-            if 'orphan' == category:
-                result = _solveunstable(ui, repo, ctx, evolvestate, displayer,
-                                        dryrun, confirm, progresscb,
-                                        lastsolved=lastsolved)
-            elif 'phasedivergent' == category:
-                result = _solvephasedivergence(ui, repo, ctx, evolvestate,
-                                               displayer, dryrun, confirm,
-                                               progresscb)
-            elif 'contentdivergent' == category:
-                result = _solvedivergent(ui, repo, ctx, evolvestate, displayer,
-                                         dryrun, confirm, progresscb)
-            else:
-                assert False, "unknown trouble category: %s" % (category)
-            return result
+    if 'orphan' == category:
+        result = _solveunstable(ui, repo, ctx, evolvestate, displayer,
+                                dryrun, confirm, progresscb,
+                                lastsolved=lastsolved)
+    elif 'phasedivergent' == category:
+        result = _solvephasedivergence(ui, repo, ctx, evolvestate,
+                                       displayer, dryrun, confirm,
+                                       progresscb)
+    elif 'contentdivergent' == category:
+        result = _solvedivergent(ui, repo, ctx, evolvestate, displayer,
+                                 dryrun, confirm, progresscb)
+    else:
+        assert False, "unknown trouble category: %s" % (category)
+    return result
 
 def _solveunstable(ui, repo, orig, evolvestate, displayer, dryrun=False,
                    confirm=False, progresscb=None, lastsolved=None):