File: test-push-http

package info (click to toggle)
mercurial 1.6.4-1%2Bdeb6u1
  • links: PTS, VCS
  • area: main
  • in suites: squeeze-lts
  • size: 17,928 kB
  • ctags: 6,062
  • sloc: python: 44,238; sh: 20,985; tcl: 3,578; ansic: 2,557; lisp: 1,412; makefile: 176; xml: 15
file content (54 lines) | stat: -rwxr-xr-x 1,070 bytes parent folder | download | duplicates (2)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
#!/bin/sh

cp "$TESTDIR"/printenv.py .

hg init test
cd test
echo a > a
hg ci -Ama

cd ..
hg clone test test2
cd test2
echo a >> a
hg ci -mb

req() {
	hg serve -p $HGPORT -d --pid-file=hg.pid -E errors.log
	cat hg.pid >> $DAEMON_PIDS
	hg --cwd ../test2 push http://localhost:$HGPORT/ | sed -e "s,:$HGPORT/,:\$HGPORT/,"
	kill `cat hg.pid`
	echo % serve errors
	cat errors.log
}

cd ../test

echo % expect ssl error
req

echo % expect authorization error
echo '[web]' > .hg/hgrc
echo 'push_ssl = false' >> .hg/hgrc
req

echo % expect authorization error: must have authorized user
echo 'allow_push = unperson' >> .hg/hgrc
req

echo % expect success
echo 'allow_push = *' >> .hg/hgrc
echo '[hooks]' >> .hg/hgrc
echo 'changegroup = python ../printenv.py changegroup 0' >> .hg/hgrc
req

hg rollback
echo % expect authorization error: all users denied
echo '[web]' > .hg/hgrc
echo 'push_ssl = false' >> .hg/hgrc
echo 'deny_push = *' >> .hg/hgrc
req

echo % expect authorization error: some users denied, users must be authenticated
echo 'deny_push = unperson' >> .hg/hgrc
req