Mercurial > public > mercurial-scm > hg
annotate tests/test-merge1 @ 4531:b51a8138292a
Avoid extra filelogs entries.
Right now, there are some situations in which localrepo.filecommit can
create filelog entries even though they're not needed. For example:
- permissions for a file have changed;
- qrefresh can create a filelog entry identical to its parent (see the
added test);
- convert-repo creates extra filelog entries in every merge where the
first parent has added files (for example, changeset ebebe9577a1a of
the kernel repo added extra filelog entries to files in the
arch/blackfin directory, even though the merge should only touch the
drivers/ata directory). This makes "hg log file" in a converted repo
less useful than it could be, since it may mention many merges that
don't actually touch that specific file.
They all come from the same basic problem: localrepo.commit (through
filecommit) creates new filelog entries for all files passed to it
(except for some cases during a merge).
Patch and test case provided by Benoit.
This should fix issue351.
author | Alexis S. L. Carvalho <alexis@cecm.usp.br> |
---|---|
date | Sat, 09 Jun 2007 01:04:28 -0300 |
parents | ccfe423d3d0a |
children | a6477aa893b8 |
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 |
4294
ccfe423d3d0a
test-merge1: avoid a shell script
Alexis S. L. Carvalho <alexis@cecm.usp.br>
parents:
3988
diff
changeset
|
3 cat <<EOF > merge |
ccfe423d3d0a
test-merge1: avoid a shell script
Alexis S. L. Carvalho <alexis@cecm.usp.br>
parents:
3988
diff
changeset
|
4 import sys, os |
ccfe423d3d0a
test-merge1: avoid a shell script
Alexis S. L. Carvalho <alexis@cecm.usp.br>
parents:
3988
diff
changeset
|
5 print "merging for", os.path.basename(sys.argv[1]) |
407
0e0d0670b2bc
[PATCH] Merging identical changes from another branch
mpm@selenic.com
parents:
diff
changeset
|
6 EOF |
4294
ccfe423d3d0a
test-merge1: avoid a shell script
Alexis S. L. Carvalho <alexis@cecm.usp.br>
parents:
3988
diff
changeset
|
7 HGMERGE="python ../merge"; export HGMERGE |
407
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 |
4294
ccfe423d3d0a
test-merge1: avoid a shell script
Alexis S. L. Carvalho <alexis@cecm.usp.br>
parents:
3988
diff
changeset
|
25 hg merge 1 |
3330
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:
3330
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 |
4294
ccfe423d3d0a
test-merge1: avoid a shell script
Alexis S. L. Carvalho <alexis@cecm.usp.br>
parents:
3988
diff
changeset
|
46 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 |
4294
ccfe423d3d0a
test-merge1: avoid a shell script
Alexis S. L. Carvalho <alexis@cecm.usp.br>
parents:
3988
diff
changeset
|
48 hg merge -f 1 |
3330
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:
3330
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 |
4294
ccfe423d3d0a
test-merge1: avoid a shell script
Alexis S. L. Carvalho <alexis@cecm.usp.br>
parents:
3988
diff
changeset
|
75 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! |
4294
ccfe423d3d0a
test-merge1: avoid a shell script
Alexis S. L. Carvalho <alexis@cecm.usp.br>
parents:
3988
diff
changeset
|
77 hg merge -f 2 |
3330
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:
3330
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 |
4294
ccfe423d3d0a
test-merge1: avoid a shell script
Alexis S. L. Carvalho <alexis@cecm.usp.br>
parents:
3988
diff
changeset
|
99 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 |
4294
ccfe423d3d0a
test-merge1: avoid a shell script
Alexis S. L. Carvalho <alexis@cecm.usp.br>
parents:
3988
diff
changeset
|
101 hg merge -f 2 |
3330
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 |