tests/test-merge1
author Martin Geisler <mg@lazybytes.net>
Sun, 03 May 2009 00:41:09 +0200
changeset 8283 d6134b800797
parent 7080 a6477aa893b8
child 8387 50b6af595e0c
permissions -rwxr-xr-x
setup: cleanup old left-over code
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
7080
a6477aa893b8 tests: Windows compatibility fixes
Patrick Mezard <pmezard@gmail.com>
parents: 4294
diff changeset
     5
a6477aa893b8 tests: Windows compatibility fixes
Patrick Mezard <pmezard@gmail.com>
parents: 4294
diff changeset
     6
try:
a6477aa893b8 tests: Windows compatibility fixes
Patrick Mezard <pmezard@gmail.com>
parents: 4294
diff changeset
     7
    import msvcrt
a6477aa893b8 tests: Windows compatibility fixes
Patrick Mezard <pmezard@gmail.com>
parents: 4294
diff changeset
     8
    msvcrt.setmode(sys.stdout.fileno(), os.O_BINARY)
a6477aa893b8 tests: Windows compatibility fixes
Patrick Mezard <pmezard@gmail.com>
parents: 4294
diff changeset
     9
    msvcrt.setmode(sys.stderr.fileno(), os.O_BINARY)
a6477aa893b8 tests: Windows compatibility fixes
Patrick Mezard <pmezard@gmail.com>
parents: 4294
diff changeset
    10
except ImportError:
a6477aa893b8 tests: Windows compatibility fixes
Patrick Mezard <pmezard@gmail.com>
parents: 4294
diff changeset
    11
    pass
a6477aa893b8 tests: Windows compatibility fixes
Patrick Mezard <pmezard@gmail.com>
parents: 4294
diff changeset
    12
4294
ccfe423d3d0a test-merge1: avoid a shell script
Alexis S. L. Carvalho <alexis@cecm.usp.br>
parents: 3988
diff changeset
    13
print "merging for", os.path.basename(sys.argv[1])
407
0e0d0670b2bc [PATCH] Merging identical changes from another branch
mpm@selenic.com
parents:
diff changeset
    14
EOF
4294
ccfe423d3d0a test-merge1: avoid a shell script
Alexis S. L. Carvalho <alexis@cecm.usp.br>
parents: 3988
diff changeset
    15
HGMERGE="python ../merge"; export HGMERGE
407
0e0d0670b2bc [PATCH] Merging identical changes from another branch
mpm@selenic.com
parents:
diff changeset
    16
0e0d0670b2bc [PATCH] Merging identical changes from another branch
mpm@selenic.com
parents:
diff changeset
    17
mkdir t
0e0d0670b2bc [PATCH] Merging identical changes from another branch
mpm@selenic.com
parents:
diff changeset
    18
cd t
0e0d0670b2bc [PATCH] Merging identical changes from another branch
mpm@selenic.com
parents:
diff changeset
    19
hg init
0e0d0670b2bc [PATCH] Merging identical changes from another branch
mpm@selenic.com
parents:
diff changeset
    20
echo This is file a1 > a
0e0d0670b2bc [PATCH] Merging identical changes from another branch
mpm@selenic.com
parents:
diff changeset
    21
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
    22
hg commit -m "commit #0" -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
0e0d0670b2bc [PATCH] Merging identical changes from another branch
mpm@selenic.com
parents:
diff changeset
    24
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
    25
hg commit -m "commit #1" -d "1000000 0"
407
0e0d0670b2bc [PATCH] Merging identical changes from another branch
mpm@selenic.com
parents:
diff changeset
    26
0e0d0670b2bc [PATCH] Merging identical changes from another branch
mpm@selenic.com
parents:
diff changeset
    27
hg update 0
0e0d0670b2bc [PATCH] Merging identical changes from another branch
mpm@selenic.com
parents:
diff changeset
    28
echo This is file c1 > c
0e0d0670b2bc [PATCH] Merging identical changes from another branch
mpm@selenic.com
parents:
diff changeset
    29
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
    30
hg commit -m "commit #2" -d "1000000 0"
407
0e0d0670b2bc [PATCH] Merging identical changes from another branch
mpm@selenic.com
parents:
diff changeset
    31
echo This is file b1 > b
1236
67a28636ea64 Fix bug with co -C across branches, update tests
mpm@selenic.com
parents: 814
diff changeset
    32
echo %% no merges expected
4294
ccfe423d3d0a test-merge1: avoid a shell script
Alexis S. L. Carvalho <alexis@cecm.usp.br>
parents: 3988
diff changeset
    33
hg merge 1
3330
49966b5ab16f fix traceback of extdiff after a merge
Benoit Boissinot <benoit.boissinot@ens-lyon.org>
parents: 2283
diff changeset
    34
