Mercurial > hg
comparison hgext/rebase.py @ 44094:521b4e3a42d7
rebase: extract a variable for a repeated `repo[p1]`
I'll add another use site in the next patch.
Differential Revision: https://phab.mercurial-scm.org/D7896
author | Martin von Zweigbergk <martinvonz@google.com> |
---|---|
date | Mon, 13 Jan 2020 11:11:20 -0800 |
parents | 833210fbd900 |
children | e733c59f3c09 |
comparison
equal
deleted
inserted
replaced
44093:06e7e7652ac0 | 44094:521b4e3a42d7 |
---|---|
1467 | 1467 |
1468 def rebasenode(repo, rev, p1, base, collapse, dest, wctx): | 1468 def rebasenode(repo, rev, p1, base, collapse, dest, wctx): |
1469 """Rebase a single revision rev on top of p1 using base as merge ancestor""" | 1469 """Rebase a single revision rev on top of p1 using base as merge ancestor""" |
1470 # Merge phase | 1470 # Merge phase |
1471 # Update to destination and merge it with local | 1471 # Update to destination and merge it with local |
1472 p1ctx = repo[p1] | |
1472 if wctx.isinmemory(): | 1473 if wctx.isinmemory(): |
1473 wctx.setbase(repo[p1]) | 1474 wctx.setbase(p1ctx) |
1474 else: | 1475 else: |
1475 if repo[b'.'].rev() != p1: | 1476 if repo[b'.'].rev() != p1: |
1476 repo.ui.debug(b" update to %d:%s\n" % (p1, repo[p1])) | 1477 repo.ui.debug(b" update to %d:%s\n" % (p1, p1ctx)) |
1477 mergemod.update(repo, p1, branchmerge=False, force=True) | 1478 mergemod.update(repo, p1, branchmerge=False, force=True) |
1478 else: | 1479 else: |
1479 repo.ui.debug(b" already in destination\n") | 1480 repo.ui.debug(b" already in destination\n") |
1480 # This is, alas, necessary to invalidate workingctx's manifest cache, | 1481 # This is, alas, necessary to invalidate workingctx's manifest cache, |
1481 # as well as other data we litter on it in other places. | 1482 # as well as other data we litter on it in other places. |