1531 restore''' |
1531 restore''' |
1532 |
1532 |
1533 try: |
1533 try: |
1534 # If the first commits in the rebased set get skipped during the rebase, |
1534 # If the first commits in the rebased set get skipped during the rebase, |
1535 # their values within the state mapping will be the dest rev id. The |
1535 # their values within the state mapping will be the dest rev id. The |
1536 # dstates list must must not contain the dest rev (issue4896) |
1536 # rebased list must must not contain the dest rev (issue4896) |
1537 dstates = [s for r, s in state.items() if s >= 0 and s != destmap[r]] |
1537 rebased = [s for r, s in state.items() |
1538 immutable = [d for d in dstates if not repo[d].mutable()] |
1538 if s >= 0 and s != r and s != destmap[r]] |
|
1539 immutable = [d for d in rebased if not repo[d].mutable()] |
1539 cleanup = True |
1540 cleanup = True |
1540 if immutable: |
1541 if immutable: |
1541 repo.ui.warn(_("warning: can't clean up public changesets %s\n") |
1542 repo.ui.warn(_("warning: can't clean up public changesets %s\n") |
1542 % ', '.join(bytes(repo[r]) for r in immutable), |
1543 % ', '.join(bytes(repo[r]) for r in immutable), |
1543 hint=_("see 'hg help phases' for details")) |
1544 hint=_("see 'hg help phases' for details")) |
1544 cleanup = False |
1545 cleanup = False |
1545 |
1546 |
1546 descendants = set() |
1547 descendants = set() |
1547 if dstates: |
1548 if rebased: |
1548 descendants = set(repo.changelog.descendants(dstates)) |
1549 descendants = set(repo.changelog.descendants(rebased)) |
1549 if descendants - set(dstates): |
1550 if descendants - set(rebased): |
1550 repo.ui.warn(_("warning: new changesets detected on destination " |
1551 repo.ui.warn(_("warning: new changesets detected on destination " |
1551 "branch, can't strip\n")) |
1552 "branch, can't strip\n")) |
1552 cleanup = False |
1553 cleanup = False |
1553 |
1554 |
1554 if cleanup: |
1555 if cleanup: |
1555 shouldupdate = False |
1556 shouldupdate = False |
1556 rebased = [s for r, s in state.items() |
|
1557 if s >= 0 and s != destmap[r]] |
|
1558 if rebased: |
1557 if rebased: |
1559 strippoints = [ |
1558 strippoints = [ |
1560 c.node() for c in repo.set('roots(%ld)', rebased)] |
1559 c.node() for c in repo.set('roots(%ld)', rebased)] |
1561 |
1560 |
1562 updateifonnodes = set(rebased) |
1561 updateifonnodes = set(rebased) |