[PATCH] evolve: wrap setparents calls in begin/endparentchange

Siddharth Agarwal sid0 at fb.com
Wed Sep 17 15:39:07 CDT 2014


# HG changeset patch
# User Siddharth Agarwal <sid0 at fb.com>
# Date 1410986304 25200
#      Wed Sep 17 13:38:24 2014 -0700
# Node ID c3e23fbf7bd71300f19522d583ab8fe50916b7f7
# Parent  6328e005b6c8f3f080bae829417ec195827165fb
evolve: wrap setparents calls in begin/endparentchange

Mercurial rev d259322a394b added a requirement to wrap any dirstate.setparents
calls and their associated dirstate changes in begin/endparentchange.

diff --git a/hgext/evolve.py b/hgext/evolve.py
--- a/hgext/evolve.py
+++ b/hgext/evolve.py
@@ -1451,7 +1451,9 @@
     finally:
         tr.release()
     # reroute the working copy parent to the new changeset
+    repo.dirstate.beginparentchange()
     repo.dirstate.setparents(newid, node.nullid)
+    repo.dirstate.endparentchange()
 
 def _solvedivergent(ui, repo, divergent, dryrun=False, confirm=False,
                     progresscb=None):
@@ -1539,7 +1541,9 @@
     if progresscb: progresscb()
     tr = repo.transaction('stabilize-divergent')
     try:
+        repo.dirstate.beginparentchange()
         repo.dirstate.setparents(divergent.node(), node.nullid)
+        repo.dirstate.endparentchange()
         oldlen = len(repo)
         amend(ui, repo, message='', logfile='')
         if oldlen == len(repo):
@@ -1988,8 +1992,10 @@
         # Move local changes on filtered changeset
         obsolete.createmarkers(repo, [(old, (repo[newid],))])
         phases.retractboundary(repo, tr, oldphase, [newid])
+        repo.dirstate.beginparentchange()
         repo.dirstate.setparents(newid, node.nullid)
         _uncommitdirstate(repo, old, match)
+        repo.dirstate.endparentchange()
         updatebookmarks(newid)
         if not repo[newid].files():
             ui.warn(_("new changeset is empty\n"))
@@ -2075,7 +2081,9 @@
                     obsolete.createmarkers(repo, [(ctx, (repo[new],))])
                 phases.retractboundary(repo, tr, ctx.phase(), [new])
                 if ctx in repo[None].parents():
+                    repo.dirstate.beginparentchange()
                     repo.dirstate.setparents(new, node.nullid)
+                    repo.dirstate.endparentchange()
             tr.close()
         finally:
             tr.release()


More information about the Mercurial-devel mailing list