1186 if wctx.isinmemory(): |
1186 if wctx.isinmemory(): |
1187 wctx.setbase(repo[p1]) |
1187 wctx.setbase(repo[p1]) |
1188 else: |
1188 else: |
1189 if repo['.'].rev() != p1: |
1189 if repo['.'].rev() != p1: |
1190 repo.ui.debug(" update to %d:%s\n" % (p1, repo[p1])) |
1190 repo.ui.debug(" update to %d:%s\n" % (p1, repo[p1])) |
1191 mergemod.update(repo, p1, False, True) |
1191 mergemod.update(repo, p1, branchmerge=False, force=True) |
1192 else: |
1192 else: |
1193 repo.ui.debug(" already in destination\n") |
1193 repo.ui.debug(" already in destination\n") |
1194 # This is, alas, necessary to invalidate workingctx's manifest cache, |
1194 # This is, alas, necessary to invalidate workingctx's manifest cache, |
1195 # as well as other data we litter on it in other places. |
1195 # as well as other data we litter on it in other places. |
1196 wctx = repo[None] |
1196 wctx = repo[None] |
1198 repo.ui.debug(" merge against %d:%s\n" % (rev, repo[rev])) |
1198 repo.ui.debug(" merge against %d:%s\n" % (rev, repo[rev])) |
1199 if base is not None: |
1199 if base is not None: |
1200 repo.ui.debug(" detach base %d:%s\n" % (base, repo[base])) |
1200 repo.ui.debug(" detach base %d:%s\n" % (base, repo[base])) |
1201 # When collapsing in-place, the parent is the common ancestor, we |
1201 # When collapsing in-place, the parent is the common ancestor, we |
1202 # have to allow merging with it. |
1202 # have to allow merging with it. |
1203 stats = mergemod.update(repo, rev, True, True, base, collapse, |
1203 stats = mergemod.update(repo, rev, branchmerge=True, force=True, |
|
1204 ancestor=base, mergeancestor=collapse, |
1204 labels=['dest', 'source'], wc=wctx) |
1205 labels=['dest', 'source'], wc=wctx) |
1205 if collapse: |
1206 if collapse: |
1206 copies.duplicatecopies(repo, wctx, rev, dest) |
1207 copies.duplicatecopies(repo, wctx, rev, dest) |
1207 else: |
1208 else: |
1208 # If we're not using --collapse, we need to |
1209 # If we're not using --collapse, we need to |
1641 updateifonnodes.add(originalwd) |
1642 updateifonnodes.add(originalwd) |
1642 shouldupdate = repo['.'].rev() in updateifonnodes |
1643 shouldupdate = repo['.'].rev() in updateifonnodes |
1643 |
1644 |
1644 # Update away from the rebase if necessary |
1645 # Update away from the rebase if necessary |
1645 if shouldupdate or needupdate(repo, state): |
1646 if shouldupdate or needupdate(repo, state): |
1646 mergemod.update(repo, originalwd, False, True) |
1647 mergemod.update(repo, originalwd, branchmerge=False, force=True) |
1647 |
1648 |
1648 # Strip from the first rebased revision |
1649 # Strip from the first rebased revision |
1649 if rebased: |
1650 if rebased: |
1650 repair.strip(repo.ui, repo, strippoints, backup=backup) |
1651 repair.strip(repo.ui, repo, strippoints, backup=backup) |
1651 |
1652 |