Mercurial > hg
comparison tests/test-lfs-serve.t @ 40131:535fc8a22365 stable
lfs: avoid a potential variable reference before assignment error in cmdserver
A coworker hit this once yesterday when pulling in thg (a retry worked), and
then I hit it with strip after a pull. I had a difficult time recreating a test
for this (at least one of the tricks was to not use '-R', which seems to cause
reposetup() to be called for each command), so I'm not sure how large of a
window there actually is for this. Calling reposetup() *after* the requirement
is added will skip the hook entirely.
The other issue I had was adding a couple `ui.status()` lines around the check
that installs the hook. On Windows, the cmdserver process ballooned to 1.6GB
and hung. Changing that to `ui.warn()` avoided the hang. It also hung on
macOS, but without the large memory usage.
author | Matt Harbison <matt_harbison@yahoo.com> |
---|---|
date | Wed, 10 Oct 2018 12:25:28 -0400 |
parents | ead71b15efd5 |
children | ef0baff11aea |
comparison
equal
deleted
inserted
replaced
39942:3e61146d7b24 | 40131:535fc8a22365 |
---|---|
218 $ hg -R $TESTTMP/client3_pull pull -q http://localhost:$HGPORT | 218 $ hg -R $TESTTMP/client3_pull pull -q http://localhost:$HGPORT |
219 $ grep 'lfs' $TESTTMP/client3_pull/.hg/requires $SERVER_REQUIRES || true | 219 $ grep 'lfs' $TESTTMP/client3_pull/.hg/requires $SERVER_REQUIRES || true |
220 $TESTTMP/client3_pull/.hg/requires:lfs (lfsremote-on !) | 220 $TESTTMP/client3_pull/.hg/requires:lfs (lfsremote-on !) |
221 $TESTTMP/server/.hg/requires:lfs (lfsremote-on !) | 221 $TESTTMP/server/.hg/requires:lfs (lfsremote-on !) |
222 | 222 |
223 Test that the commit/changegroup requirement check hook can be run multiple | |
224 times. | |
225 | |
226 $ hg clone -qr 0 http://localhost:$HGPORT $TESTTMP/cmdserve_client3 | |
227 | |
228 $ cd ../cmdserve_client3 | |
229 | |
230 >>> from __future__ import absolute_import | |
231 >>> from hgclient import check, readchannel, runcommand | |
232 >>> @check | |
233 ... def addrequirement(server): | |
234 ... readchannel(server) | |
235 ... # change the repo in a way that adds the lfs requirement | |
236 ... runcommand(server, ['pull', '-qu']) | |
237 ... # Now cause the requirement adding hook to fire again, without going | |
238 ... # through reposetup() again. | |
239 ... with open('file.txt', 'wb') as fp: | |
240 ... fp.write('data') | |
241 ... runcommand(server, ['ci', '-Aqm', 'non-lfs']) | |
242 *** runcommand pull -qu | |
243 *** runcommand ci -Aqm non-lfs | |
244 | |
245 $ cd ../client | |
246 | |
223 The difference here is the push failed above when the extension isn't | 247 The difference here is the push failed above when the extension isn't |
224 enabled on the server. | 248 enabled on the server. |
225 $ hg identify http://localhost:$HGPORT | 249 $ hg identify http://localhost:$HGPORT |
226 8374dc4052cb (lfsremote-on !) | 250 8374dc4052cb (lfsremote-on !) |
227 1477875038c6 (lfsremote-off !) | 251 1477875038c6 (lfsremote-off !) |