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