Mercurial > hg
view tests/test-mq-qimport @ 9116:f90bbf1ea09f
inotify: fix issue1375, add a test.
The biggest problem was the data structure, which did not allow changing
a file into a directory or vice versa. This problem is fixed by b55d44719b47.
The walk() method also had an issue in this case:
- we know 'path' as a directory. inotify server sleeps.
- 'path' is deleted
- 'path' is recreated as a file
- the server catches up here, and see the deletion. it instantiates a scan(),
which in its turn calls for walk(repo, path).
- walk() then assumes that 'path' is a directory and calls os.listdir on it,
which raises an OSError(errno.ENOTDIR)
Catch the error, and yield the file instead of the directory contents.
author | Nicolas Dumazet <nicdumz.commits@gmail.com> |
---|---|
date | Mon, 13 Jul 2009 16:49:05 +0200 |
parents | bbc74c05b8a4 |
children | 53fdf18fd63b |
line wrap: on
line source
#!/bin/sh cat > writelines.py <<EOF import sys path = sys.argv[1] args = sys.argv[2:] assert (len(args) % 2) == 0 f = file(path, 'wb') for i in xrange(len(args)/2): count, s = args[2*i:2*i+2] count = int(count) s = s.decode('string_escape') f.write(s*count) f.close() EOF echo "[extensions]" >> $HGRCPATH echo "mq=" >> $HGRCPATH echo "[diff]" >> $HGRCPATH echo "git=1" >> $HGRCPATH hg init repo cd repo echo % qimport non-existing-file hg qimport non-existing-file echo % import URL echo foo >> foo hg add foo hg diff > $HGTMP/url.diff hg revert --no-backup foo rm foo # Under unix: file:///foobar/blah # Under windows: file:///c:/foobar/blah patchurl=`echo $HGTMP/url.diff | tr '\\\\' /` expr $patchurl : "\/" > /dev/null if [ $? -ne 0 ]; then patchurl='/'$patchurl fi hg qimport file://$patchurl hg qun echo % import patch that already exists echo foo2 >> foo hg add foo hg diff > ../url.diff hg revert --no-backup foo rm foo hg qimport ../url.diff hg qpush cat foo hg qpop echo % qimport -f hg qimport -f ../url.diff hg qpush cat foo hg qpop echo % build diff with CRLF python ../writelines.py b 5 'a\n' 5 'a\r\n' hg ci -Am addb python ../writelines.py b 2 'a\n' 10 'b\n' 2 'a\r\n' hg diff > b.diff hg up -C echo % qimport CRLF diff hg qimport b.diff hg qpush echo % try to import --push echo another >> b hg diff > another.diff hg up -C hg qimport --push another.diff hg qfin -a hg qimport -rtip -P