changeset 5005:e66ba12e5db3

evolve: remove obsolete backup of allowemptycommit config We stopped setting the config in 88601e1cd5d8 (evolve: create new commit while resolving content-divergence, 2018-04-23), so there's no need to back it up.
author Martin von Zweigbergk <martinvonz@google.com>
date Mon, 09 Dec 2019 10:43:04 -0800
parents dc43e62ea796
children 93014d9726d5
files hgext3rd/evolve/evolvecmd.py
diffstat 1 files changed, 50 insertions(+), 53 deletions(-) [+]
line wrap: on
line diff
--- a/hgext3rd/evolve/evolvecmd.py	Mon Dec 09 10:44:42 2019 -0800
+++ b/hgext3rd/evolve/evolvecmd.py	Mon Dec 09 10:43:04 2019 -0800
@@ -606,7 +606,6 @@
     # resume resolution
     if progresscb:
         progresscb()
-    emtpycommitallowed = repo.ui.backupconfig(b'ui', b'allowemptycommit')
     tr = repo.currenttransaction()
     assert tr is not None
     # whether to store the obsmarker in the evolvestate
@@ -634,66 +633,64 @@
             obsolete.createmarkers(repo, [(otherdiv, (publicdiv,))],
                                    operation=b'evolve')
             return (True, publicnode)
-    try:
-        with repo.dirstate.parentchange():
-            repo.dirstate.setparents(resparent, nodemod.nullid)
 
-        dirstatedance(repo, divergent, resparent, None)
+    with repo.dirstate.parentchange():
+        repo.dirstate.setparents(resparent, nodemod.nullid)
+
+    dirstatedance(repo, divergent, resparent, None)
 
-        # merge the branches
-        mergebranches(repo, divergent, other, base)
-        # merge the commit messages
-        desc = mergecommitmessages(ui, base.description(),
-                                   divergent.description(),
-                                   other.description())
-        user = utility.mergeusers(ui, base, divergent, other)
+    # merge the branches
+    mergebranches(repo, divergent, other, base)
+    # merge the commit messages
+    desc = mergecommitmessages(ui, base.description(),
+                               divergent.description(),
+                               other.description())
+    user = utility.mergeusers(ui, base, divergent, other)
 
-        mergehook(repo, base, divergent, other)
+    mergehook(repo, base, divergent, other)
 
-        date = divergent.date()
-        if other.date() != divergent.date():
-            basedate = base.date()
-            if other.date() == basedate:
-                date = divergent.date()
-            elif divergent.date() == basedate:
-                date = other.date()
-            else:
-                date = max(divergent.date(), other.date())
+    date = divergent.date()
+    if other.date() != divergent.date():
+        basedate = base.date()
+        if other.date() == basedate:
+            date = divergent.date()
+        elif divergent.date() == basedate:
+            date = other.date()
+        else:
+            date = max(divergent.date(), other.date())
 
-        # new node if any formed as the replacement
-        newnode = repo.commit(text=desc, user=user, date=date)
-        if newnode == divergent.node() or newnode is None:
-            # no changes
-            new = divergent
-            storemarker = True
-            repo.ui.status(_(b"nothing changed\n"))
-            hg.updaterepo(repo, divergent.rev(), False)
+    # new node if any formed as the replacement
+    newnode = repo.commit(text=desc, user=user, date=date)
+    if newnode == divergent.node() or newnode is None:
+        # no changes
+        new = divergent
+        storemarker = True
+        repo.ui.status(_(b"nothing changed\n"))
+        hg.updaterepo(repo, divergent.rev(), False)
+    else:
+        new = repo[newnode]
+        newnode = new.node()
+        hg.updaterepo(repo, new.rev(), False)
+        if haspubdiv and publicdiv == divergent:
+            bypassphase(repo, (divergent, new), operation=b'evolve')
         else:
-            new = repo[newnode]
-            newnode = new.node()
-            hg.updaterepo(repo, new.rev(), False)
-            if haspubdiv and publicdiv == divergent:
-                bypassphase(repo, (divergent, new), operation=b'evolve')
-            else:
-                obsolete.createmarkers(repo, [(divergent, (new,))],
-                                       operation=b'evolve')
+            obsolete.createmarkers(repo, [(divergent, (new,))],
+                                   operation=b'evolve')
 
-        # creating markers and moving phases post-resolution
-        if haspubdiv and publicdiv == other:
-            bypassphase(repo, (other, new), operation=b'evolve')
-        else:
-            obsolete.createmarkers(repo, [(other, (new,))], operation=b'evolve')
-        if storemarker:
-            # storing the marker in the evolvestate
-            # we just store the precursors and successor pair for now, we might
-            # want to store more data and serialize obsmarker in a better way in
-            # future
-            evolvestate[b'obsmarkers'].append((other.node(), new.node()))
+    # creating markers and moving phases post-resolution
+    if haspubdiv and publicdiv == other:
+        bypassphase(repo, (other, new), operation=b'evolve')
+    else:
+        obsolete.createmarkers(repo, [(other, (new,))], operation=b'evolve')
+    if storemarker:
+        # storing the marker in the evolvestate
+        # we just store the precursors and successor pair for now, we might
+        # want to store more data and serialize obsmarker in a better way in
+        # future
+        evolvestate[b'obsmarkers'].append((other.node(), new.node()))
 
-        phases.retractboundary(repo, tr, other.phase(), [new.node()])
-        return (True, newnode)
-    finally:
-        repo.ui.restoreconfig(emtpycommitallowed)
+    phases.retractboundary(repo, tr, other.phase(), [new.node()])
+    return (True, newnode)
 
 def warnmetadataloss(repo, local, other):
     """warn the user for the metadata being lost while resolving