Mercurial > hg
comparison mercurial/merge.py @ 32351:c568c187102f
merge: migrate to context manager for changing dirstate parents
author | Augie Fackler <augie@google.com> |
---|---|
date | Thu, 18 May 2017 17:11:24 -0400 |
parents | 7e79373263ab |
children | bd56bea5ecf8 |
comparison
equal
deleted
inserted
replaced
32350:9742f937c971 | 32351:c568c187102f |
---|---|
1694 repo.vfs.write('updatestate', p2.hex()) | 1694 repo.vfs.write('updatestate', p2.hex()) |
1695 | 1695 |
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 |
1703 util.unlink(repo.vfs.join('updatestate')) | 1703 util.unlink(repo.vfs.join('updatestate')) |
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]) |
1711 return stats | 1710 return stats |
1712 | 1711 |
1740 parents = ctx.parents() | 1739 parents = ctx.parents() |
1741 if keepparent and len(parents) == 2 and pctx in parents: | 1740 if keepparent and len(parents) == 2 and pctx in parents: |
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 |