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