diff hgext/evolve.py @ 1536:9afe9e0191a1

evolve: evolve --divergent failed when merge had nothing to do (issue4950) Before this patch, if the divergence resolution lead to an empty commit, the transaction would be rolled back and the divergence not resolved. This patch allows empty commits in that case. It is legitimate to end up with an empty commit in that case, for example when divergent commits differ over their commit messages.
author Laurent Charignon <lcharignon@fb.com>
date Tue, 17 Nov 2015 17:06:07 -0800
parents 48547b4c77de
children 425c0700aabd
line wrap: on
line diff
--- a/hgext/evolve.py	Tue Nov 17 20:25:15 2015 -0800
+++ b/hgext/evolve.py	Tue Nov 17 17:06:07 2015 -0800
@@ -2008,8 +2008,10 @@
 /!\ * hg kill -n Y W Z
 """)
     if progresscb: progresscb()
+    emtpycommitallowed = repo.ui.backupconfig('ui', 'allowemptycommit')
     tr = repo.transaction('stabilize-divergent')
     try:
+        repo.ui.setconfig('ui', 'allowemptycommit', True)
         repo.dirstate.beginparentchange()
         repo.dirstate.setparents(divergent.node(), node.nullid)
         repo.dirstate.endparentchange()
@@ -2024,6 +2026,7 @@
         phases.retractboundary(repo, tr, other.phase(), [new.node()])
         tr.close()
     finally:
+        repo.ui.restoreconfig(emtpycommitallowed)
         tr.release()
 
 def divergentdata(ctx):