hg diff --nodates
49966b5ab16f fix traceback of extdiff after a merge
Benoit Boissinot <benoit.boissinot@ens-lyon.org>
parents: 2283
diff changeset
    35
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
    36
cd ..; rm -r t
407
0e0d0670b2bc [PATCH] Merging identical changes from another branch
mpm@selenic.com
parents:
diff changeset
    37
0e0d0670b2bc [PATCH] Merging identical changes from another branch
mpm@selenic.com
parents:
diff changeset
    38
mkdir t
0e0d0670b2bc [PATCH] Merging identical changes from another branch
mpm@selenic.com
parents:
diff changeset
    39
cd t
0e0d0670b2bc [PATCH] Merging identical changes from another branch
mpm@selenic.com
parents:
diff changeset
    40
hg init
0e0d0670b2bc [PATCH] Merging identical changes from another branch
mpm@selenic.com
parents:
diff changeset
    41
echo This is file a1 > a
0e0d0670b2bc [PATCH] Merging identical changes from another branch
mpm@selenic.com
parents:
diff changeset
    42
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
    43
hg commit -m "commit #0" -d "1000000 0"
407
0e0d0670b2bc [PATCH] Merging identical changes from another branch
mpm@selenic.com
parents:
diff changeset
    44
echo This is file b1 > b
0e0d0670b2bc [PATCH] Merging identical changes from another branch
mpm@selenic.com
parents:
diff changeset
    45
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
    46
hg commit -m "commit #1" -d "1000000 0"
407
0e0d0670b2bc [PATCH] Merging identical changes from another branch
mpm@selenic.com
parents:
diff changeset
    47
0e0d0670b2bc [PATCH] Merging identical changes from another branch
mpm@selenic.com
parents:
diff changeset
    48
hg update 0
0e0d0670b2bc [PATCH] Merging identical changes from another branch
mpm@selenic.com
parents:
diff changeset
    49
echo This is file c1 > c
0e0d0670b2bc [PATCH] Merging identical changes from another branch
mpm@selenic.com
parents:
diff changeset
    50
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
    51
hg commit -m "commit #2" -d "1000000 0"
407
0e0d0670b2bc [PATCH] Merging identical changes from another branch
mpm@selenic.com
parents:
diff changeset
    52
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
    53
echo %% merge should fail
4294
ccfe423d3d0a test-merge1: avoid a shell script
Alexis S. L. Carvalho <alexis@cecm.usp.br>
parents: 3988
diff changeset
    54
hg merge 1
1236
67a28636ea64 Fix bug with co -C across branches, update tests
mpm@selenic.com
parents: 814
diff changeset
    55
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
    56
hg merge -f 1
3330
49966b5ab16f fix traceback of extdiff after a merge
Benoit Boissinot <benoit.boissinot@ens-lyon.org>
parents: 2283
diff changeset
    57
hg diff --nodates
49966b5ab16f fix traceback of extdiff after a merge
Benoit Boissinot <benoit.boissinot@ens-lyon.org>
parents: 2283
diff changeset
    58
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
    59
cd ..; rm -r t
1236
67a28636ea64 Fix bug with co -C across branches, update tests
mpm@selenic.com
parents: 814
diff changeset
    60
echo %%
407
0e0d0670b2bc [PATCH] Merging identical changes from another branch
mpm@selenic.com
parents:
diff changeset
    61
0e0d0670b2bc [PATCH] Merging identical changes from another branch
mpm@selenic.com
parents:
diff changeset
    62
mkdir t
0e0d0670b2bc [PATCH] Merging identical changes from another branch
mpm@selenic.com
parents:
diff changeset
    63
cd t
0e0d0670b2bc [PATCH] Merging identical changes from another branch
mpm@selenic.com
parents:
diff changeset
    64
hg init
0e0d0670b2bc [PATCH] Merging identical changes from another branch
mpm@selenic.com
parents:
diff changeset
    65
echo This is file a1 > a
0e0d0670b2bc [PATCH] Merging identical changes from another branch
mpm@selenic.com
parents:
diff changeset
    66
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
    67
hg commit -m "commit #0" -d "1000000 0"
407
0e0d0670b2bc [PATCH] Merging identical changes from another branch
mpm@selenic.com
parents:
diff changeset
    68
echo This is file b1 > b
0e0d0670b2bc [PATCH] Merging identical changes from another branch
mpm@selenic.com
parents:
diff changeset
    69
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
    70
hg commit -m "commit #1" -d "1000000 0"
407
0e0d0670b2bc [PATCH] Merging identical changes from another branch
mpm@selenic.com
parents:
diff changeset
    71
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
    72
