evolve: wrap setparents calls in begin/endparentchange
authorSiddharth Agarwal <sid0@fb.com>
Wed, 17 Sep 2014 13:38:24 -0700
changeset 1112 c3e23fbf7bd7
parent 1111 6328e005b6c8
child 1113 4b37588bee3b
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.
hgext/evolve.py
--- a/hgext/evolve.py	Thu Sep 04 09:06:18 2014 +0200
+++ b/hgext/evolve.py	Wed Sep 17 13:38:24 2014 -0700
@@ -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()