##// END OF EJS Templates
http: add a test of actually pushing with httppostargs...
Augie Fackler -
r33664:970967e0 default
parent child Browse files
Show More
@@ -1,175 +1,191 b''
1 #require killdaemons
1 #require killdaemons
2
2
3 $ hg init test
3 $ hg init test
4 $ cd test
4 $ cd test
5 $ echo a > a
5 $ echo a > a
6 $ hg ci -Ama
6 $ hg ci -Ama
7 adding a
7 adding a
8 $ cd ..
8 $ cd ..
9 $ hg clone test test2
9 $ hg clone test test2
10 updating to branch default
10 updating to branch default
11 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
11 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
12 $ cd test2
12 $ cd test2
13 $ echo a >> a
13 $ echo a >> a
14 $ hg ci -mb
14 $ hg ci -mb
15 $ req() {
15 $ req() {
16 > hg serve -p $HGPORT -d --pid-file=hg.pid -E errors.log
16 > hg serve -p $HGPORT -d --pid-file=hg.pid -E errors.log
17 > cat hg.pid >> $DAEMON_PIDS
17 > cat hg.pid >> $DAEMON_PIDS
18 > hg --cwd ../test2 push http://localhost:$HGPORT/
18 > hg --cwd ../test2 push http://localhost:$HGPORT/
19 > exitstatus=$?
19 > exitstatus=$?
20 > killdaemons.py
20 > killdaemons.py
21 > echo % serve errors
21 > echo % serve errors
22 > cat errors.log
22 > cat errors.log
23 > return $exitstatus
23 > return $exitstatus
24 > }
24 > }
25 $ cd ../test
25 $ cd ../test
26
26
27 expect ssl error
27 expect ssl error
28
28
29 $ req
29 $ req
30 pushing to http://localhost:$HGPORT/
30 pushing to http://localhost:$HGPORT/
31 searching for changes
31 searching for changes
32 abort: HTTP Error 403: ssl required
32 abort: HTTP Error 403: ssl required
33 % serve errors
33 % serve errors
34 [255]
34 [255]
35
35
36 expect authorization error
36 expect authorization error
37
37
38 $ echo '[web]' > .hg/hgrc
38 $ echo '[web]' > .hg/hgrc
39 $ echo 'push_ssl = false' >> .hg/hgrc
39 $ echo 'push_ssl = false' >> .hg/hgrc
40 $ req
40 $ req
41 pushing to http://localhost:$HGPORT/
41 pushing to http://localhost:$HGPORT/
42 searching for changes
42 searching for changes
43 abort: authorization failed
43 abort: authorization failed
44 % serve errors
44 % serve errors
45 [255]
45 [255]
46
46
47 expect authorization error: must have authorized user
47 expect authorization error: must have authorized user
48
48
49 $ echo 'allow_push = unperson' >> .hg/hgrc
49 $ echo 'allow_push = unperson' >> .hg/hgrc
50 $ req
50 $ req
51 pushing to http://localhost:$HGPORT/
51 pushing to http://localhost:$HGPORT/
52 searching for changes
52 searching for changes
53 abort: authorization failed
53 abort: authorization failed
54 % serve errors
54 % serve errors
55 [255]
55 [255]
56
56
57 expect success
57 expect success
58
58
59 $ cat >> .hg/hgrc <<EOF
59 $ cat >> .hg/hgrc <<EOF
60 > allow_push = *
60 > allow_push = *
61 > [hooks]
61 > [hooks]
62 > changegroup = sh -c "printenv.py changegroup 0"
62 > changegroup = sh -c "printenv.py changegroup 0"
63 > pushkey = sh -c "printenv.py pushkey 0"
63 > pushkey = sh -c "printenv.py pushkey 0"
64 > EOF
64 > EOF
65 $ req
65 $ req
66 pushing to http://localhost:$HGPORT/
66 pushing to http://localhost:$HGPORT/
67 searching for changes
67 searching for changes
68 remote: adding changesets
68 remote: adding changesets
69 remote: adding manifests
69 remote: adding manifests
70 remote: adding file changes
70 remote: adding file changes
71 remote: added 1 changesets with 1 changes to 1 files
71 remote: added 1 changesets with 1 changes to 1 files
72 remote: pushkey hook: HG_HOOKNAME=pushkey HG_HOOKTYPE=pushkey HG_KEY=ba677d0156c1196c1a699fa53f390dcfc3ce3872 HG_NAMESPACE=phases HG_NEW=0 HG_OLD=1 HG_RET=1
72 remote: pushkey hook: HG_HOOKNAME=pushkey HG_HOOKTYPE=pushkey HG_KEY=ba677d0156c1196c1a699fa53f390dcfc3ce3872 HG_NAMESPACE=phases HG_NEW=0 HG_OLD=1 HG_RET=1
73 remote: changegroup hook: HG_BUNDLE2=1 HG_HOOKNAME=changegroup HG_HOOKTYPE=changegroup HG_NODE=ba677d0156c1196c1a699fa53f390dcfc3ce3872 HG_NODE_LAST=ba677d0156c1196c1a699fa53f390dcfc3ce3872 HG_SOURCE=serve HG_TXNID=TXN:$ID$ HG_URL=remote:http:$LOCALIP: (glob)
73 remote: changegroup hook: HG_BUNDLE2=1 HG_HOOKNAME=changegroup HG_HOOKTYPE=changegroup HG_NODE=ba677d0156c1196c1a699fa53f390dcfc3ce3872 HG_NODE_LAST=ba677d0156c1196c1a699fa53f390dcfc3ce3872 HG_SOURCE=serve HG_TXNID=TXN:$ID$ HG_URL=remote:http:$LOCALIP: (glob)
74 % serve errors
74 % serve errors
75 $ hg rollback
75 $ hg rollback
76 repository tip rolled back to revision 0 (undo serve)
76 repository tip rolled back to revision 0 (undo serve)
77
77
78 expect success, server lacks the httpheader capability
78 expect success, server lacks the httpheader capability
79
79
80 $ CAP=httpheader
80 $ CAP=httpheader
81 $ . "$TESTDIR/notcapable"
81 $ . "$TESTDIR/notcapable"
82 $ req
82 $ req
83 pushing to http://localhost:$HGPORT/
83 pushing to http://localhost:$HGPORT/
84 searching for changes
84 searching for changes
85 remote: adding changesets
85 remote: adding changesets
86 remote: adding manifests
86 remote: adding manifests
87 remote: adding file changes
87 remote: adding file changes
88 remote: added 1 changesets with 1 changes to 1 files
88 remote: added 1 changesets with 1 changes to 1 files
89 remote: pushkey hook: HG_HOOKNAME=pushkey HG_HOOKTYPE=pushkey HG_KEY=ba677d0156c1196c1a699fa53f390dcfc3ce3872 HG_NAMESPACE=phases HG_NEW=0 HG_OLD=1 HG_RET=1
89 remote: pushkey hook: HG_HOOKNAME=pushkey HG_HOOKTYPE=pushkey HG_KEY=ba677d0156c1196c1a699fa53f390dcfc3ce3872 HG_NAMESPACE=phases HG_NEW=0 HG_OLD=1 HG_RET=1
90 remote: changegroup hook: HG_BUNDLE2=1 HG_HOOKNAME=changegroup HG_HOOKTYPE=changegroup HG_NODE=ba677d0156c1196c1a699fa53f390dcfc3ce3872 HG_NODE_LAST=ba677d0156c1196c1a699fa53f390dcfc3ce3872 HG_SOURCE=serve HG_TXNID=TXN:$ID$ HG_URL=remote:http:$LOCALIP: (glob)
90 remote: changegroup hook: HG_BUNDLE2=1 HG_HOOKNAME=changegroup HG_HOOKTYPE=changegroup HG_NODE=ba677d0156c1196c1a699fa53f390dcfc3ce3872 HG_NODE_LAST=ba677d0156c1196c1a699fa53f390dcfc3ce3872 HG_SOURCE=serve HG_TXNID=TXN:$ID$ HG_URL=remote:http:$LOCALIP: (glob)
91 % serve errors
91 % serve errors
92 $ hg rollback
92 $ hg rollback
93 repository tip rolled back to revision 0 (undo serve)
93 repository tip rolled back to revision 0 (undo serve)
94
94
95 expect success, server lacks the unbundlehash capability
95 expect success, server lacks the unbundlehash capability
96
96
97 $ CAP=unbundlehash
97 $ CAP=unbundlehash
98 $ . "$TESTDIR/notcapable"
98 $ . "$TESTDIR/notcapable"
99 $ req
99 $ req
100 pushing to http://localhost:$HGPORT/
100 pushing to http://localhost:$HGPORT/
101 searching for changes
101 searching for changes
102 remote: adding changesets
102 remote: adding changesets
103 remote: adding manifests
103 remote: adding manifests
104 remote: adding file changes
104 remote: adding file changes
105 remote: added 1 changesets with 1 changes to 1 files
105 remote: added 1 changesets with 1 changes to 1 files
106 remote: pushkey hook: HG_HOOKNAME=pushkey HG_HOOKTYPE=pushkey HG_KEY=ba677d0156c1196c1a699fa53f390dcfc3ce3872 HG_NAMESPACE=phases HG_NEW=0 HG_OLD=1 HG_RET=1
106 remote: pushkey hook: HG_HOOKNAME=pushkey HG_HOOKTYPE=pushkey HG_KEY=ba677d0156c1196c1a699fa53f390dcfc3ce3872 HG_NAMESPACE=phases HG_NEW=0 HG_OLD=1 HG_RET=1
107 remote: changegroup hook: HG_BUNDLE2=1 HG_HOOKNAME=changegroup HG_HOOKTYPE=changegroup HG_NODE=ba677d0156c1196c1a699fa53f390dcfc3ce3872 HG_NODE_LAST=ba677d0156c1196c1a699fa53f390dcfc3ce3872 HG_SOURCE=serve HG_TXNID=TXN:$ID$ HG_URL=remote:http:$LOCALIP: (glob)
107 remote: changegroup hook: HG_BUNDLE2=1 HG_HOOKNAME=changegroup HG_HOOKTYPE=changegroup HG_NODE=ba677d0156c1196c1a699fa53f390dcfc3ce3872 HG_NODE_LAST=ba677d0156c1196c1a699fa53f390dcfc3ce3872 HG_SOURCE=serve HG_TXNID=TXN:$ID$ HG_URL=remote:http:$LOCALIP: (glob)
108 % serve errors
108 % serve errors
109 $ hg rollback
109 $ hg rollback
110 repository tip rolled back to revision 0 (undo serve)
110 repository tip rolled back to revision 0 (undo serve)
111
111
112 expect push success, phase change failure
112 expect push success, phase change failure
113
113
114 $ cat > .hg/hgrc <<EOF
114 $ cat > .hg/hgrc <<EOF
115 > [web]
115 > [web]
116 > push_ssl = false
116 > push_ssl = false
117 > allow_push = *
117 > allow_push = *
118 > [hooks]
118 > [hooks]
119 > prepushkey = sh -c "printenv.py prepushkey 1"
119 > prepushkey = sh -c "printenv.py prepushkey 1"
120 > EOF
120 > EOF
121 $ req
121 $ req
122 pushing to http://localhost:$HGPORT/
122 pushing to http://localhost:$HGPORT/
123 searching for changes
123 searching for changes
124 remote: adding changesets
124 remote: adding changesets
125 remote: adding manifests
125 remote: adding manifests
126 remote: adding file changes
126 remote: adding file changes
127 remote: added 1 changesets with 1 changes to 1 files
127 remote: added 1 changesets with 1 changes to 1 files
128 remote: prepushkey hook: HG_BUNDLE2=1 HG_HOOKNAME=prepushkey HG_HOOKTYPE=prepushkey HG_KEY=ba677d0156c1196c1a699fa53f390dcfc3ce3872 HG_NAMESPACE=phases HG_NEW=0 HG_NODE=ba677d0156c1196c1a699fa53f390dcfc3ce3872 HG_NODE_LAST=ba677d0156c1196c1a699fa53f390dcfc3ce3872 HG_OLD=1 HG_PENDING=$TESTTMP/test HG_PHASES_MOVED=1 HG_SOURCE=serve HG_TXNID=TXN:$ID$ HG_URL=remote:http:$LOCALIP: (glob)
128 remote: prepushkey hook: HG_BUNDLE2=1 HG_HOOKNAME=prepushkey HG_HOOKTYPE=prepushkey HG_KEY=ba677d0156c1196c1a699fa53f390dcfc3ce3872 HG_NAMESPACE=phases HG_NEW=0 HG_NODE=ba677d0156c1196c1a699fa53f390dcfc3ce3872 HG_NODE_LAST=ba677d0156c1196c1a699fa53f390dcfc3ce3872 HG_OLD=1 HG_PENDING=$TESTTMP/test HG_PHASES_MOVED=1 HG_SOURCE=serve HG_TXNID=TXN:$ID$ HG_URL=remote:http:$LOCALIP: (glob)
129 remote: pushkey-abort: prepushkey hook exited with status 1
129 remote: pushkey-abort: prepushkey hook exited with status 1
130 remote: transaction abort!
130 remote: transaction abort!
131 remote: rollback completed
131 remote: rollback completed
132 abort: updating ba677d0156c1 to public failed
132 abort: updating ba677d0156c1 to public failed
133 % serve errors
133 % serve errors
134 [255]
134 [255]
135
135
136 expect phase change success
136 expect phase change success
137
137
138 $ cat >> .hg/hgrc <<EOF
138 $ cat >> .hg/hgrc <<EOF
139 > prepushkey = sh -c "printenv.py prepushkey 0"
139 > prepushkey = sh -c "printenv.py prepushkey 0"
140 > EOF
140 > EOF
141 $ req
141 $ req
142 pushing to http://localhost:$HGPORT/
142 pushing to http://localhost:$HGPORT/
143 searching for changes
143 searching for changes
144 remote: adding changesets
144 remote: adding changesets
145 remote: adding manifests
145 remote: adding manifests
146 remote: adding file changes
146 remote: adding file changes
147 remote: added 1 changesets with 1 changes to 1 files
147 remote: added 1 changesets with 1 changes to 1 files
148 remote: prepushkey hook: HG_BUNDLE2=1 HG_HOOKNAME=prepushkey HG_HOOKTYPE=prepushkey HG_KEY=ba677d0156c1196c1a699fa53f390dcfc3ce3872 HG_NAMESPACE=phases HG_NEW=0 HG_NODE=ba677d0156c1196c1a699fa53f390dcfc3ce3872 HG_NODE_LAST=ba677d0156c1196c1a699fa53f390dcfc3ce3872 HG_OLD=1 HG_PENDING=$TESTTMP/test HG_PHASES_MOVED=1 HG_SOURCE=serve HG_TXNID=TXN:$ID$ HG_URL=remote:http:$LOCALIP: (glob)
148 remote: prepushkey hook: HG_BUNDLE2=1 HG_HOOKNAME=prepushkey HG_HOOKTYPE=prepushkey HG_KEY=ba677d0156c1196c1a699fa53f390dcfc3ce3872 HG_NAMESPACE=phases HG_NEW=0 HG_NODE=ba677d0156c1196c1a699fa53f390dcfc3ce3872 HG_NODE_LAST=ba677d0156c1196c1a699fa53f390dcfc3ce3872 HG_OLD=1 HG_PENDING=$TESTTMP/test HG_PHASES_MOVED=1 HG_SOURCE=serve HG_TXNID=TXN:$ID$ HG_URL=remote:http:$LOCALIP: (glob)
149 % serve errors
149 % serve errors
150 $ hg rollback
150 $ hg rollback
151 repository tip rolled back to revision 0 (undo serve)
151 repository tip rolled back to revision 0 (undo serve)
152
152
153 expect authorization error: all users denied
153 expect authorization error: all users denied
154
154
155 $ echo '[web]' > .hg/hgrc
155 $ echo '[web]' > .hg/hgrc
156 $ echo 'push_ssl = false' >> .hg/hgrc
156 $ echo 'push_ssl = false' >> .hg/hgrc
157 $ echo 'deny_push = *' >> .hg/hgrc
157 $ echo 'deny_push = *' >> .hg/hgrc
158 $ req
158 $ req
159 pushing to http://localhost:$HGPORT/
159 pushing to http://localhost:$HGPORT/
160 searching for changes
160 searching for changes
161 abort: authorization failed
161 abort: authorization failed
162 % serve errors
162 % serve errors
163 [255]
163 [255]
164
164
165 expect authorization error: some users denied, users must be authenticated
165 expect authorization error: some users denied, users must be authenticated
166
166
167 $ echo 'deny_push = unperson' >> .hg/hgrc
167 $ echo 'deny_push = unperson' >> .hg/hgrc
168 $ req
168 $ req
169 pushing to http://localhost:$HGPORT/
169 pushing to http://localhost:$HGPORT/
170 searching for changes
170 searching for changes
171 abort: authorization failed
171 abort: authorization failed
172 % serve errors
172 % serve errors
173 [255]
173 [255]
174
174
175 $ cat > .hg/hgrc <<EOF
176 > [web]
177 > push_ssl = false
178 > allow_push = *
179 > [experimental]
180 > httppostargs=true
181 > EOF
182 $ req
183 pushing to http://localhost:$HGPORT/
184 searching for changes
185 remote: adding changesets
186 remote: adding manifests
187 remote: adding file changes
188 remote: added 1 changesets with 1 changes to 1 files
189 % serve errors
190
175 $ cd ..
191 $ cd ..
General Comments 0
You need to be logged in to leave comments. Login now