Show More
@@ -0,0 +1,38 b'' | |||
|
1 | $ hg init test | |
|
2 | $ cd test | |
|
3 | $ hg debugbuilddag '+2' | |
|
4 | $ hg phase --public 0 | |
|
5 | ||
|
6 | $ hg serve -p $HGPORT -d --pid-file=hg.pid -E errors.log | |
|
7 | $ cat hg.pid >> $DAEMON_PIDS | |
|
8 | $ cd .. | |
|
9 | $ hg init test2 | |
|
10 | $ cd test2 | |
|
11 | $ hg incoming http://foo:xyzzy@localhost:$HGPORT/ | |
|
12 | comparing with http://foo:***@localhost:$HGPORT/ | |
|
13 | changeset: 0:1ea73414a91b | |
|
14 | user: debugbuilddag | |
|
15 | date: Thu Jan 01 00:00:00 1970 +0000 | |
|
16 | summary: r0 | |
|
17 | ||
|
18 | changeset: 1:66f7d451a68b | |
|
19 | tag: tip | |
|
20 | user: debugbuilddag | |
|
21 | date: Thu Jan 01 00:00:01 1970 +0000 | |
|
22 | summary: r1 | |
|
23 | ||
|
24 | $ killdaemons.py | |
|
25 | ||
|
26 | $ cd ../test | |
|
27 | $ hg --config server.view=immutable serve -p $HGPORT -d --pid-file=hg.pid -E errors.log | |
|
28 | $ cat hg.pid >> $DAEMON_PIDS | |
|
29 | $ cd ../test2 | |
|
30 | $ hg incoming http://foo:xyzzy@localhost:$HGPORT/ | |
|
31 | comparing with http://foo:***@localhost:$HGPORT/ | |
|
32 | changeset: 0:1ea73414a91b | |
|
33 | tag: tip | |
|
34 | user: debugbuilddag | |
|
35 | date: Thu Jan 01 00:00:00 1970 +0000 | |
|
36 | summary: r0 | |
|
37 | ||
|
38 | $ killdaemons.py |
@@ -1041,6 +1041,9 b" coreconfigitem('server', 'uncompressed'," | |||
|
1041 | 1041 | coreconfigitem('server', 'uncompressedallowsecret', |
|
1042 | 1042 | default=False, |
|
1043 | 1043 | ) |
|
1044 | coreconfigitem('server', 'view', | |
|
1045 | default='served', | |
|
1046 | ) | |
|
1044 | 1047 | coreconfigitem('server', 'validate', |
|
1045 | 1048 | default=False, |
|
1046 | 1049 | ) |
@@ -2028,6 +2028,12 b' Controls generic server settings.' | |||
|
2028 | 2028 | |
|
2029 | 2029 | See also ``server.zliblevel``. |
|
2030 | 2030 | |
|
2031 | ``view`` | |
|
2032 | Repository filter used when exchanging revisions with the peer. | |
|
2033 | ||
|
2034 | The default view (``served``) excludes secret and hidden changesets. | |
|
2035 | Another useful value is ``immutable`` (no draft, secret or hidden changesets). | |
|
2036 | ||
|
2031 | 2037 | ``smtp`` |
|
2032 | 2038 | -------- |
|
2033 | 2039 |
@@ -64,7 +64,8 b' def getdispatchrepo(repo, proto, command' | |||
|
64 | 64 | extensions that need commands to operate on different repo views under |
|
65 | 65 | specialized circumstances. |
|
66 | 66 | """ |
|
67 | return repo.filtered('served') | |
|
67 | viewconfig = repo.ui.config('server', 'view') | |
|
68 | return repo.filtered(viewconfig) | |
|
68 | 69 | |
|
69 | 70 | def dispatch(repo, proto, command): |
|
70 | 71 | repo = getdispatchrepo(repo, proto, command) |
@@ -166,7 +167,6 b' def wireprotocommand(name, args=None, pe' | |||
|
166 | 167 | @wireprotocommand('batch', 'cmds *', permission='pull') |
|
167 | 168 | def batch(repo, proto, cmds, others): |
|
168 | 169 | unescapearg = wireprototypes.unescapebatcharg |
|
169 | repo = repo.filtered("served") | |
|
170 | 170 | res = [] |
|
171 | 171 | for pair in cmds.split(';'): |
|
172 | 172 | op, args = pair.split(' ', 1) |
@@ -342,7 +342,8 b' def _httpv2runcommand(ui, repo, req, res' | |||
|
342 | 342 | action) |
|
343 | 343 | |
|
344 | 344 | def getdispatchrepo(repo, proto, command): |
|
345 | return repo.filtered('served') | |
|
345 | viewconfig = repo.ui.config('server', 'view') | |
|
346 | return repo.filtered(viewconfig) | |
|
346 | 347 | |
|
347 | 348 | def dispatch(repo, proto, command, redirect): |
|
348 | 349 | """Run a wire protocol command. |
@@ -78,6 +78,9 b' class clientpeer(wireprotov1peer.wirepee' | |||
|
78 | 78 | yield unmangle(f.value) |
|
79 | 79 | |
|
80 | 80 | class serverrepo(object): |
|
81 | def __init__(self, ui): | |
|
82 | self.ui = ui | |
|
83 | ||
|
81 | 84 | def greet(self, name): |
|
82 | 85 | return b"Hello, " + name |
|
83 | 86 | |
@@ -94,7 +97,7 b' def greet(repo, proto, name):' | |||
|
94 | 97 | |
|
95 | 98 | wireprotov1server.commands[b'greet'] = (greet, b'name') |
|
96 | 99 | |
|
97 | srv = serverrepo() | |
|
100 | srv = serverrepo(uimod.ui()) | |
|
98 | 101 | clt = clientpeer(srv, uimod.ui()) |
|
99 | 102 | |
|
100 | 103 | def printb(data, end=b'\n'): |
General Comments 0
You need to be logged in to leave comments.
Login now