comparison tests/test-http.t @ 17342:471f30d360ea stable

clone: don't fail with --update for non-local clones (issue3578) This was broken by 5884812686f7 due to lack of test coverage. This adds a test and fixes the defect.
author Augie Fackler <raf@durin42.com>
date Wed, 08 Aug 2012 10:04:02 -0500
parents e432fb4b4221
children 7d589d923b8a
comparison
equal deleted inserted replaced
17340:96189d60d810 17342:471f30d360ea
75 $ echo bar > bar 75 $ echo bar > bar
76 $ hg commit -A -d '1 0' -m 2 76 $ hg commit -A -d '1 0' -m 2
77 adding bar 77 adding bar
78 $ cd .. 78 $ cd ..
79 79
80 clone over http with --update
81
82 $ hg clone http://localhost:$HGPORT1/ updated --update 0
83 requesting all changes
84 adding changesets
85 adding manifests
86 adding file changes
87 added 2 changesets with 5 changes to 5 files
88 updating to branch default
89 4 files updated, 0 files merged, 0 files removed, 0 files unresolved
90 $ hg log -r . -R updated
91 changeset: 0:8b6053c928fe
92 user: test
93 date: Thu Jan 01 00:00:00 1970 +0000
94 summary: 1
95
96 $ rm -rf updated
97
80 incoming via HTTP 98 incoming via HTTP
81 99
82 $ hg clone http://localhost:$HGPORT1/ --rev 0 partial 100 $ hg clone http://localhost:$HGPORT1/ --rev 0 partial
83 adding changesets 101 adding changesets
84 adding manifests 102 adding manifests
127 > def perform_authentication(hgweb, req, op): 145 > def perform_authentication(hgweb, req, op):
128 > auth = req.env.get('HTTP_AUTHORIZATION') 146 > auth = req.env.get('HTTP_AUTHORIZATION')
129 > if not auth: 147 > if not auth:
130 > raise common.ErrorResponse(common.HTTP_UNAUTHORIZED, 'who', 148 > raise common.ErrorResponse(common.HTTP_UNAUTHORIZED, 'who',
131 > [('WWW-Authenticate', 'Basic Realm="mercurial"')]) 149 > [('WWW-Authenticate', 'Basic Realm="mercurial"')])
132 > if base64.b64decode(auth.split()[1]).split(':', 1) != ['user', 'pass']: 150 > if base64.b64decode(auth.split()[1]).split(':', 1) != ['user', 'pass']:
133 > raise common.ErrorResponse(common.HTTP_FORBIDDEN, 'no') 151 > raise common.ErrorResponse(common.HTTP_FORBIDDEN, 'no')
134 > def extsetup(): 152 > def extsetup():
135 > common.permhooks.insert(0, perform_authentication) 153 > common.permhooks.insert(0, perform_authentication)
136 > EOT 154 > EOT
137 $ hg --config extensions.x=userpass.py serve -p $HGPORT2 -d --pid-file=pid \ 155 $ hg --config extensions.x=userpass.py serve -p $HGPORT2 -d --pid-file=pid \
138 > --config server.preferuncompressed=True 156 > --config server.preferuncompressed=True
139 $ cat pid >> $DAEMON_PIDS 157 $ cat pid >> $DAEMON_PIDS
140 158
141 $ hg id http://localhost:$HGPORT2/ 159 $ hg id http://localhost:$HGPORT2/
142 abort: http authorization required 160 abort: http authorization required
143 [255] 161 [255]
144 $ hg id http://user@localhost:$HGPORT2/ 162 $ hg id http://user@localhost:$HGPORT2/
145 abort: http authorization required 163 abort: http authorization required
146 [255] 164 [255]
147 $ hg id http://user:pass@localhost:$HGPORT2/ 165 $ hg id http://user:pass@localhost:$HGPORT2/
148 5fed3813f7f5 166 5fed3813f7f5
149 $ echo '[auth]' >> .hg/hgrc 167 $ echo '[auth]' >> .hg/hgrc
150 $ echo 'l.schemes=http' >> .hg/hgrc 168 $ echo 'l.schemes=http' >> .hg/hgrc
151 $ echo 'l.prefix=lo' >> .hg/hgrc 169 $ echo 'l.prefix=lo' >> .hg/hgrc
152 $ echo 'l.username=user' >> .hg/hgrc 170 $ echo 'l.username=user' >> .hg/hgrc
153 $ echo 'l.password=pass' >> .hg/hgrc 171 $ echo 'l.password=pass' >> .hg/hgrc
154 $ hg id http://localhost:$HGPORT2/ 172 $ hg id http://localhost:$HGPORT2/
155 5fed3813f7f5 173 5fed3813f7f5
156 $ hg id http://localhost:$HGPORT2/ 174 $ hg id http://localhost:$HGPORT2/
157 5fed3813f7f5 175 5fed3813f7f5
158 $ hg id http://user@localhost:$HGPORT2/ 176 $ hg id http://user@localhost:$HGPORT2/
159 5fed3813f7f5 177 5fed3813f7f5
160 $ hg clone http://user:pass@localhost:$HGPORT2/ dest 2>&1 178 $ hg clone http://user:pass@localhost:$HGPORT2/ dest 2>&1
161 streaming all changes 179 streaming all changes
162 7 files to transfer, 916 bytes of data 180 7 files to transfer, 916 bytes of data
163 transferred * bytes in * seconds (*/sec) (glob) 181 transferred * bytes in * seconds (*/sec) (glob)
164 updating to branch default 182 updating to branch default
165 5 files updated, 0 files merged, 0 files removed, 0 files unresolved 183 5 files updated, 0 files merged, 0 files removed, 0 files unresolved
166 184
167 $ hg id http://user2@localhost:$HGPORT2/ 185 $ hg id http://user2@localhost:$HGPORT2/
168 abort: http authorization required 186 abort: http authorization required
169 [255] 187 [255]
170 $ hg id http://user:pass2@localhost:$HGPORT2/ 188 $ hg id http://user:pass2@localhost:$HGPORT2/
171 abort: HTTP Error 403: no 189 abort: HTTP Error 403: no
172 [255] 190 [255]