##// END OF EJS Templates
acl: add branch tests for the current behavior of acl extension...
John Mulligan -
r13917:3259a067 default
parent child Browse files
Show More
This diff has been collapsed as it changes many lines, (560 lines changed) Show them Hide them
@@ -1333,3 +1333,563 b' Disable the fakegroups trick to get real'
1333 acl: "unlikelytoexist" not defined in [acl.groups]
1333 acl: "unlikelytoexist" not defined in [acl.groups]
1334 error: pretxnchangegroup.acl hook failed: group 'unlikelytoexist' is undefined
1334 error: pretxnchangegroup.acl hook failed: group 'unlikelytoexist' is undefined
1335 abort: group 'unlikelytoexist' is undefined
1335 abort: group 'unlikelytoexist' is undefined
1336
1337
1338 Branch acl tests setup
1339
1340 $ init_config
1341 $ cd b
1342 $ hg up
1343 0 files updated, 0 files merged, 0 files removed, 0 files unresolved
1344 $ hg branch foobar
1345 marked working directory as branch foobar
1346 $ hg commit -m 'create foobar'
1347 $ echo 'foo contents' > abc.txt
1348 $ hg add abc.txt
1349 $ hg commit -m 'foobar contents'
1350 $ cd ..
1351 $ hg --cwd a pull ../b
1352 pulling from ../b
1353 searching for changes
1354 adding changesets
1355 adding manifests
1356 adding file changes
1357 added 2 changesets with 1 changes to 1 files (+1 heads)
1358 (run 'hg heads' to see heads)
1359
1360 Create additional changeset on foobar branch
1361
1362 $ cd a
1363 $ hg up -C foobar
1364 4 files updated, 0 files merged, 0 files removed, 0 files unresolved
1365 $ echo 'foo contents2' > abc.txt
1366 $ hg commit -m 'foobar contents2'
1367 $ cd ..
1368
1369
1370 No branch acls specified
1371
1372 $ do_push astro
1373 Pushing as user astro
1374 hgrc = """
1375 [acl]
1376 sources = push
1377 [extensions]
1378 """
1379 pushing to ../b
1380 searching for changes
1381 common changesets up to 07e028174695
1382 4 changesets found
1383 list of changesets:
1384 ef1ea85a6374b77d6da9dcda9541f498f2d17df7
1385 f9cafe1212c8c6fa1120d14a556e18cc44ff8bdd
1386 911600dab2ae7a9baff75958b84fe606851ce955
1387 4ea792ff64284af438188103a0ee8aca1724fb8c
1388 adding changesets
1389 bundling: 1 changesets
1390 bundling: 2 changesets
1391 bundling: 3 changesets
1392 bundling: 4 changesets
1393 bundling: 1/4 manifests (25.00%)
1394 bundling: 2/4 manifests (50.00%)
1395 bundling: 3/4 manifests (75.00%)
1396 bundling: 4/4 manifests (100.00%)
1397 bundling: abc.txt 0/4 files (0.00%)
1398 bundling: foo/Bar/file.txt 1/4 files (25.00%)
1399 bundling: foo/file.txt 2/4 files (50.00%)
1400 bundling: quux/file.py 3/4 files (75.00%)
1401 changesets: 1 chunks
1402 add changeset ef1ea85a6374
1403 changesets: 2 chunks
1404 add changeset f9cafe1212c8
1405 changesets: 3 chunks
1406 add changeset 911600dab2ae
1407 changesets: 4 chunks
1408 add changeset 4ea792ff6428
1409 adding manifests
1410 manifests: 1/4 chunks (25.00%)
1411 manifests: 2/4 chunks (50.00%)
1412 manifests: 3/4 chunks (75.00%)
1413 manifests: 4/4 chunks (100.00%)
1414 adding file changes
1415 adding abc.txt revisions
1416 files: 1/4 chunks (25.00%)
1417 adding foo/Bar/file.txt revisions
1418 files: 2/4 chunks (50.00%)
1419 adding foo/file.txt revisions
1420 files: 3/4 chunks (75.00%)
1421 adding quux/file.py revisions
1422 files: 4/4 chunks (100.00%)
1423 added 4 changesets with 4 changes to 4 files (+1 heads)
1424 calling hook pretxnchangegroup.acl: hgext.acl.hook
1425 acl: acl.allow.branches not enabled
1426 acl: acl.deny.branches not enabled
1427 acl: acl.allow not enabled
1428 acl: acl.deny not enabled
1429 acl: branch access granted: "ef1ea85a6374" on branch "default"
1430 acl: allowing changeset ef1ea85a6374
1431 acl: branch access granted: "f9cafe1212c8" on branch "default"
1432 acl: allowing changeset f9cafe1212c8
1433 acl: branch access granted: "911600dab2ae" on branch "default"
1434 acl: allowing changeset 911600dab2ae
1435 acl: branch access granted: "4ea792ff6428" on branch "foobar"
1436 acl: allowing changeset 4ea792ff6428
1437 updating the branch cache
1438 checking for updated bookmarks
1439 repository tip rolled back to revision 2 (undo push)
1440 working directory now based on revision 2
1441 2:07e028174695
1442
1443
1444 Branch acl deny test
1445
1446 $ echo "[acl.deny.branches]" >> $config
1447 $ echo "foobar = *" >> $config
1448 $ do_push astro
1449 Pushing as user astro
1450 hgrc = """
1451 [acl]
1452 sources = push
1453 [extensions]
1454 [acl.deny.branches]
1455 foobar = *
1456 """
1457 pushing to ../b
1458 searching for changes
1459 common changesets up to 07e028174695
1460 invalidating branch cache (tip differs)
1461 4 changesets found
1462 list of changesets:
1463 ef1ea85a6374b77d6da9dcda9541f498f2d17df7
1464 f9cafe1212c8c6fa1120d14a556e18cc44ff8bdd
1465 911600dab2ae7a9baff75958b84fe606851ce955
1466 4ea792ff64284af438188103a0ee8aca1724fb8c
1467 adding changesets
1468 bundling: 1 changesets
1469 bundling: 2 changesets
1470 bundling: 3 changesets
1471 bundling: 4 changesets
1472 bundling: 1/4 manifests (25.00%)
1473 bundling: 2/4 manifests (50.00%)
1474 bundling: 3/4 manifests (75.00%)
1475 bundling: 4/4 manifests (100.00%)
1476 bundling: abc.txt 0/4 files (0.00%)
1477 bundling: foo/Bar/file.txt 1/4 files (25.00%)
1478 bundling: foo/file.txt 2/4 files (50.00%)
1479 bundling: quux/file.py 3/4 files (75.00%)
1480 changesets: 1 chunks
1481 add changeset ef1ea85a6374
1482 changesets: 2 chunks
1483 add changeset f9cafe1212c8
1484 changesets: 3 chunks
1485 add changeset 911600dab2ae
1486 changesets: 4 chunks
1487 add changeset 4ea792ff6428
1488 adding manifests
1489 manifests: 1/4 chunks (25.00%)
1490 manifests: 2/4 chunks (50.00%)
1491 manifests: 3/4 chunks (75.00%)
1492 manifests: 4/4 chunks (100.00%)
1493 adding file changes
1494 adding abc.txt revisions
1495 files: 1/4 chunks (25.00%)
1496 adding foo/Bar/file.txt revisions
1497 files: 2/4 chunks (50.00%)
1498 adding foo/file.txt revisions
1499 files: 3/4 chunks (75.00%)
1500 adding quux/file.py revisions
1501 files: 4/4 chunks (100.00%)
1502 added 4 changesets with 4 changes to 4 files (+1 heads)
1503 calling hook pretxnchangegroup.acl: hgext.acl.hook
1504 acl: acl.allow.branches not enabled
1505 acl: acl.deny.branches enabled, 1 entries for user astro
1506 acl: acl.allow not enabled
1507 acl: acl.deny not enabled
1508 acl: branch access granted: "ef1ea85a6374" on branch "default"
1509 acl: allowing changeset ef1ea85a6374
1510 acl: branch access granted: "f9cafe1212c8" on branch "default"
1511 acl: allowing changeset f9cafe1212c8
1512 acl: branch access granted: "911600dab2ae" on branch "default"
1513 acl: allowing changeset 911600dab2ae
1514 error: pretxnchangegroup.acl hook failed: acl: user "astro" denied on branch "foobar" (changeset "4ea792ff6428")
1515 transaction abort!
1516 rollback completed
1517 abort: acl: user "astro" denied on branch "foobar" (changeset "4ea792ff6428")
1518 no rollback information available
1519 2:07e028174695
1520
1521
1522 Branch acl empty allow test
1523
1524 $ init_config
1525 $ echo "[acl.allow.branches]" >> $config
1526 $ do_push astro
1527 Pushing as user astro
1528 hgrc = """
1529 [acl]
1530 sources = push
1531 [extensions]
1532 [acl.allow.branches]
1533 """
1534 pushing to ../b
1535 searching for changes
1536 common changesets up to 07e028174695
1537 4 changesets found
1538 list of changesets:
1539 ef1ea85a6374b77d6da9dcda9541f498f2d17df7
1540 f9cafe1212c8c6fa1120d14a556e18cc44ff8bdd
1541 911600dab2ae7a9baff75958b84fe606851ce955
1542 4ea792ff64284af438188103a0ee8aca1724fb8c
1543 adding changesets
1544 bundling: 1 changesets
1545 bundling: 2 changesets
1546 bundling: 3 changesets
1547 bundling: 4 changesets
1548 bundling: 1/4 manifests (25.00%)
1549 bundling: 2/4 manifests (50.00%)
1550 bundling: 3/4 manifests (75.00%)
1551 bundling: 4/4 manifests (100.00%)
1552 bundling: abc.txt 0/4 files (0.00%)
1553 bundling: foo/Bar/file.txt 1/4 files (25.00%)
1554 bundling: foo/file.txt 2/4 files (50.00%)
1555 bundling: quux/file.py 3/4 files (75.00%)
1556 changesets: 1 chunks
1557 add changeset ef1ea85a6374
1558 changesets: 2 chunks
1559 add changeset f9cafe1212c8
1560 changesets: 3 chunks
1561 add changeset 911600dab2ae
1562 changesets: 4 chunks
1563 add changeset 4ea792ff6428
1564 adding manifests
1565 manifests: 1/4 chunks (25.00%)
1566 manifests: 2/4 chunks (50.00%)
1567 manifests: 3/4 chunks (75.00%)
1568 manifests: 4/4 chunks (100.00%)
1569 adding file changes
1570 adding abc.txt revisions
1571 files: 1/4 chunks (25.00%)
1572 adding foo/Bar/file.txt revisions
1573 files: 2/4 chunks (50.00%)
1574 adding foo/file.txt revisions
1575 files: 3/4 chunks (75.00%)
1576 adding quux/file.py revisions
1577 files: 4/4 chunks (100.00%)
1578 added 4 changesets with 4 changes to 4 files (+1 heads)
1579 calling hook pretxnchangegroup.acl: hgext.acl.hook
1580 acl: acl.allow.branches enabled, 0 entries for user astro
1581 acl: acl.deny.branches not enabled
1582 acl: acl.allow not enabled
1583 acl: acl.deny not enabled
1584 error: pretxnchangegroup.acl hook failed: acl: user "astro" not allowed on branch "default" (changeset "ef1ea85a6374")
1585 transaction abort!
1586 rollback completed
1587 abort: acl: user "astro" not allowed on branch "default" (changeset "ef1ea85a6374")
1588 no rollback information available
1589 2:07e028174695
1590
1591
1592 Branch acl allow other
1593
1594 $ init_config
1595 $ echo "[acl.allow.branches]" >> $config
1596 $ echo "* = george" >> $config
1597 $ do_push astro
1598 Pushing as user astro
1599 hgrc = """
1600 [acl]
1601 sources = push
1602 [extensions]
1603 [acl.allow.branches]
1604 * = george
1605 """
1606 pushing to ../b
1607 searching for changes
1608 common changesets up to 07e028174695
1609 4 changesets found
1610 list of changesets:
1611 ef1ea85a6374b77d6da9dcda9541f498f2d17df7
1612 f9cafe1212c8c6fa1120d14a556e18cc44ff8bdd
1613 911600dab2ae7a9baff75958b84fe606851ce955
1614 4ea792ff64284af438188103a0ee8aca1724fb8c
1615 adding changesets
1616 bundling: 1 changesets
1617 bundling: 2 changesets
1618 bundling: 3 changesets
1619 bundling: 4 changesets
1620 bundling: 1/4 manifests (25.00%)
1621 bundling: 2/4 manifests (50.00%)
1622 bundling: 3/4 manifests (75.00%)
1623 bundling: 4/4 manifests (100.00%)
1624 bundling: abc.txt 0/4 files (0.00%)
1625 bundling: foo/Bar/file.txt 1/4 files (25.00%)
1626 bundling: foo/file.txt 2/4 files (50.00%)
1627 bundling: quux/file.py 3/4 files (75.00%)
1628 changesets: 1 chunks
1629 add changeset ef1ea85a6374
1630 changesets: 2 chunks
1631 add changeset f9cafe1212c8
1632 changesets: 3 chunks
1633 add changeset 911600dab2ae
1634 changesets: 4 chunks
1635 add changeset 4ea792ff6428
1636 adding manifests
1637 manifests: 1/4 chunks (25.00%)
1638 manifests: 2/4 chunks (50.00%)
1639 manifests: 3/4 chunks (75.00%)
1640 manifests: 4/4 chunks (100.00%)
1641 adding file changes
1642 adding abc.txt revisions
1643 files: 1/4 chunks (25.00%)
1644 adding foo/Bar/file.txt revisions
1645 files: 2/4 chunks (50.00%)
1646 adding foo/file.txt revisions
1647 files: 3/4 chunks (75.00%)
1648 adding quux/file.py revisions
1649 files: 4/4 chunks (100.00%)
1650 added 4 changesets with 4 changes to 4 files (+1 heads)
1651 calling hook pretxnchangegroup.acl: hgext.acl.hook
1652 acl: acl.allow.branches enabled, 0 entries for user astro
1653 acl: acl.deny.branches not enabled
1654 acl: acl.allow not enabled
1655 acl: acl.deny not enabled
1656 error: pretxnchangegroup.acl hook failed: acl: user "astro" not allowed on branch "default" (changeset "ef1ea85a6374")
1657 transaction abort!
1658 rollback completed
1659 abort: acl: user "astro" not allowed on branch "default" (changeset "ef1ea85a6374")
1660 no rollback information available
1661 2:07e028174695
1662
1663 $ do_push george
1664 Pushing as user george
1665 hgrc = """
1666 [acl]
1667 sources = push
1668 [extensions]
1669 [acl.allow.branches]
1670 * = george
1671 """
1672 pushing to ../b
1673 searching for changes
1674 common changesets up to 07e028174695
1675 4 changesets found
1676 list of changesets:
1677 ef1ea85a6374b77d6da9dcda9541f498f2d17df7
1678 f9cafe1212c8c6fa1120d14a556e18cc44ff8bdd
1679 911600dab2ae7a9baff75958b84fe606851ce955
1680 4ea792ff64284af438188103a0ee8aca1724fb8c
1681 adding changesets
1682 bundling: 1 changesets
1683 bundling: 2 changesets
1684 bundling: 3 changesets
1685 bundling: 4 changesets
1686 bundling: 1/4 manifests (25.00%)
1687 bundling: 2/4 manifests (50.00%)
1688 bundling: 3/4 manifests (75.00%)
1689 bundling: 4/4 manifests (100.00%)
1690 bundling: abc.txt 0/4 files (0.00%)
1691 bundling: foo/Bar/file.txt 1/4 files (25.00%)
1692 bundling: foo/file.txt 2/4 files (50.00%)
1693 bundling: quux/file.py 3/4 files (75.00%)
1694 changesets: 1 chunks
1695 add changeset ef1ea85a6374
1696 changesets: 2 chunks
1697 add changeset f9cafe1212c8
1698 changesets: 3 chunks
1699 add changeset 911600dab2ae
1700 changesets: 4 chunks
1701 add changeset 4ea792ff6428
1702 adding manifests
1703 manifests: 1/4 chunks (25.00%)
1704 manifests: 2/4 chunks (50.00%)
1705 manifests: 3/4 chunks (75.00%)
1706 manifests: 4/4 chunks (100.00%)
1707 adding file changes
1708 adding abc.txt revisions
1709 files: 1/4 chunks (25.00%)
1710 adding foo/Bar/file.txt revisions
1711 files: 2/4 chunks (50.00%)
1712 adding foo/file.txt revisions
1713 files: 3/4 chunks (75.00%)
1714 adding quux/file.py revisions
1715 files: 4/4 chunks (100.00%)
1716 added 4 changesets with 4 changes to 4 files (+1 heads)
1717 calling hook pretxnchangegroup.acl: hgext.acl.hook
1718 acl: acl.allow.branches enabled, 1 entries for user george
1719 acl: acl.deny.branches not enabled
1720 acl: acl.allow not enabled
1721 acl: acl.deny not enabled
1722 acl: branch access granted: "ef1ea85a6374" on branch "default"
1723 acl: allowing changeset ef1ea85a6374
1724 acl: branch access granted: "f9cafe1212c8" on branch "default"
1725 acl: allowing changeset f9cafe1212c8
1726 acl: branch access granted: "911600dab2ae" on branch "default"
1727 acl: allowing changeset 911600dab2ae
1728 acl: branch access granted: "4ea792ff6428" on branch "foobar"
1729 acl: allowing changeset 4ea792ff6428
1730 updating the branch cache
1731 checking for updated bookmarks
1732 repository tip rolled back to revision 2 (undo push)
1733 working directory now based on revision 2
1734 2:07e028174695
1735
1736
1737 Branch acl conflicting allow
1738 asterisk ends up applying to all branches and allowing george to
1739 push foobar into the remote
1740
1741 $ init_config
1742 $ echo "[acl.allow.branches]" >> $config
1743 $ echo "foobar = astro" >> $config
1744 $ echo "* = george" >> $config
1745 $ do_push george
1746 Pushing as user george
1747 hgrc = """
1748 [acl]
1749 sources = push
1750 [extensions]
1751 [acl.allow.branches]
1752 foobar = astro
1753 * = george
1754 """
1755 pushing to ../b
1756 searching for changes
1757 common changesets up to 07e028174695
1758 invalidating branch cache (tip differs)
1759 4 changesets found
1760 list of changesets:
1761 ef1ea85a6374b77d6da9dcda9541f498f2d17df7
1762 f9cafe1212c8c6fa1120d14a556e18cc44ff8bdd
1763 911600dab2ae7a9baff75958b84fe606851ce955
1764 4ea792ff64284af438188103a0ee8aca1724fb8c
1765 adding changesets
1766 bundling: 1 changesets
1767 bundling: 2 changesets
1768 bundling: 3 changesets
1769 bundling: 4 changesets
1770 bundling: 1/4 manifests (25.00%)
1771 bundling: 2/4 manifests (50.00%)
1772 bundling: 3/4 manifests (75.00%)
1773 bundling: 4/4 manifests (100.00%)
1774 bundling: abc.txt 0/4 files (0.00%)
1775 bundling: foo/Bar/file.txt 1/4 files (25.00%)
1776 bundling: foo/file.txt 2/4 files (50.00%)
1777 bundling: quux/file.py 3/4 files (75.00%)
1778 changesets: 1 chunks
1779 add changeset ef1ea85a6374
1780 changesets: 2 chunks
1781 add changeset f9cafe1212c8
1782 changesets: 3 chunks
1783 add changeset 911600dab2ae
1784 changesets: 4 chunks
1785 add changeset 4ea792ff6428
1786 adding manifests
1787 manifests: 1/4 chunks (25.00%)
1788 manifests: 2/4 chunks (50.00%)
1789 manifests: 3/4 chunks (75.00%)
1790 manifests: 4/4 chunks (100.00%)
1791 adding file changes
1792 adding abc.txt revisions
1793 files: 1/4 chunks (25.00%)
1794 adding foo/Bar/file.txt revisions
1795 files: 2/4 chunks (50.00%)
1796 adding foo/file.txt revisions
1797 files: 3/4 chunks (75.00%)
1798 adding quux/file.py revisions
1799 files: 4/4 chunks (100.00%)
1800 added 4 changesets with 4 changes to 4 files (+1 heads)
1801 calling hook pretxnchangegroup.acl: hgext.acl.hook
1802 acl: acl.allow.branches enabled, 1 entries for user george
1803 acl: acl.deny.branches not enabled
1804 acl: acl.allow not enabled
1805 acl: acl.deny not enabled
1806 acl: branch access granted: "ef1ea85a6374" on branch "default"
1807 acl: allowing changeset ef1ea85a6374
1808 acl: branch access granted: "f9cafe1212c8" on branch "default"
1809 acl: allowing changeset f9cafe1212c8
1810 acl: branch access granted: "911600dab2ae" on branch "default"
1811 acl: allowing changeset 911600dab2ae
1812 acl: branch access granted: "4ea792ff6428" on branch "foobar"
1813 acl: allowing changeset 4ea792ff6428
1814 updating the branch cache
1815 checking for updated bookmarks
1816 repository tip rolled back to revision 2 (undo push)
1817 working directory now based on revision 2
1818 2:07e028174695
1819
1820 Branch acl conflicting deny
1821
1822 $ init_config
1823 $ echo "[acl.deny.branches]" >> $config
1824 $ echo "foobar = astro" >> $config
1825 $ echo "default = astro" >> $config
1826 $ echo "* = george" >> $config
1827 $ do_push george
1828 Pushing as user george
1829 hgrc = """
1830 [acl]
1831 sources = push
1832 [extensions]
1833 [acl.deny.branches]
1834 foobar = astro
1835 default = astro
1836 * = george
1837 """
1838 pushing to ../b
1839 searching for changes
1840 common changesets up to 07e028174695
1841 invalidating branch cache (tip differs)
1842 4 changesets found
1843 list of changesets:
1844 ef1ea85a6374b77d6da9dcda9541f498f2d17df7
1845 f9cafe1212c8c6fa1120d14a556e18cc44ff8bdd
1846 911600dab2ae7a9baff75958b84fe606851ce955
1847 4ea792ff64284af438188103a0ee8aca1724fb8c
1848 adding changesets
1849 bundling: 1 changesets
1850 bundling: 2 changesets
1851 bundling: 3 changesets
1852 bundling: 4 changesets
1853 bundling: 1/4 manifests (25.00%)
1854 bundling: 2/4 manifests (50.00%)
1855 bundling: 3/4 manifests (75.00%)
1856 bundling: 4/4 manifests (100.00%)
1857 bundling: abc.txt 0/4 files (0.00%)
1858 bundling: foo/Bar/file.txt 1/4 files (25.00%)
1859 bundling: foo/file.txt 2/4 files (50.00%)
1860 bundling: quux/file.py 3/4 files (75.00%)
1861 changesets: 1 chunks
1862 add changeset ef1ea85a6374
1863 changesets: 2 chunks
1864 add changeset f9cafe1212c8
1865 changesets: 3 chunks
1866 add changeset 911600dab2ae
1867 changesets: 4 chunks
1868 add changeset 4ea792ff6428
1869 adding manifests
1870 manifests: 1/4 chunks (25.00%)
1871 manifests: 2/4 chunks (50.00%)
1872 manifests: 3/4 chunks (75.00%)
1873 manifests: 4/4 chunks (100.00%)
1874 adding file changes
1875 adding abc.txt revisions
1876 files: 1/4 chunks (25.00%)
1877 adding foo/Bar/file.txt revisions
1878 files: 2/4 chunks (50.00%)
1879 adding foo/file.txt revisions
1880 files: 3/4 chunks (75.00%)
1881 adding quux/file.py revisions
1882 files: 4/4 chunks (100.00%)
1883 added 4 changesets with 4 changes to 4 files (+1 heads)
1884 calling hook pretxnchangegroup.acl: hgext.acl.hook
1885 acl: acl.allow.branches not enabled
1886 acl: acl.deny.branches enabled, 1 entries for user george
1887 acl: acl.allow not enabled
1888 acl: acl.deny not enabled
1889 error: pretxnchangegroup.acl hook failed: acl: user "george" denied on branch "default" (changeset "ef1ea85a6374")
1890 transaction abort!
1891 rollback completed
1892 abort: acl: user "george" denied on branch "default" (changeset "ef1ea85a6374")
1893 no rollback information available
1894 2:07e028174695
1895
General Comments 0
You need to be logged in to leave comments. Login now