Mercurial > hg
comparison mercurial/merge.py @ 43797:fb07126dadbe
graft: extract `repo['.']` to local variable
It's used in two places and I'm about to use it more.
Differential Revision: https://phab.mercurial-scm.org/D7548
author | Martin von Zweigbergk <martinvonz@google.com> |
---|---|
date | Thu, 05 Dec 2019 09:34:43 -0800 |
parents | ebfd349eac46 |
children | 32d11a23c9cf |
comparison
equal
deleted
inserted
replaced
43796:ebfd349eac46 | 43797:fb07126dadbe |
---|---|
2603 # mergeancestor=True to update. This does two things: 1) allows the merge if | 2603 # mergeancestor=True to update. This does two things: 1) allows the merge if |
2604 # the destination is the same as the parent of the ctx (so we can use graft | 2604 # the destination is the same as the parent of the ctx (so we can use graft |
2605 # to copy commits), and 2) informs update that the incoming changes are | 2605 # to copy commits), and 2) informs update that the incoming changes are |
2606 # newer than the destination so it doesn't prompt about "remote changed foo | 2606 # newer than the destination so it doesn't prompt about "remote changed foo |
2607 # which local deleted". | 2607 # which local deleted". |
2608 mergeancestor = repo.changelog.isancestor(repo[b'.'].node(), ctx.node()) | 2608 pctx = repo[b'.'] |
2609 mergeancestor = repo.changelog.isancestor(pctx.node(), ctx.node()) | |
2609 | 2610 |
2610 stats = update( | 2611 stats = update( |
2611 repo, | 2612 repo, |
2612 ctx.node(), | 2613 ctx.node(), |
2613 True, | 2614 True, |
2625 if keepparent and len(parents) == 2 and base in parents: | 2626 if keepparent and len(parents) == 2 and base in parents: |
2626 parents.remove(base) | 2627 parents.remove(base) |
2627 pother = parents[0].node() | 2628 pother = parents[0].node() |
2628 | 2629 |
2629 with repo.dirstate.parentchange(): | 2630 with repo.dirstate.parentchange(): |
2630 repo.setparents(repo[b'.'].node(), pother) | 2631 repo.setparents(pctx.node(), pother) |
2631 repo.dirstate.write(repo.currenttransaction()) | 2632 repo.dirstate.write(repo.currenttransaction()) |
2632 # fix up dirstate for copies and renames | 2633 # fix up dirstate for copies and renames |
2633 copies.duplicatecopies(repo, repo[None], ctx.rev(), base.rev()) | 2634 copies.duplicatecopies(repo, repo[None], ctx.rev(), base.rev()) |
2634 return stats | 2635 return stats |
2635 | 2636 |