Show More
@@ -7,7 +7,7 b'' | |||
|
7 | 7 | # GNU General Public License version 2 or any later version. |
|
8 | 8 | |
|
9 | 9 | import os |
|
10 | from mercurial import ui, hg, hook, error, encoding, templater, util | |
|
10 | from mercurial import ui, hg, hook, error, encoding, templater, util, repoview | |
|
11 | 11 | from common import get_stat, ErrorResponse, permhooks, caching |
|
12 | 12 | from common import HTTP_OK, HTTP_NOT_MODIFIED, HTTP_BAD_REQUEST |
|
13 | 13 | from common import HTTP_NOT_FOUND, HTTP_SERVER_ERROR |
@@ -61,7 +61,7 b' class hgweb(object):' | |||
|
61 | 61 | else: |
|
62 | 62 | self.repo = repo |
|
63 | 63 | |
|
64 |
self.repo = |
|
|
64 | self.repo = self._getview(self.repo) | |
|
65 | 65 | self.repo.ui.setconfig('ui', 'report_untrusted', 'off') |
|
66 | 66 | self.repo.ui.setconfig('ui', 'nontty', 'true') |
|
67 | 67 | hook.redirect(True) |
@@ -88,6 +88,15 b' class hgweb(object):' | |||
|
88 | 88 | return self.repo.ui.configlist(section, name, default, |
|
89 | 89 | untrusted=untrusted) |
|
90 | 90 | |
|
91 | def _getview(self, repo): | |
|
92 | viewconfig = self.config('web', 'view', 'served') | |
|
93 | if viewconfig == 'all': | |
|
94 | return repo.unfiltered() | |
|
95 | elif viewconfig in repoview.filtertable: | |
|
96 | return repo.filtered(viewconfig) | |
|
97 | else: | |
|
98 | return repo.filtered('served') | |
|
99 | ||
|
91 | 100 | def refresh(self, request=None): |
|
92 | 101 | if request: |
|
93 | 102 | self.repo.ui.environ = request.env |
@@ -98,7 +107,7 b' class hgweb(object):' | |||
|
98 | 107 | self.mtime = st.st_mtime |
|
99 | 108 | self.size = st.st_size |
|
100 | 109 | self.repo = hg.repository(self.repo.ui, self.repo.root) |
|
101 |
self.repo = |
|
|
110 | self.repo = self._getview(self.repo) | |
|
102 | 111 | self.maxchanges = int(self.config("web", "maxchanges", 10)) |
|
103 | 112 | self.stripecount = int(self.config("web", "stripes", 1)) |
|
104 | 113 | self.maxshortchanges = int(self.config("web", "maxshortchanges", |
@@ -743,6 +743,24 b' check filelog view' | |||
|
743 | 743 | |
|
744 | 744 | $ "$TESTDIR/get-with-headers.py" --headeronly localhost:$HGPORT 'log/'`hg id --debug --id`/'babar' |
|
745 | 745 | 200 Script output follows |
|
746 | ||
|
747 | $ "$TESTDIR/get-with-headers.py" --headeronly localhost:$HGPORT 'rev/68' | |
|
748 | 200 Script output follows | |
|
749 | $ "$TESTDIR/get-with-headers.py" --headeronly localhost:$HGPORT 'rev/67' | |
|
750 | 500 Internal Server Error | |
|
751 | [1] | |
|
752 | ||
|
753 | check that web.view config option: | |
|
754 | ||
|
755 | $ kill `cat hg.pid` | |
|
756 | $ cat >> .hg/hgrc << EOF | |
|
757 | > [web] | |
|
758 | > view=all | |
|
759 | > EOF | |
|
760 | $ wait | |
|
761 | $ hg serve -n test -p $HGPORT -d --pid-file=hg.pid -A access.log -E errors.log | |
|
762 | $ "$TESTDIR/get-with-headers.py" --headeronly localhost:$HGPORT 'rev/67' | |
|
763 | 200 Script output follows | |
|
746 | 764 | $ kill `cat hg.pid` |
|
747 | 765 | |
|
748 | 766 | Checking _enable=False warning if obsolete marker exists |
General Comments 0
You need to be logged in to leave comments.
Login now