comparison hgext/evolve.py @ 1112:c3e23fbf7bd7

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.
author Siddharth Agarwal <sid0@fb.com>
date Wed, 17 Sep 2014 13:38:24 -0700
parents 6328e005b6c8
children d4977b04ef98
comparison
equal deleted inserted replaced
1111:6328e005b6c8 1112:c3e23fbf7bd7
1449 tr.close() 1449 tr.close()
1450 repo.ui.status(_('committed as %s\n') % node.short(newid)) 1450 repo.ui.status(_('committed as %s\n') % node.short(newid))
1451 finally: 1451 finally:
1452 tr.release() 1452 tr.release()
1453 # reroute the working copy parent to the new changeset 1453 # reroute the working copy parent to the new changeset
1454 repo.dirstate.beginparentchange()
1454 repo.dirstate.setparents(newid, node.nullid) 1455 repo.dirstate.setparents(newid, node.nullid)
1456 repo.dirstate.endparentchange()
1455 1457
1456 def _solvedivergent(ui, repo, divergent, dryrun=False, confirm=False, 1458 def _solvedivergent(ui, repo, divergent, dryrun=False, confirm=False,
1457 progresscb=None): 1459 progresscb=None):
1458 base, others = divergentdata(divergent) 1460 base, others = divergentdata(divergent)
1459 if len(others) > 1: 1461 if len(others) > 1:
1537 /!\ * hg kill -n Y W Z 1539 /!\ * hg kill -n Y W Z
1538 """) 1540 """)
1539 if progresscb: progresscb() 1541 if progresscb: progresscb()
1540 tr = repo.transaction('stabilize-divergent') 1542 tr = repo.transaction('stabilize-divergent')
1541 try: 1543 try:
1544 repo.dirstate.beginparentchange()
1542 repo.dirstate.setparents(divergent.node(), node.nullid) 1545 repo.dirstate.setparents(divergent.node(), node.nullid)
1546 repo.dirstate.endparentchange()
1543 oldlen = len(repo) 1547 oldlen = len(repo)
1544 amend(ui, repo, message='', logfile='') 1548 amend(ui, repo, message='', logfile='')
1545 if oldlen == len(repo): 1549 if oldlen == len(repo):
1546 new = divergent 1550 new = divergent
1547 # no changes 1551 # no changes
1986 raise util.Abort(_('nothing to uncommit'), 1990 raise util.Abort(_('nothing to uncommit'),
1987 hint=_("use --all to uncommit all files")) 1991 hint=_("use --all to uncommit all files"))
1988 # Move local changes on filtered changeset 1992 # Move local changes on filtered changeset
1989 obsolete.createmarkers(repo, [(old, (repo[newid],))]) 1993 obsolete.createmarkers(repo, [(old, (repo[newid],))])
1990 phases.retractboundary(repo, tr, oldphase, [newid]) 1994 phases.retractboundary(repo, tr, oldphase, [newid])
1995 repo.dirstate.beginparentchange()
1991 repo.dirstate.setparents(newid, node.nullid) 1996 repo.dirstate.setparents(newid, node.nullid)
1992 _uncommitdirstate(repo, old, match) 1997 _uncommitdirstate(repo, old, match)
1998 repo.dirstate.endparentchange()
1993 updatebookmarks(newid) 1999 updatebookmarks(newid)
1994 if not repo[newid].files(): 2000 if not repo[newid].files():
1995 ui.warn(_("new changeset is empty\n")) 2001 ui.warn(_("new changeset is empty\n"))
1996 ui.status(_('(use "hg prune ." to remove it)\n')) 2002 ui.status(_('(use "hg prune ." to remove it)\n'))
1997 tr.close() 2003 tr.close()
2073 newmapping[ctx.node()] = new 2079 newmapping[ctx.node()] = new
2074 if not duplicate: 2080 if not duplicate:
2075 obsolete.createmarkers(repo, [(ctx, (repo[new],))]) 2081 obsolete.createmarkers(repo, [(ctx, (repo[new],))])
2076 phases.retractboundary(repo, tr, ctx.phase(), [new]) 2082 phases.retractboundary(repo, tr, ctx.phase(), [new])
2077 if ctx in repo[None].parents(): 2083 if ctx in repo[None].parents():
2084 repo.dirstate.beginparentchange()
2078 repo.dirstate.setparents(new, node.nullid) 2085 repo.dirstate.setparents(new, node.nullid)
2086 repo.dirstate.endparentchange()
2079 tr.close() 2087 tr.close()
2080 finally: 2088 finally:
2081 tr.release() 2089 tr.release()
2082 finally: 2090 finally:
2083 lockmod.release(lock, wlock) 2091 lockmod.release(lock, wlock)