Mercurial > hg > mercurial-crew-with-dirclash
annotate tests/test-init @ 4135:6cb6cfe43c5d
Avoid some false positives for addremove -s
The original code uses the similary score
1 - len(diff(after, before)) / len(after)
The diff can at most be the size of the 'before' file, so any small
'before' file would be considered very similar. Removing an empty file
would cause all files added in the same revision to be considered
copies of the removed file.
This changes the metric to
bytes_overlap(before, after) / len(before + after)
i.e. the actual percentage of bytes shared between the two files.
author | Erling Ellingsen <erlingalf@gmail.com> |
---|---|
date | Sun, 18 Feb 2007 20:39:25 +0100 |
parents | 8ae88ed2a3b6 |
children | c0271aba6abe |
rev | line source |
---|---|
2599
e4b5e48052c6
Added tests for local and remote init.
Thomas Arendsen Hein <thomas@intevation.de>
parents:
diff
changeset
|
1 #!/bin/sh |
e4b5e48052c6
Added tests for local and remote init.
Thomas Arendsen Hein <thomas@intevation.de>
parents:
diff
changeset
|
2 |
e4b5e48052c6
Added tests for local and remote init.
Thomas Arendsen Hein <thomas@intevation.de>
parents:
diff
changeset
|
3 # This test tries to exercise the ssh functionality with a dummy script |
e4b5e48052c6
Added tests for local and remote init.
Thomas Arendsen Hein <thomas@intevation.de>
parents:
diff
changeset
|
4 |
e4b5e48052c6
Added tests for local and remote init.
Thomas Arendsen Hein <thomas@intevation.de>
parents:
diff
changeset
|
5 cat <<'EOF' > dummyssh |
e4b5e48052c6
Added tests for local and remote init.
Thomas Arendsen Hein <thomas@intevation.de>
parents:
diff
changeset
|
6 #!/bin/sh |
e4b5e48052c6
Added tests for local and remote init.
Thomas Arendsen Hein <thomas@intevation.de>
parents:
diff
changeset
|
7 # this attempts to deal with relative pathnames |
e4b5e48052c6
Added tests for local and remote init.
Thomas Arendsen Hein <thomas@intevation.de>
parents:
diff
changeset
|
8 cd `dirname $0` |
e4b5e48052c6
Added tests for local and remote init.
Thomas Arendsen Hein <thomas@intevation.de>
parents:
diff
changeset
|
9 |
e4b5e48052c6
Added tests for local and remote init.
Thomas Arendsen Hein <thomas@intevation.de>
parents:
diff
changeset
|
10 # check for proper args |
e4b5e48052c6
Added tests for local and remote init.
Thomas Arendsen Hein <thomas@intevation.de>
parents:
diff
changeset
|
11 if [ $1 != "user@dummy" ] ; then |
e4b5e48052c6
Added tests for local and remote init.
Thomas Arendsen Hein <thomas@intevation.de>
parents:
diff
changeset
|
12 exit -1 |
e4b5e48052c6
Added tests for local and remote init.
Thomas Arendsen Hein <thomas@intevation.de>
parents:
diff
changeset
|
13 fi |
e4b5e48052c6
Added tests for local and remote init.
Thomas Arendsen Hein <thomas@intevation.de>
parents:
diff
changeset
|
14 |
e4b5e48052c6
Added tests for local and remote init.
Thomas Arendsen Hein <thomas@intevation.de>
parents:
diff
changeset
|
15 # check that we're in the right directory |
e4b5e48052c6
Added tests for local and remote init.
Thomas Arendsen Hein <thomas@intevation.de>
parents:
diff
changeset
|
16 if [ ! -x dummyssh ] ; then |
e4b5e48052c6
Added tests for local and remote init.
Thomas Arendsen Hein <thomas@intevation.de>
parents:
diff
changeset
|
17 exit -1 |
e4b5e48052c6
Added tests for local and remote init.
Thomas Arendsen Hein <thomas@intevation.de>
parents:
diff
changeset
|
18 fi |
e4b5e48052c6
Added tests for local and remote init.
Thomas Arendsen Hein <thomas@intevation.de>
parents:
diff
changeset
|
19 |
e4b5e48052c6
Added tests for local and remote init.
Thomas Arendsen Hein <thomas@intevation.de>
parents:
diff
changeset
|
20 echo Got arguments 1:$1 2:$2 3:$3 4:$4 5:$5 >> dummylog |
e4b5e48052c6
Added tests for local and remote init.
Thomas Arendsen Hein <thomas@intevation.de>
parents:
diff
changeset
|
21 $2 |
e4b5e48052c6
Added tests for local and remote init.
Thomas Arendsen Hein <thomas@intevation.de>
parents:
diff
changeset
|
22 EOF |
e4b5e48052c6
Added tests for local and remote init.
Thomas Arendsen Hein <thomas@intevation.de>
parents:
diff
changeset
|
23 chmod +x dummyssh |
e4b5e48052c6
Added tests for local and remote init.
Thomas Arendsen Hein <thomas@intevation.de>
parents:
diff
changeset
|
24 |
e4b5e48052c6
Added tests for local and remote init.
Thomas Arendsen Hein <thomas@intevation.de>
parents:
diff
changeset
|
25 echo "# creating 'local'" |
e4b5e48052c6
Added tests for local and remote init.
Thomas Arendsen Hein <thomas@intevation.de>
parents:
diff
changeset
|
26 hg init local |
e4b5e48052c6
Added tests for local and remote init.
Thomas Arendsen Hein <thomas@intevation.de>
parents:
diff
changeset
|
27 echo this > local/foo |
e4b5e48052c6
Added tests for local and remote init.
Thomas Arendsen Hein <thomas@intevation.de>
parents:
diff
changeset
|
28 hg ci --cwd local -A -m "init" -d "1000000 0" |
e4b5e48052c6
Added tests for local and remote init.
Thomas Arendsen Hein <thomas@intevation.de>
parents:
diff
changeset
|
29 |
3034
3acb76f0124d
clone: simplifying dest repo creation
Benoit Boissinot <benoit.boissinot@ens-lyon.org>
parents:
2599
diff
changeset
|
30 echo "#test failure" |
3acb76f0124d
clone: simplifying dest repo creation
Benoit Boissinot <benoit.boissinot@ens-lyon.org>
parents:
2599
diff
changeset
|
31 hg init local |
3acb76f0124d
clone: simplifying dest repo creation
Benoit Boissinot <benoit.boissinot@ens-lyon.org>
parents:
2599
diff
changeset
|
32 |
2599
e4b5e48052c6
Added tests for local and remote init.
Thomas Arendsen Hein <thomas@intevation.de>
parents:
diff
changeset
|
33 echo "# init+push to remote2" |
e4b5e48052c6
Added tests for local and remote init.
Thomas Arendsen Hein <thomas@intevation.de>
parents:
diff
changeset
|
34 hg init -e ./dummyssh ssh://user@dummy/remote2 |
e4b5e48052c6
Added tests for local and remote init.
Thomas Arendsen Hein <thomas@intevation.de>
parents:
diff
changeset
|
35 hg incoming -R remote2 local |
e4b5e48052c6
Added tests for local and remote init.
Thomas Arendsen Hein <thomas@intevation.de>
parents:
diff
changeset
|
36 hg push -R local -e ./dummyssh ssh://user@dummy/remote2 |
e4b5e48052c6
Added tests for local and remote init.
Thomas Arendsen Hein <thomas@intevation.de>
parents:
diff
changeset
|
37 |
e4b5e48052c6
Added tests for local and remote init.
Thomas Arendsen Hein <thomas@intevation.de>
parents:
diff
changeset
|
38 echo "# clone to remote1" |
e4b5e48052c6
Added tests for local and remote init.
Thomas Arendsen Hein <thomas@intevation.de>
parents:
diff
changeset
|
39 hg clone -e ./dummyssh local ssh://user@dummy/remote1 |
e4b5e48052c6
Added tests for local and remote init.
Thomas Arendsen Hein <thomas@intevation.de>
parents:
diff
changeset
|
40 |
3034
3acb76f0124d
clone: simplifying dest repo creation
Benoit Boissinot <benoit.boissinot@ens-lyon.org>
parents:
2599
diff
changeset
|
41 echo "# init to existing repo" |
3acb76f0124d
clone: simplifying dest repo creation
Benoit Boissinot <benoit.boissinot@ens-lyon.org>
parents:
2599
diff
changeset
|
42 hg init -e ./dummyssh ssh://user@dummy/remote1 |
3acb76f0124d
clone: simplifying dest repo creation
Benoit Boissinot <benoit.boissinot@ens-lyon.org>
parents:
2599
diff
changeset
|
43 |
3acb76f0124d
clone: simplifying dest repo creation
Benoit Boissinot <benoit.boissinot@ens-lyon.org>
parents:
2599
diff
changeset
|
44 echo "# clone to existing repo" |
3acb76f0124d
clone: simplifying dest repo creation
Benoit Boissinot <benoit.boissinot@ens-lyon.org>
parents:
2599
diff
changeset
|
45 hg clone -e ./dummyssh local ssh://user@dummy/remote1 |
3acb76f0124d
clone: simplifying dest repo creation
Benoit Boissinot <benoit.boissinot@ens-lyon.org>
parents:
2599
diff
changeset
|
46 |
2599
e4b5e48052c6
Added tests for local and remote init.
Thomas Arendsen Hein <thomas@intevation.de>
parents:
diff
changeset
|
47 echo "# output of dummyssh" |
e4b5e48052c6
Added tests for local and remote init.
Thomas Arendsen Hein <thomas@intevation.de>
parents:
diff
changeset
|
48 cat dummylog |
e4b5e48052c6
Added tests for local and remote init.
Thomas Arendsen Hein <thomas@intevation.de>
parents:
diff
changeset
|
49 |
e4b5e48052c6
Added tests for local and remote init.
Thomas Arendsen Hein <thomas@intevation.de>
parents:
diff
changeset
|
50 echo "# comparing repositories" |
e4b5e48052c6
Added tests for local and remote init.
Thomas Arendsen Hein <thomas@intevation.de>
parents:
diff
changeset
|
51 hg tip -q -R local |
e4b5e48052c6
Added tests for local and remote init.
Thomas Arendsen Hein <thomas@intevation.de>
parents:
diff
changeset
|
52 hg tip -q -R remote1 |
e4b5e48052c6
Added tests for local and remote init.
Thomas Arendsen Hein <thomas@intevation.de>
parents:
diff
changeset
|
53 hg tip -q -R remote2 |
e4b5e48052c6
Added tests for local and remote init.
Thomas Arendsen Hein <thomas@intevation.de>
parents:
diff
changeset
|
54 |
e4b5e48052c6
Added tests for local and remote init.
Thomas Arendsen Hein <thomas@intevation.de>
parents:
diff
changeset
|
55 echo "# check names for repositories (clashes with URL schemes, special chars)" |
e4b5e48052c6
Added tests for local and remote init.
Thomas Arendsen Hein <thomas@intevation.de>
parents:
diff
changeset
|
56 for i in bundle file hg http https old-http ssh static-http " " "with space"; do |
e4b5e48052c6
Added tests for local and remote init.
Thomas Arendsen Hein <thomas@intevation.de>
parents:
diff
changeset
|
57 echo "# hg init \"$i\"" |
e4b5e48052c6
Added tests for local and remote init.
Thomas Arendsen Hein <thomas@intevation.de>
parents:
diff
changeset
|
58 hg init "$i" |
3713
8ae88ed2a3b6
don't create the .hg/data at init time
Benoit Boissinot <benoit.boissinot@ens-lyon.org>
parents:
3034
diff
changeset
|
59 test -d "$i" -a -d "$i/.hg" && echo "ok" || echo "failed" |
2599
e4b5e48052c6
Added tests for local and remote init.
Thomas Arendsen Hein <thomas@intevation.de>
parents:
diff
changeset
|
60 done |
e4b5e48052c6
Added tests for local and remote init.
Thomas Arendsen Hein <thomas@intevation.de>
parents:
diff
changeset
|
61 |