comparison tests/test-rewind.t @ 5802:84efc2e92228

rewind: abort if some parts of a fold are unknown locally
author Anton Shestakov <av6@dwimlabs.net>
date Tue, 22 Dec 2020 19:07:46 +0800
parents e8a43f5929f6
children abbc021c6f68
comparison
equal deleted inserted replaced
5801:e8a43f5929f6 5802:84efc2e92228
1515 in future we might have a way to allow rewind to skip changesets unknown 1515 in future we might have a way to allow rewind to skip changesets unknown
1516 locally and still proceed (and lose the least amount of work possible) 1516 locally and still proceed (and lose the least amount of work possible)
1517 1517
1518 $ hg rewind --hidden --to 'desc("A0")+desc("B0")' --exact --dry-run 1518 $ hg rewind --hidden --to 'desc("A0")+desc("B0")' --exact --dry-run
1519 rewinding 1988e9fe9517 to 2 changesets: fa8956746c52 a07c12c45197 1519 rewinding 1988e9fe9517 to 2 changesets: fa8956746c52 a07c12c45197
1520 $ hg rewind --hidden --to 'desc("A0")' --dry-run
1521 abort: not rewinding, some predecessors are unknown locally: 25210d726f52
1522 (try selecting all changesets to rewind to manually, possibly with --exact)
1523 [255]
1524 $ hg rewind --hidden --to 'desc("A1")' --dry-run
1525 abort: not rewinding, some predecessors are unknown locally: 25210d726f52
1526 (try selecting all changesets to rewind to manually, possibly with --exact)
1527 [255]
1528
1529 XXX the semantic of --exact might need clarification here,
1530 XXX for example, shouln't --exact make sure we only rewind to the `--to` target ?
1531
1520 $ hg rewind --hidden --to 'desc("A1")' --exact --dry-run 1532 $ hg rewind --hidden --to 'desc("A1")' --exact --dry-run
1521 abort: unknown revision '25210d726f527e03f1f148bb8048d571512146d9' 1533 abort: not rewinding, some predecessors are unknown locally: 25210d726f52
1534 (try selecting all changesets to rewind to manually, possibly with --exact)
1522 [255] 1535 [255]
1536 $ hg rewind --from 'desc("AB2")' --dry-run
1537 abort: not rewinding, some predecessors are unknown locally: 25210d726f52
1538 (try selecting all changesets to rewind to manually, possibly with --exact)
1539 [255]
1540 $ hg rewind --from 'desc("AB2")' --exact --dry-run
1541 abort: not rewinding, some predecessors are unknown locally: 25210d726f52
1542 (try selecting all changesets to rewind to manually, possibly with --exact)
1543 [255]
1523 1544
1524 $ cd .. 1545 $ cd ..
1546
1547 split and then fold with a missing part
1548
1549 .. /⇠ (C1) ⇠\
1550 .. BC0 ⇠ | \
1551 .. | \⇠ B1 ⇠ AC2
1552 .. A0 ⇠⇠⇠⇠⇠⇠⇠⇠⇠⇠⇠/
1553
1554 here we have a case when walking successors and then predecessors of target
1555 revisions just once might not be enough, because it's a more complex DAG with a
1556 changeset missing from local repo
1557
1558 $ hg init extra-fold-case-5
1559 $ cd extra-fold-case-5
1560
1561 $ echo R > R
1562 $ hg ci -qAm R
1563 $ echo A > A
1564 $ hg ci -qAm A0
1565 $ echo B > B
1566 $ echo C > C
1567 $ hg ci -qAm BC0
1568 $ hg up 'desc("A0")' -q
1569 $ echo B > B
1570 $ hg ci -qAm B1
1571 $ echo C > C
1572 $ hg ci -qAm C1
1573
1574 $ hg prune -r 'desc("BC0")' -s 'desc("B1")+desc("C1")' --split
1575 1 changesets pruned
1576
1577 $ hg up 'desc("R")' -q
1578 $ echo A > A
1579 $ echo C > C
1580 $ hg ci -qAm AC2
1581
1582 $ hg prune -r 'desc("A0")+desc("C1")' -s 'desc("AC2")' --fold
1583 2 changesets pruned
1584 1 new orphan changesets
1585
1586 $ hg glhf --hidden
1587 @ 5:9ccaac2e5fbb AC2 (A C)
1588 |
1589 | x 4:2e4ab803d8ae C1 (C)
1590 | |
1591 | * 3:44774eafdc1c B1 (B)
1592 | |
1593 | | x 2:883d75400657 BC0 (B C)
1594 | |/
1595 | x 1:fa8956746c52 A0 (A)
1596 |/
1597 o 0:167e04d3d1b2 R (R)
1598
1599
1600 target selection
1601
1602 $ hg rewind --hidden --to 'desc("A0")' --dry-run
1603 rewinding 9ccaac2e5fbb to 2 changesets: fa8956746c52 2e4ab803d8ae
1604 $ hg rewind --hidden --to 'desc("BC0")' --dry-run
1605 rewinding 44774eafdc1c to 1 changesets: 883d75400657
1606 rewinding 9ccaac2e5fbb to 2 changesets: fa8956746c52 883d75400657
1607 $ hg rewind --from 'desc("AC2")' --dry-run
1608 rewinding 9ccaac2e5fbb to 2 changesets: fa8956746c52 2e4ab803d8ae
1609
1610 stripping a component of AC2 fold
1611
1612 $ hg strip --config extensions.strip= --hidden -r 'desc("C1")' -q
1613 warning: ignoring unknown working parent 9ccaac2e5fbb!
1614
1615 target selection
1616
1617 at the moment, there's not much that we can do here because of missing C1
1618
1619 in future we might have a way to allow rewind to skip changesets unknown
1620 locally and still proceed (and lose the least amount of work possible)
1621
1622 XXX the semantic of --exact might need clarification here,
1623 XXX for example, shouln't --exact make sure we only rewind to the `--to` target ?
1624
1625 $ hg rewind --hidden --to 'desc("A0")' --dry-run
1626 abort: not rewinding, some predecessors are unknown locally: 2e4ab803d8ae
1627 (try selecting all changesets to rewind to manually, possibly with --exact)
1628 [255]
1629 $ hg rewind --hidden --to 'desc("BC0")' --dry-run
1630 rewinding 44774eafdc1c to 1 changesets: 883d75400657
1631 rewinding 9ccaac2e5fbb to 2 changesets: fa8956746c52 883d75400657
1632 $ hg rewind --from 'desc("AC2")' --dry-run
1633 abort: not rewinding, some predecessors are unknown locally: 2e4ab803d8ae
1634 (try selecting all changesets to rewind to manually, possibly with --exact)
1635 [255]
1636 $ hg rewind --from 'desc("AC2")' --exact --dry-run
1637 abort: not rewinding, some predecessors are unknown locally: 2e4ab803d8ae
1638 (try selecting all changesets to rewind to manually, possibly with --exact)
1639 [255]