tests/test-inotify-dirty-dirstate
author David Greenaway <hg-dev@davidgreenaway.com>
Sat, 03 Apr 2010 11:58:16 +1100
changeset 11060 e6df01776e08
parent 9897 97eda2133a9b
permissions -rwxr-xr-x
findrenames: Optimise "addremove -s100" by matching files by their SHA1 hashes. We speed up 'findrenames' for the usecase when a user specifies they want a similarity of 100% by matching files by their exact SHA1 hash value. This reduces the number of comparisons required to find exact matches from O(n^2) to O(n). While it would be nice if we could just use mercurial's pre-calculated SHA1 hash for existing files, this hash includes the file's ancestor information making it unsuitable for our purposes. Instead, we calculate the hash of old content from scratch. The following benchmarks were taken on the current head of crew: addremove 100% similarity: rm -rf *; hg up -C; mv tests tests.new hg --time addremove -s100 --dry-run before: real 176.350 secs (user 128.890+0.000 sys 47.430+0.000) after: real 2.130 secs (user 1.890+0.000 sys 0.240+0.000) addremove 75% similarity: rm -rf *; hg up -C; mv tests tests.new; \ for i in tests.new/*; do echo x >> $i; done hg --time addremove -s75 --dry-run before: real 264.560 secs (user 215.130+0.000 sys 49.410+0.000) after: real 218.710 secs (user 172.790+0.000 sys 45.870+0.000)
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
9855
f47c0881b16e inotify: Do not access inotify when dirstate is dirty (issue1811)
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents:
diff changeset
     1
#!/bin/sh
f47c0881b16e inotify: Do not access inotify when dirstate is dirty (issue1811)
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents:
diff changeset
     2
f47c0881b16e inotify: Do not access inotify when dirstate is dirty (issue1811)
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents:
diff changeset
     3
# issues when status queries are issued when dirstate is dirty
f47c0881b16e inotify: Do not access inotify when dirstate is dirty (issue1811)
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents:
diff changeset
     4
f47c0881b16e inotify: Do not access inotify when dirstate is dirty (issue1811)
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents:
diff changeset
     5
"$TESTDIR/hghave" inotify || exit 80
f47c0881b16e inotify: Do not access inotify when dirstate is dirty (issue1811)
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents:
diff changeset
     6
f47c0881b16e inotify: Do not access inotify when dirstate is dirty (issue1811)
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents:
diff changeset
     7
echo "[extensions]" >> $HGRCPATH
f47c0881b16e inotify: Do not access inotify when dirstate is dirty (issue1811)
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents:
diff changeset
     8
echo "inotify=" >> $HGRCPATH
f47c0881b16e inotify: Do not access inotify when dirstate is dirty (issue1811)
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents:
diff changeset
     9
echo "fetch=" >> $HGRCPATH
f47c0881b16e inotify: Do not access inotify when dirstate is dirty (issue1811)
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents:
diff changeset
    10
f47c0881b16e inotify: Do not access inotify when dirstate is dirty (issue1811)
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents:
diff changeset
    11
echo % issue1810: inotify and fetch
f47c0881b16e inotify: Do not access inotify when dirstate is dirty (issue1811)
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents:
diff changeset
    12
mkdir test; cd test
f47c0881b16e inotify: Do not access inotify when dirstate is dirty (issue1811)
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents:
diff changeset
    13
hg init
9859
951ec6c7d703 inotify: workaround test-inotify-dirty-dirstate failures
Benoit Boissinot <benoit.boissinot@ens-lyon.org>
parents: 9855
diff changeset
    14
hg inserve -d --pid-file=../hg.pid
951ec6c7d703 inotify: workaround test-inotify-dirty-dirstate failures
Benoit Boissinot <benoit.boissinot@ens-lyon.org>
parents: 9855
diff changeset
    15
cat ../hg.pid >> "$DAEMON_PIDS"
9855
f47c0881b16e inotify: Do not access inotify when dirstate is dirty (issue1811)
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents:
diff changeset
    16
f47c0881b16e inotify: Do not access inotify when dirstate is dirty (issue1811)
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents:
diff changeset
    17
echo foo > foo
f47c0881b16e inotify: Do not access inotify when dirstate is dirty (issue1811)
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents:
diff changeset
    18
hg add
f47c0881b16e inotify: Do not access inotify when dirstate is dirty (issue1811)
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents:
diff changeset
    19
hg ci -m foo
f47c0881b16e inotify: Do not access inotify when dirstate is dirty (issue1811)
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents:
diff changeset
    20
f47c0881b16e inotify: Do not access inotify when dirstate is dirty (issue1811)
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents:
diff changeset
    21
cd ..
f47c0881b16e inotify: Do not access inotify when dirstate is dirty (issue1811)
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents:
diff changeset
    22
9897
97eda2133a9b inotify: add a inotify.pidfile configuration possibility
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 9859
diff changeset
    23
hg --config "inotify.pidfile=../hg2.pid" clone test test2
97eda2133a9b inotify: add a inotify.pidfile configuration possibility
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 9859
diff changeset
    24
cat ../hg2.pid >> "$DAEMON_PIDS"
97eda2133a9b inotify: add a inotify.pidfile configuration possibility
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 9859
diff changeset
    25
9855
f47c0881b16e inotify: Do not access inotify when dirstate is dirty (issue1811)
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents:
diff changeset
    26
cd test2
f47c0881b16e inotify: Do not access inotify when dirstate is dirty (issue1811)
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents:
diff changeset
    27
echo bar > bar
f47c0881b16e inotify: Do not access inotify when dirstate is dirty (issue1811)
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents:
diff changeset
    28
hg add
f47c0881b16e inotify: Do not access inotify when dirstate is dirty (issue1811)
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents:
diff changeset
    29
hg ci -m bar
f47c0881b16e inotify: Do not access inotify when dirstate is dirty (issue1811)
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents:
diff changeset
    30
cd ../test
f47c0881b16e inotify: Do not access inotify when dirstate is dirty (issue1811)
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents:
diff changeset
    31
echo spam > spam
f47c0881b16e inotify: Do not access inotify when dirstate is dirty (issue1811)
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents:
diff changeset
    32
hg add
f47c0881b16e inotify: Do not access inotify when dirstate is dirty (issue1811)
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents:
diff changeset
    33
hg ci -m spam
f47c0881b16e inotify: Do not access inotify when dirstate is dirty (issue1811)
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents:
diff changeset
    34
cd ../test2
f47c0881b16e inotify: Do not access inotify when dirstate is dirty (issue1811)
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents:
diff changeset
    35
hg st
f47c0881b16e inotify: Do not access inotify when dirstate is dirty (issue1811)
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents:
diff changeset
    36
f47c0881b16e inotify: Do not access inotify when dirstate is dirty (issue1811)
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents:
diff changeset
    37
# abort, outstanding changes
f47c0881b16e inotify: Do not access inotify when dirstate is dirty (issue1811)
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents:
diff changeset
    38
hg fetch -q
f47c0881b16e inotify: Do not access inotify when dirstate is dirty (issue1811)
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents:
diff changeset
    39
hg st
f47c0881b16e inotify: Do not access inotify when dirstate is dirty (issue1811)
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents:
diff changeset
    40
cd ..
f47c0881b16e inotify: Do not access inotify when dirstate is dirty (issue1811)
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents:
diff changeset
    41
f47c0881b16e inotify: Do not access inotify when dirstate is dirty (issue1811)
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents:
diff changeset
    42
f47c0881b16e inotify: Do not access inotify when dirstate is dirty (issue1811)
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents:
diff changeset
    43
echo % issue1719: inotify and mq
f47c0881b16e inotify: Do not access inotify when dirstate is dirty (issue1811)
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents:
diff changeset
    44
f47c0881b16e inotify: Do not access inotify when dirstate is dirty (issue1811)
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents:
diff changeset
    45
echo "mq=" >> $HGRCPATH
f47c0881b16e inotify: Do not access inotify when dirstate is dirty (issue1811)
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents:
diff changeset
    46
f47c0881b16e inotify: Do not access inotify when dirstate is dirty (issue1811)
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents:
diff changeset
    47
hg init test-1719
f47c0881b16e inotify: Do not access inotify when dirstate is dirty (issue1811)
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents:
diff changeset
    48
cd test-1719
f47c0881b16e inotify: Do not access inotify when dirstate is dirty (issue1811)
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents:
diff changeset
    49
f47c0881b16e inotify: Do not access inotify when dirstate is dirty (issue1811)
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents:
diff changeset
    50
echo % inserve
9859
951ec6c7d703 inotify: workaround test-inotify-dirty-dirstate failures
Benoit Boissinot <benoit.boissinot@ens-lyon.org>
parents: 9855
diff changeset
    51
hg inserve -d --pid-file=../hg-test-1719.pid
951ec6c7d703 inotify: workaround test-inotify-dirty-dirstate failures
Benoit Boissinot <benoit.boissinot@ens-lyon.org>
parents: 9855
diff changeset
    52
cat ../hg-test-1719.pid >> "$DAEMON_PIDS"
9855
f47c0881b16e inotify: Do not access inotify when dirstate is dirty (issue1811)
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents:
diff changeset
    53
f47c0881b16e inotify: Do not access inotify when dirstate is dirty (issue1811)
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents:
diff changeset
    54
echo content > file
f47c0881b16e inotify: Do not access inotify when dirstate is dirty (issue1811)
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents:
diff changeset
    55
hg add file
f47c0881b16e inotify: Do not access inotify when dirstate is dirty (issue1811)
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents:
diff changeset
    56
f47c0881b16e inotify: Do not access inotify when dirstate is dirty (issue1811)
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents:
diff changeset
    57
hg qnew -f test.patch
f47c0881b16e inotify: Do not access inotify when dirstate is dirty (issue1811)
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents:
diff changeset
    58
f47c0881b16e inotify: Do not access inotify when dirstate is dirty (issue1811)
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents:
diff changeset
    59
hg status
f47c0881b16e inotify: Do not access inotify when dirstate is dirty (issue1811)
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents:
diff changeset
    60
hg qpop
f47c0881b16e inotify: Do not access inotify when dirstate is dirty (issue1811)
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents:
diff changeset
    61
f47c0881b16e inotify: Do not access inotify when dirstate is dirty (issue1811)
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents:
diff changeset
    62
echo % st should not output anything
f47c0881b16e inotify: Do not access inotify when dirstate is dirty (issue1811)
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents:
diff changeset
    63
hg status
f47c0881b16e inotify: Do not access inotify when dirstate is dirty (issue1811)
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents:
diff changeset
    64
f47c0881b16e inotify: Do not access inotify when dirstate is dirty (issue1811)
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents:
diff changeset
    65
hg qpush
f47c0881b16e inotify: Do not access inotify when dirstate is dirty (issue1811)
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents:
diff changeset
    66
f47c0881b16e inotify: Do not access inotify when dirstate is dirty (issue1811)
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents:
diff changeset
    67
echo % st should not output anything
f47c0881b16e inotify: Do not access inotify when dirstate is dirty (issue1811)
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents:
diff changeset
    68
hg status
f47c0881b16e inotify: Do not access inotify when dirstate is dirty (issue1811)
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents:
diff changeset
    69
f47c0881b16e inotify: Do not access inotify when dirstate is dirty (issue1811)
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents:
diff changeset
    70
hg qrefresh
f47c0881b16e inotify: Do not access inotify when dirstate is dirty (issue1811)
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents:
diff changeset
    71
hg status