Mercurial > hg > mercurial-crew-with-dirclash
annotate tests/test-merge1 @ 4193:9e3121017fb2
Optimize return value of util._matcher for common command line case
This will trigger every time somebody runs something like "hg diff"
or "hg status" without any arguments.
The important part here is returning util.always as the match function,
which is a much simpler (and faster) function than the usual return
value, and allows other code to just skip the filtering if it knows
all files will match.
author | Alexis S. L. Carvalho <alexis@cecm.usp.br> |
---|---|
date | Sat, 10 Mar 2007 23:01:00 -0300 |
parents | 9dcf9d45cab8 |
children | ccfe423d3d0a |
rev | line source |
---|---|
800
ec85f9e6f3b1
Don't use 'set -x', fix exports, sed and hexdump usage for Solaris.
Thomas Arendsen Hein <thomas@intevation.de>
parents:
749
diff
changeset
|
1 #!/bin/sh |
407
0e0d0670b2bc
[PATCH] Merging identical changes from another branch
mpm@selenic.com
parents:
diff
changeset
|
2 |
0e0d0670b2bc
[PATCH] Merging identical changes from another branch
mpm@selenic.com
parents:
diff
changeset
|
3 cat <<'EOF' > merge |
0e0d0670b2bc
[PATCH] Merging identical changes from another branch
mpm@selenic.com
parents:
diff
changeset
|
4 #!/bin/sh |
0e0d0670b2bc
[PATCH] Merging identical changes from another branch
mpm@selenic.com
parents:
diff
changeset
|
5 echo merging for `basename $1` |
0e0d0670b2bc
[PATCH] Merging identical changes from another branch
mpm@selenic.com
parents:
diff
changeset
|
6 EOF |
0e0d0670b2bc
[PATCH] Merging identical changes from another branch
mpm@selenic.com
parents:
diff
changeset
|
7 chmod +x merge |
0e0d0670b2bc
[PATCH] Merging identical changes from another branch
mpm@selenic.com
parents:
diff
changeset
|
8 |
0e0d0670b2bc
[PATCH] Merging identical changes from another branch
mpm@selenic.com
parents:
diff
changeset
|
9 mkdir t |
0e0d0670b2bc
[PATCH] Merging identical changes from another branch
mpm@selenic.com
parents:
diff
changeset
|
10 cd t |
0e0d0670b2bc
[PATCH] Merging identical changes from another branch
mpm@selenic.com
parents:
diff
changeset
|
11 hg init |
0e0d0670b2bc
[PATCH] Merging identical changes from another branch
mpm@selenic.com
parents:
diff
changeset
|
12 echo This is file a1 > a |
0e0d0670b2bc
[PATCH] Merging identical changes from another branch
mpm@selenic.com
parents:
diff
changeset
|
13 hg add a |
1933
7544700fd931
Use 'hg ci -d "1000000 0"' in tests to circumvent problem with leading zero.
Thomas Arendsen Hein <thomas@intevation.de>
parents:
1581
diff
changeset
|
14 hg commit -m "commit #0" -d "1000000 0" |
407
0e0d0670b2bc
[PATCH] Merging identical changes from another branch
mpm@selenic.com
parents:
diff
changeset
|
15 echo This is file b1 > b |
0e0d0670b2bc
[PATCH] Merging identical changes from another branch
mpm@selenic.com
parents:
diff
changeset
|
16 hg add b |
1933
7544700fd931
Use 'hg ci -d "1000000 0"' in tests to circumvent problem with leading zero.
Thomas Arendsen Hein <thomas@intevation.de>
parents:
1581
diff
changeset
|
17 hg commit -m "commit #1" -d "1000000 0" |
407
0e0d0670b2bc
[PATCH] Merging identical changes from another branch
mpm@selenic.com
parents:
diff
changeset
|
18 |
0e0d0670b2bc
[PATCH] Merging identical changes from another branch
mpm@selenic.com
parents:
diff
changeset
|
19 hg update 0 |
0e0d0670b2bc
[PATCH] Merging identical changes from another branch
mpm@selenic.com
parents:
diff
changeset
|
20 echo This is file c1 > c |
0e0d0670b2bc
[PATCH] Merging identical changes from another branch
mpm@selenic.com
parents:
diff
changeset
|
21 hg add c |
1933
7544700fd931
Use 'hg ci -d "1000000 0"' in tests to circumvent problem with leading zero.
Thomas Arendsen Hein <thomas@intevation.de>
parents:
1581
diff
changeset
|
22 hg commit -m "commit #2" -d "1000000 0" |
407
0e0d0670b2bc
[PATCH] Merging identical changes from another branch
mpm@selenic.com
parents:
diff
changeset
|
23 echo This is file b1 > b |
1236
67a28636ea64
Fix bug with co -C across branches, update tests
mpm@selenic.com
parents:
814
diff
changeset
|
24 echo %% no merges expected |
2283
e506c14382fd
deprecate 'update -m'. use 'merge' instead.
Vadim Gelfer <vadim.gelfer@gmail.com>
parents:
1933
diff
changeset
|
25 env HGMERGE=../merge hg merge 1 |
3328
49966b5ab16f
fix traceback of extdiff after a merge
Benoit Boissinot <benoit.boissinot@ens-lyon.org>
parents:
2283
diff
changeset
|
26 hg diff --nodates |
49966b5ab16f
fix traceback of extdiff after a merge
Benoit Boissinot <benoit.boissinot@ens-lyon.org>
parents:
2283
diff
changeset
|
27 hg status |
3988
9dcf9d45cab8
Don't use -f for rm in tests where not needed. Drop /bin/ from /bin/rm.
Thomas Arendsen Hein <thomas@intevation.de>
parents:
3328
diff
changeset
|
28 cd ..; rm -r t |
407
0e0d0670b2bc
[PATCH] Merging identical changes from another branch
mpm@selenic.com
parents:
diff
changeset
|
29 |
0e0d0670b2bc
[PATCH] Merging identical changes from another branch
mpm@selenic.com
parents:
diff
changeset
|
30 mkdir t |
0e0d0670b2bc
[PATCH] Merging identical changes from another branch
mpm@selenic.com
parents:
diff
changeset
|
31 cd t |
0e0d0670b2bc
[PATCH] Merging identical changes from another branch
mpm@selenic.com
parents:
diff
changeset
|
32 hg init |
0e0d0670b2bc
[PATCH] Merging identical changes from another branch
mpm@selenic.com
parents:
diff
changeset
|
33 echo This is file a1 > a |
0e0d0670b2bc
[PATCH] Merging identical changes from another branch
mpm@selenic.com
parents:
diff
changeset
|
34 hg add a |
1933
7544700fd931
Use 'hg ci -d "1000000 0"' in tests to circumvent problem with leading zero.
Thomas Arendsen Hein <thomas@intevation.de>
parents:
1581
diff
changeset
|
35 hg commit -m "commit #0" -d "1000000 0" |
407
0e0d0670b2bc
[PATCH] Merging identical changes from another branch
mpm@selenic.com
parents:
diff
changeset
|
36 echo This is file b1 > b |
0e0d0670b2bc
[PATCH] Merging identical changes from another branch
mpm@selenic.com
parents:
diff
changeset
|
37 hg add b |
1933
7544700fd931
Use 'hg ci -d "1000000 0"' in tests to circumvent problem with leading zero.
Thomas Arendsen Hein <thomas@intevation.de>
parents:
1581
diff
changeset
|
38 hg commit -m "commit #1" -d "1000000 0" |
407
0e0d0670b2bc
[PATCH] Merging identical changes from another branch
mpm@selenic.com
parents:
diff
changeset
|
39 |
0e0d0670b2bc
[PATCH] Merging identical changes from another branch
mpm@selenic.com
parents:
diff
changeset
|
40 hg update 0 |
0e0d0670b2bc
[PATCH] Merging identical changes from another branch
mpm@selenic.com
parents:
diff
changeset
|
41 echo This is file c1 > c |
0e0d0670b2bc
[PATCH] Merging identical changes from another branch
mpm@selenic.com
parents:
diff
changeset
|
42 hg add c |
1933
7544700fd931
Use 'hg ci -d "1000000 0"' in tests to circumvent problem with leading zero.
Thomas Arendsen Hein <thomas@intevation.de>
parents:
1581
diff
changeset
|
43 hg commit -m "commit #2" -d "1000000 0" |
407
0e0d0670b2bc
[PATCH] Merging identical changes from another branch
mpm@selenic.com
parents:
diff
changeset
|
44 echo This is file b2 > b |
1581
db10b7114de0
abort when merging two heads and repository has local changes
Benoit Boissinot <benoit.boissinot@ens-lyon.org>
parents:
1236
diff
changeset
|
45 echo %% merge should fail |
2283
e506c14382fd
deprecate 'update -m'. use 'merge' instead.
Vadim Gelfer <vadim.gelfer@gmail.com>
parents:
1933
diff
changeset
|
46 env HGMERGE=../merge hg merge 1 |
1236
67a28636ea64
Fix bug with co -C across branches, update tests
mpm@selenic.com
parents:
814
diff
changeset
|
47 echo %% merge of b expected |
2283
e506c14382fd
deprecate 'update -m'. use 'merge' instead.
Vadim Gelfer <vadim.gelfer@gmail.com>
parents:
1933
diff
changeset
|
48 env HGMERGE=../merge hg merge -f 1 |
3328
49966b5ab16f
fix traceback of extdiff after a merge
Benoit Boissinot <benoit.boissinot@ens-lyon.org>
parents:
2283
diff
changeset
|
49 hg diff --nodates |
49966b5ab16f
fix traceback of extdiff after a merge
Benoit Boissinot <benoit.boissinot@ens-lyon.org>
parents:
2283
diff
changeset
|
50 hg status |
3988
9dcf9d45cab8
Don't use -f for rm in tests where not needed. Drop /bin/ from /bin/rm.
Thomas Arendsen Hein <thomas@intevation.de>
parents:
3328
diff
changeset
|
51 cd ..; rm -r t |
1236
67a28636ea64
Fix bug with co -C across branches, update tests
mpm@selenic.com
parents:
814
diff
changeset
|
52 echo %% |
407
0e0d0670b2bc
[PATCH] Merging identical changes from another branch
mpm@selenic.com
parents:
diff
changeset
|
53 |
0e0d0670b2bc
[PATCH] Merging identical changes from another branch
mpm@selenic.com
parents:
diff
changeset
|
54 mkdir t |
0e0d0670b2bc
[PATCH] Merging identical changes from another branch
mpm@selenic.com
parents:
diff
changeset
|
55 cd t |
0e0d0670b2bc
[PATCH] Merging identical changes from another branch
mpm@selenic.com
parents:
diff
changeset
|
56 hg init |
0e0d0670b2bc
[PATCH] Merging identical changes from another branch
mpm@selenic.com
parents:
diff
changeset
|
57 echo This is file a1 > a |
0e0d0670b2bc
[PATCH] Merging identical changes from another branch
mpm@selenic.com
parents:
diff
changeset
|
58 hg add a |
1933
7544700fd931
Use 'hg ci -d "1000000 0"' in tests to circumvent problem with leading zero.
Thomas Arendsen Hein <thomas@intevation.de>
parents:
1581
diff
changeset
|
59 hg commit -m "commit #0" -d "1000000 0" |
407
0e0d0670b2bc
[PATCH] Merging identical changes from another branch
mpm@selenic.com
parents:
diff
changeset
|
60 echo This is file b1 > b |
0e0d0670b2bc
[PATCH] Merging identical changes from another branch
mpm@selenic.com
parents:
diff
changeset
|
61 hg add b |
1933
7544700fd931
Use 'hg ci -d "1000000 0"' in tests to circumvent problem with leading zero.
Thomas Arendsen Hein <thomas@intevation.de>
parents:
1581
diff
changeset
|
62 hg commit -m "commit #1" -d "1000000 0" |
407
0e0d0670b2bc
[PATCH] Merging identical changes from another branch
mpm@selenic.com
parents:
diff
changeset
|
63 echo This is file b22 > b |
1933
7544700fd931
Use 'hg ci -d "1000000 0"' in tests to circumvent problem with leading zero.
Thomas Arendsen Hein <thomas@intevation.de>
parents:
1581
diff
changeset
|
64 hg commit -m "commit #2" -d "1000000 0" |
407
0e0d0670b2bc
[PATCH] Merging identical changes from another branch
mpm@selenic.com
parents:
diff
changeset
|
65 hg update 1 |
0e0d0670b2bc
[PATCH] Merging identical changes from another branch
mpm@selenic.com
parents:
diff
changeset
|
66 echo This is file c1 > c |
0e0d0670b2bc
[PATCH] Merging identical changes from another branch
mpm@selenic.com
parents:
diff
changeset
|
67 hg add c |
1933
7544700fd931
Use 'hg ci -d "1000000 0"' in tests to circumvent problem with leading zero.
Thomas Arendsen Hein <thomas@intevation.de>
parents:
1581
diff
changeset
|
68 hg commit -m "commit #3" -d "1000000 0" |
1236
67a28636ea64
Fix bug with co -C across branches, update tests
mpm@selenic.com
parents:
814
diff
changeset
|
69 |
67a28636ea64
Fix bug with co -C across branches, update tests
mpm@selenic.com
parents:
814
diff
changeset
|
70 echo 'Contents of b should be "this is file b1"' |
430 | 71 cat b |
1236
67a28636ea64
Fix bug with co -C across branches, update tests
mpm@selenic.com
parents:
814
diff
changeset
|
72 |
407
0e0d0670b2bc
[PATCH] Merging identical changes from another branch
mpm@selenic.com
parents:
diff
changeset
|
73 echo This is file b22 > b |
1581
db10b7114de0
abort when merging two heads and repository has local changes
Benoit Boissinot <benoit.boissinot@ens-lyon.org>
parents:
1236
diff
changeset
|
74 echo %% merge fails |
2283
e506c14382fd
deprecate 'update -m'. use 'merge' instead.
Vadim Gelfer <vadim.gelfer@gmail.com>
parents:
1933
diff
changeset
|
75 env HGMERGE=../merge hg merge 2 |
1236
67a28636ea64
Fix bug with co -C across branches, update tests
mpm@selenic.com
parents:
814
diff
changeset
|
76 echo %% merge expected! |
2283
e506c14382fd
deprecate 'update -m'. use 'merge' instead.
Vadim Gelfer <vadim.gelfer@gmail.com>
parents:
1933
diff
changeset
|
77 env HGMERGE=../merge hg merge -f 2 |
3328
49966b5ab16f
fix traceback of extdiff after a merge
Benoit Boissinot <benoit.boissinot@ens-lyon.org>
parents:
2283
diff
changeset
|
78 hg diff --nodates |
49966b5ab16f
fix traceback of extdiff after a merge
Benoit Boissinot <benoit.boissinot@ens-lyon.org>
parents:
2283
diff
changeset
|
79 hg status |
3988
9dcf9d45cab8
Don't use -f for rm in tests where not needed. Drop /bin/ from /bin/rm.
Thomas Arendsen Hein <thomas@intevation.de>
parents:
3328
diff
changeset
|
80 cd ..; rm -r t |
407
0e0d0670b2bc
[PATCH] Merging identical changes from another branch
mpm@selenic.com
parents:
diff
changeset
|
81 |
0e0d0670b2bc
[PATCH] Merging identical changes from another branch
mpm@selenic.com
parents:
diff
changeset
|
82 mkdir t |
0e0d0670b2bc
[PATCH] Merging identical changes from another branch
mpm@selenic.com
parents:
diff
changeset
|
83 cd t |
0e0d0670b2bc
[PATCH] Merging identical changes from another branch
mpm@selenic.com
parents:
diff
changeset
|
84 hg init |
0e0d0670b2bc
[PATCH] Merging identical changes from another branch
mpm@selenic.com
parents:
diff
changeset
|
85 echo This is file a1 > a |
0e0d0670b2bc
[PATCH] Merging identical changes from another branch
mpm@selenic.com
parents:
diff
changeset
|
86 hg add a |
1933
7544700fd931
Use 'hg ci -d "1000000 0"' in tests to circumvent problem with leading zero.
Thomas Arendsen Hein <thomas@intevation.de>
parents:
1581
diff
changeset
|
87 hg commit -m "commit #0" -d "1000000 0" |
407
0e0d0670b2bc
[PATCH] Merging identical changes from another branch
mpm@selenic.com
parents:
diff
changeset
|
88 echo This is file b1 > b |
0e0d0670b2bc
[PATCH] Merging identical changes from another branch
mpm@selenic.com
parents:
diff
changeset
|
89 hg add b |
1933
7544700fd931
Use 'hg ci -d "1000000 0"' in tests to circumvent problem with leading zero.
Thomas Arendsen Hein <thomas@intevation.de>
parents:
1581
diff
changeset
|
90 hg commit -m "commit #1" -d "1000000 0" |
407
0e0d0670b2bc
[PATCH] Merging identical changes from another branch
mpm@selenic.com
parents:
diff
changeset
|
91 echo This is file b22 > b |
1933
7544700fd931
Use 'hg ci -d "1000000 0"' in tests to circumvent problem with leading zero.
Thomas Arendsen Hein <thomas@intevation.de>
parents:
1581
diff
changeset
|
92 hg commit -m "commit #2" -d "1000000 0" |
407
0e0d0670b2bc
[PATCH] Merging identical changes from another branch
mpm@selenic.com
parents:
diff
changeset
|
93 hg update 1 |
0e0d0670b2bc
[PATCH] Merging identical changes from another branch
mpm@selenic.com
parents:
diff
changeset
|
94 echo This is file c1 > c |
0e0d0670b2bc
[PATCH] Merging identical changes from another branch
mpm@selenic.com
parents:
diff
changeset
|
95 hg add c |
1933
7544700fd931
Use 'hg ci -d "1000000 0"' in tests to circumvent problem with leading zero.
Thomas Arendsen Hein <thomas@intevation.de>
parents:
1581
diff
changeset
|
96 hg commit -m "commit #3" -d "1000000 0" |
407
0e0d0670b2bc
[PATCH] Merging identical changes from another branch
mpm@selenic.com
parents:
diff
changeset
|
97 echo This is file b33 > b |
1581
db10b7114de0
abort when merging two heads and repository has local changes
Benoit Boissinot <benoit.boissinot@ens-lyon.org>
parents:
1236
diff
changeset
|
98 echo %% merge of b should fail |
2283
e506c14382fd
deprecate 'update -m'. use 'merge' instead.
Vadim Gelfer <vadim.gelfer@gmail.com>
parents:
1933
diff
changeset
|
99 env HGMERGE=../merge hg merge 2 |
1581
db10b7114de0
abort when merging two heads and repository has local changes
Benoit Boissinot <benoit.boissinot@ens-lyon.org>
parents:
1236
diff
changeset
|
100 echo %% merge of b expected |
2283
e506c14382fd
deprecate 'update -m'. use 'merge' instead.
Vadim Gelfer <vadim.gelfer@gmail.com>
parents:
1933
diff
changeset
|
101 env HGMERGE=../merge hg merge -f 2 |
3328
49966b5ab16f
fix traceback of extdiff after a merge
Benoit Boissinot <benoit.boissinot@ens-lyon.org>
parents:
2283
diff
changeset
|
102 hg diff --nodates |
49966b5ab16f
fix traceback of extdiff after a merge
Benoit Boissinot <benoit.boissinot@ens-lyon.org>
parents:
2283
diff
changeset
|
103 hg status |