changeset 4610:c54d4c2c2846

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.
author Martin von Zweigbergk <martinvonz@google.com>
date Fri, 19 Apr 2019 10:23:53 -0700
parents fe2999627556
children c3fb96f9c8de
files hgext3rd/evolve/evolvecmd.py
diffstat 1 files changed, 16 insertions(+), 17 deletions(-) [+]
line wrap: on
line diff
--- 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):