comparison tests/test-hgwebdir.t @ 31482:da7d19324b1e

hgwebdir: add support for explicit index files This is useful for when repositories are nested in --web-conf, and in the future with hosted subrepositories. The previous behavior was only to render an index at each virtual directory. There is now an explicit 'index' child for each virtual directory. The name was suggested by Yuya, for consistency with the other method names. Additionally, there is now an explicit 'index' child for every repository directory with a nested repository somewhere below it. This seems more consistent with each virtual directory hosting an index, and more discoverable than to only have an index for a directory that directly hosts a nested repository. I couldn't figure out how to close the loop and provide one in each directory without a deeper nested repository, without blocking a committed 'index' file. Keeping that seems better than rendering an empty index.
author Matt Harbison <matt_harbison@yahoo.com>
date Sun, 05 Mar 2017 22:22:32 -0500
parents 636cf3f7620d
children 594dd384803c
comparison
equal deleted inserted replaced
31481:a7c687c35119 31482:da7d19324b1e
1564 1564
1565 /a/ 1565 /a/
1566 /b/ 1566 /b/
1567 /c/ 1567 /c/
1568 1568
1569 $ killdaemons.py
1570 $ cat > paths.conf << EOF
1571 > [paths]
1572 > /dir1/a_repo = $root/a
1573 > /dir1/a_repo/b_repo = $root/b
1574 > /dir1/dir2/index = $root/b
1575 > EOF
1576 $ hg serve -p $HGPORT1 -d --pid-file hg.pid --webdir-conf paths.conf
1577 $ cat hg.pid >> $DAEMON_PIDS
1578
1579 $ echo 'index file' > $root/a/index
1580 $ hg --cwd $root/a ci -Am 'add index file'
1581 adding index
1582
1583 $ get-with-headers.py localhost:$HGPORT1 '' | grep 'a_repo'
1584 <td><a href="/dir1/a_repo/">dir1/a_repo</a></td>
1585 <a href="/dir1/a_repo/atom-log" title="subscribe to repository atom feed">
1586 <td><a href="/dir1/a_repo/b_repo/">dir1/a_repo/b_repo</a></td>
1587 <a href="/dir1/a_repo/b_repo/atom-log" title="subscribe to repository atom feed">
1588
1589 $ get-with-headers.py localhost:$HGPORT1 'index' | grep 'a_repo'
1590 <td><a href="/dir1/a_repo/">dir1/a_repo</a></td>
1591 <a href="/dir1/a_repo/atom-log" title="subscribe to repository atom feed">
1592 <td><a href="/dir1/a_repo/b_repo/">dir1/a_repo/b_repo</a></td>
1593 <a href="/dir1/a_repo/b_repo/atom-log" title="subscribe to repository atom feed">
1594
1595 $ get-with-headers.py localhost:$HGPORT1 'dir1' | grep 'a_repo'
1596 <td><a href="/dir1/a_repo/">a_repo</a></td>
1597 <a href="/dir1/a_repo/atom-log" title="subscribe to repository atom feed">
1598 <td><a href="/dir1/a_repo/b_repo/">a_repo/b_repo</a></td>
1599 <a href="/dir1/a_repo/b_repo/atom-log" title="subscribe to repository atom feed">
1600
1601 $ get-with-headers.py localhost:$HGPORT1 'dir1/index' | grep 'a_repo'
1602 <td><a href="/dir1/a_repo/">a_repo</a></td>
1603 <a href="/dir1/a_repo/atom-log" title="subscribe to repository atom feed">
1604 <td><a href="/dir1/a_repo/b_repo/">a_repo/b_repo</a></td>
1605 <a href="/dir1/a_repo/b_repo/atom-log" title="subscribe to repository atom feed">
1606
1607 $ get-with-headers.py localhost:$HGPORT1 'dir1/a_repo' | grep 'a_repo'
1608 <link rel="icon" href="/dir1/a_repo/static/hgicon.png" type="image/png" />
1609 <link rel="stylesheet" href="/dir1/a_repo/static/style-paper.css" type="text/css" />
1610 <script type="text/javascript" src="/dir1/a_repo/static/mercurial.js"></script>
1611 <title>dir1/a_repo: log</title>
1612 href="/dir1/a_repo/atom-log" title="Atom feed for dir1/a_repo" />
1613 href="/dir1/a_repo/rss-log" title="RSS feed for dir1/a_repo" />
1614 <img src="/dir1/a_repo/static/hglogo.png" alt="mercurial" /></a>
1615 <li><a href="/dir1/a_repo/graph/tip">graph</a></li>
1616 <li><a href="/dir1/a_repo/tags">tags</a></li>
1617 <li><a href="/dir1/a_repo/bookmarks">bookmarks</a></li>
1618 <li><a href="/dir1/a_repo/branches">branches</a></li>
1619 <li><a href="/dir1/a_repo/rev/tip">changeset</a></li>
1620 <li><a href="/dir1/a_repo/file/tip">browse</a></li>
1621 <li><a href="/dir1/a_repo/help">help</a></li>
1622 <a href="/dir1/a_repo/atom-log" title="subscribe to atom feed">
1623 <img class="atom-logo" src="/dir1/a_repo/static/feed-icon-14x14.png" alt="atom feed" />
1624 <h2 class="breadcrumb"><a href="/">Mercurial</a> &gt; <a href="/dir1">dir1</a> &gt; <a href="/dir1/a_repo">a_repo</a> </h2>
1625 <form class="search" action="/dir1/a_repo/log">
1626 number or hash, or <a href="/dir1/a_repo/help/revsets">revset expression</a>.</div>
1627 <a href="/dir1/a_repo/shortlog/tip?revcount=30">less</a>
1628 <a href="/dir1/a_repo/shortlog/tip?revcount=120">more</a>
1629 | rev 1: <a href="/dir1/a_repo/shortlog/8580ff50825a">(0)</a> <a href="/dir1/a_repo/shortlog/tip">tip</a>
1630 <a href="/dir1/a_repo/rev/71a89161f014">add index file</a>
1631 <a href="/dir1/a_repo/rev/8580ff50825a">a</a>
1632 <a href="/dir1/a_repo/shortlog/tip?revcount=30">less</a>
1633 <a href="/dir1/a_repo/shortlog/tip?revcount=120">more</a>
1634 | rev 1: <a href="/dir1/a_repo/shortlog/8580ff50825a">(0)</a> <a href="/dir1/a_repo/shortlog/tip">tip</a>
1635 '/dir1/a_repo/shortlog/%next%',
1636
1637 $ get-with-headers.py localhost:$HGPORT1 'dir1/a_repo/index' | grep 'a_repo'
1638 <h2 class="breadcrumb"><a href="/">Mercurial</a> &gt; <a href="/dir1">dir1</a> &gt; <a href="/dir1/a_repo">a_repo</a> </h2>
1639 <td><a href="/dir1/a_repo/b_repo/">b_repo</a></td>
1640 <a href="/dir1/a_repo/b_repo/atom-log" title="subscribe to repository atom feed">
1641
1642 Files named 'index' are not blocked
1643
1644 $ get-with-headers.py localhost:$HGPORT1 'dir1/a_repo/raw-file/tip/index'
1645 200 Script output follows
1646
1647 index file
1648
1649 Repos named 'index' take precedence over the index file
1650
1651 $ get-with-headers.py localhost:$HGPORT1 'dir1/dir2/index' | grep 'index'
1652 <link rel="icon" href="/dir1/dir2/index/static/hgicon.png" type="image/png" />
1653 <meta name="robots" content="index, nofollow" />
1654 <link rel="stylesheet" href="/dir1/dir2/index/static/style-paper.css" type="text/css" />
1655 <script type="text/javascript" src="/dir1/dir2/index/static/mercurial.js"></script>
1656 <title>dir1/dir2/index: log</title>
1657 href="/dir1/dir2/index/atom-log" title="Atom feed for dir1/dir2/index" />
1658 href="/dir1/dir2/index/rss-log" title="RSS feed for dir1/dir2/index" />
1659 <img src="/dir1/dir2/index/static/hglogo.png" alt="mercurial" /></a>
1660 <li><a href="/dir1/dir2/index/graph/tip">graph</a></li>
1661 <li><a href="/dir1/dir2/index/tags">tags</a></li>
1662 <li><a href="/dir1/dir2/index/bookmarks">bookmarks</a></li>
1663 <li><a href="/dir1/dir2/index/branches">branches</a></li>
1664 <li><a href="/dir1/dir2/index/rev/tip">changeset</a></li>
1665 <li><a href="/dir1/dir2/index/file/tip">browse</a></li>
1666 <li><a href="/dir1/dir2/index/help">help</a></li>
1667 <a href="/dir1/dir2/index/atom-log" title="subscribe to atom feed">
1668 <img class="atom-logo" src="/dir1/dir2/index/static/feed-icon-14x14.png" alt="atom feed" />
1669 <h2 class="breadcrumb"><a href="/">Mercurial</a> &gt; <a href="/dir1">dir1</a> &gt; <a href="/dir1/dir2">dir2</a> &gt; <a href="/dir1/dir2/index">index</a> </h2>
1670 <form class="search" action="/dir1/dir2/index/log">
1671 number or hash, or <a href="/dir1/dir2/index/help/revsets">revset expression</a>.</div>
1672 <a href="/dir1/dir2/index/shortlog/tip?revcount=30">less</a>
1673 <a href="/dir1/dir2/index/shortlog/tip?revcount=120">more</a>
1674 | rev 0: <a href="/dir1/dir2/index/shortlog/39505516671b">(0)</a> <a href="/dir1/dir2/index/shortlog/tip">tip</a>
1675 <a href="/dir1/dir2/index/rev/39505516671b">b</a>
1676 <a href="/dir1/dir2/index/shortlog/tip?revcount=30">less</a>
1677 <a href="/dir1/dir2/index/shortlog/tip?revcount=120">more</a>
1678 | rev 0: <a href="/dir1/dir2/index/shortlog/39505516671b">(0)</a> <a href="/dir1/dir2/index/shortlog/tip">tip</a>
1679 '/dir1/dir2/index/shortlog/%next%',
1680
1681 $ killdaemons.py
1569 1682
1570 paths errors 1 1683 paths errors 1
1571 1684
1572 $ cat error-paths-1.log 1685 $ cat error-paths-1.log
1573 1686