##// END OF EJS Templates
merge: migrate to context manager for changing dirstate parents
Augie Fackler -
r32351:c568c187 default
parent child Browse files
Show More
@@ -1696,7 +1696,7 def update(repo, node, branchmerge, forc
1696 stats = applyupdates(repo, actions, wc, p2, overwrite, labels=labels)
1696 stats = applyupdates(repo, actions, wc, p2, overwrite, labels=labels)
1697
1697
1698 if not partial:
1698 if not partial:
1699 repo.dirstate.beginparentchange()
1699 with repo.dirstate.parentchange():
1700 repo.setparents(fp1, fp2)
1700 repo.setparents(fp1, fp2)
1701 recordupdates(repo, actions, branchmerge)
1701 recordupdates(repo, actions, branchmerge)
1702 # update completed, clear state
1702 # update completed, clear state
@@ -1704,7 +1704,6 def update(repo, node, branchmerge, forc
1704
1704
1705 if not branchmerge:
1705 if not branchmerge:
1706 repo.dirstate.setbranch(p2.branch())
1706 repo.dirstate.setbranch(p2.branch())
1707 repo.dirstate.endparentchange()
1708
1707
1709 if not partial:
1708 if not partial:
1710 repo.hook('update', parent1=xp1, parent2=xp2, error=stats[3])
1709 repo.hook('update', parent1=xp1, parent2=xp2, error=stats[3])
@@ -1742,10 +1741,9 def graft(repo, ctx, pctx, labels, keepp
1742 parents.remove(pctx)
1741 parents.remove(pctx)
1743 pother = parents[0].node()
1742 pother = parents[0].node()
1744
1743
1745 repo.dirstate.beginparentchange()
1744 with repo.dirstate.parentchange():
1746 repo.setparents(repo['.'].node(), pother)
1745 repo.setparents(repo['.'].node(), pother)
1747 repo.dirstate.write(repo.currenttransaction())
1746 repo.dirstate.write(repo.currenttransaction())
1748 # fix up dirstate for copies and renames
1747 # fix up dirstate for copies and renames
1749 copies.duplicatecopies(repo, ctx.rev(), pctx.rev())
1748 copies.duplicatecopies(repo, ctx.rev(), pctx.rev())
1750 repo.dirstate.endparentchange()
1751 return stats
1749 return stats
General Comments 0
You need to be logged in to leave comments. Login now