tests/test-merge1
author Matt Mackall <mpm@selenic.com>
Wed, 01 Aug 2007 12:33:12 -0500
changeset 5045 f191bc3916f7
parent 4294 ccfe423d3d0a
permissions -rwxr-xr-x
merge: do early copy to deal with issue636 Without copies/renames, merges source names are 1:1 with their targets. Copies and renames introduce the possibility that there will be two merges with the same input but different output. By doing the copy to the destination name before the merge, the actual merge becomes 1:1 again, and no source is the input to two different merges. - add a preliminary scan to applyupdates to do copies - for the merge action, pass the old name (for finding ancestors) and the new name (for input to the merge) to filemerge - eliminate the old post-merge copy - lookup file contents from new name in filemerge - pass new name to external merge helper - report merge failure at new name - add a test
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
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
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
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
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
5b22029b5aa2 Fix up test-merge1
mpm@selenic.com
parents: 407
diff changeset
    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
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
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
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