Mercurial > hg-stable
view tests/test-chg.t @ 30233:3afde791dce1 stable
largefiles: handle that a found standin file doesn't exist when removing it
I somehow ended up in a situation where hg crashed on an unlink I introduced in
328545c7d8a1.
I don't know how it happened and can't reproduce it. It seems like it only can
happen when the file is removed between the time of check in a working
directory context walk that finds a standin file, and the time of use when we
try to remove it because the corresponding largefile doesn't exist.
But better safe than sorry: replace the plain unlink with unlinkpath with
ignoremissing=True. That will also remove remaining empty directories, which
arguably is more correct.
author | Mads Kiilerich <madski@unity3d.com> |
---|---|
date | Thu, 27 Oct 2016 20:06:33 +0200 |
parents | e095b9e753f7 |
children | 937c52f06709 |
line wrap: on
line source
#require chg $ cp $HGRCPATH $HGRCPATH.orig init repo $ chg init foo $ cd foo ill-formed config $ chg status $ echo '=brokenconfig' >> $HGRCPATH $ chg status hg: parse error at * (glob) [255] $ cp $HGRCPATH.orig $HGRCPATH $ cd .. server lifecycle ---------------- chg server should be restarted on code change, and old server will shut down automatically. In this test, we use the following time parameters: - "sleep 1" to make mtime different - "sleep 2" to notice mtime change (polling interval is 1 sec) set up repository with an extension: $ chg init extreload $ cd extreload $ touch dummyext.py $ cat <<EOF >> .hg/hgrc > [extensions] > dummyext = dummyext.py > EOF isolate socket directory for stable result: $ OLDCHGSOCKNAME=$CHGSOCKNAME $ mkdir chgsock $ CHGSOCKNAME=`pwd`/chgsock/server warm up server: $ CHGDEBUG= chg log 2>&1 | egrep 'instruction|start' chg: debug: start cmdserver at $TESTTMP/extreload/chgsock/server new server should be started if extension modified: $ sleep 1 $ touch dummyext.py $ CHGDEBUG= chg log 2>&1 | egrep 'instruction|start' chg: debug: instruction: unlink $TESTTMP/extreload/chgsock/server-* (glob) chg: debug: instruction: reconnect chg: debug: start cmdserver at $TESTTMP/extreload/chgsock/server old server will shut down, while new server should still be reachable: $ sleep 2 $ CHGDEBUG= chg log 2>&1 | (egrep 'instruction|start' || true) socket file should never be unlinked by old server: (simulates unowned socket by updating mtime, which makes sure server exits at polling cycle) $ ls chgsock/server-* chgsock/server-* (glob) $ touch chgsock/server-* $ sleep 2 $ ls chgsock/server-* chgsock/server-* (glob) since no server is reachable from socket file, new server should be started: (this test makes sure that old server shut down automatically) $ CHGDEBUG= chg log 2>&1 | egrep 'instruction|start' chg: debug: start cmdserver at $TESTTMP/extreload/chgsock/server shut down servers and restore environment: $ rm -R chgsock $ CHGSOCKNAME=$OLDCHGSOCKNAME $ cd ..