hg commit -m "commit #2" -d "1000000 0"
407
0e0d0670b2bc [PATCH] Merging identical changes from another branch
mpm@selenic.com
parents:
diff changeset
    73
hg update 1
0e0d0670b2bc [PATCH] Merging identical changes from another branch
mpm@selenic.com
parents:
diff changeset
    74
echo This is file c1 > c
0e0d0670b2bc [PATCH] Merging identical changes from another branch
mpm@selenic.com
parents:
diff changeset
    75
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
    76
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
    77
67a28636ea64 Fix bug with co -C across branches, update tests
mpm@selenic.com
parents: 814
diff changeset
    78
echo 'Contents of b should be "this is file b1"'
430
5b22029b5aa2 Fix up test-merge1
mpm@selenic.com
parents: 407
diff changeset
    79
cat b
1236
67a28636ea64 Fix bug with co -C across branches, update tests
mpm@selenic.com
parents: 814
diff changeset
    80
407
0e0d0670b2bc [PATCH] Merging identical changes from another branch
mpm@selenic.com
parents:
diff changeset
    81
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
    82
echo %% merge fails
4294
ccfe423d3d0a test-merge1: avoid a shell script
Alexis S. L. Carvalho <alexis@cecm.usp.br>
parents: 3988
diff changeset
    83
hg merge 2
1236
67a28636ea64 Fix bug with co -C across branches, update tests
mpm@selenic.com
parents: 814
diff changeset
    84
echo %% merge expected!
4294
ccfe423d3d0a test-merge1: avoid a shell script
Alexis S. L. Carvalho <alexis@cecm.usp.br>
parents: 3988
diff changeset
    85
hg merge -f 2
3330
49966b5ab16f fix traceback of extdiff after a merge
Benoit Boissinot <benoit.boissinot@ens-lyon.org>
parents: 2283
diff changeset
    86
hg diff --nodates
49966b5ab16f fix traceback of extdiff after a merge
Benoit Boissinot <benoit.boissinot@ens-lyon.org>
parents: 2283
diff changeset
    87
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
    88
cd ..; rm -r t
407
0e0d0670b2bc [PATCH] Merging identical changes from another branch
mpm@selenic.com
parents:
diff changeset
    89
0e0d0670b2bc [PATCH] Merging identical changes from another branch
mpm@selenic.com
parents:
diff changeset
    90
mkdir t
0e0d0670b2bc [PATCH] Merging identical changes from another branch
mpm@selenic.com
parents:
diff changeset
    91
cd t
0e0d0670b2bc [PATCH] Merging identical changes from another branch
mpm@selenic.com
parents:
diff changeset
    92
hg init
0e0d0670b2bc [PATCH] Merging identical changes from another branch
mpm@selenic.com
parents:
diff changeset
    93
echo This is file a1 > a
0e0d0670b2bc [PATCH] Merging identical changes from another branch
mpm@selenic.com
parents:
diff changeset
    94
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
    95
hg commit -m "commit #0" -d "1000000 0"
407
0e0d0670b2bc [PATCH] Merging identical changes from another branch
mpm@selenic.com
parents:
diff changeset
    96
echo This is file b1 > b
0e0d0670b2bc [PATCH] Merging identical changes from another branch
mpm@selenic.com
parents:
diff changeset
    97
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
    98
hg commit -m "commit #1" -d "1000000 0"
407
0e0d0670b2bc [PATCH] Merging identical changes from another branch
mpm@selenic.com
parents:
diff changeset
    99
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
   100
hg commit -m "commit #2" -d "1000000 0"
407
0e0d0670b2bc [PATCH] Merging identical changes from another branch
mpm@selenic.com
parents:
diff changeset
   101
hg update 1
0e0d0670b2bc [PATCH] Merging identical changes from another branch
mpm@selenic.com
parents:
diff changeset
   102
echo This is file c1 > c
0e0d0670b2bc [PATCH] Merging identical changes from another branch
mpm@selenic.com
parents:
diff changeset
   103
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
   104
hg commit -m "commit #3" -d "1000000 0"
407
0e0d0670b2bc [PATCH] Merging identical changes from another branch
mpm@selenic.com
parents:
diff changeset
   105
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
   106
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
   107
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
   108
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
   109
hg merge -f 2
3330
49966b5ab16f fix traceback of extdiff after a merge
Benoit Boissinot <benoit.boissinot@ens-lyon.org>
parents: 2283
diff changeset
   110
hg diff --nodates
49966b5ab16f fix traceback of extdiff after a merge
Benoit Boissinot <benoit.boissinot@ens-lyon.org>
parents: 2283
diff changeset
   111
hg status