tests/test-simplemerge-cmd
author David Soria Parra <dsp@php.net>
Sun, 07 Dec 2008 08:47:02 +0100
changeset 7485 ecfb683675ed
parent 4367 c6413f8f2f8e
child 8446 e1f4343db740
permissions -rwxr-xr-x
Merge bookmarks
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
4364
d5c3a70f8422 polish the simplemerge command; add a test
Alexis S. L. Carvalho <alexis@cecm.usp.br>
parents:
diff changeset
     1
#!/bin/sh
d5c3a70f8422 polish the simplemerge command; add a test
Alexis S. L. Carvalho <alexis@cecm.usp.br>
parents:
diff changeset
     2
d5c3a70f8422 polish the simplemerge command; add a test
Alexis S. L. Carvalho <alexis@cecm.usp.br>
parents:
diff changeset
     3
cp "$TESTDIR"/../contrib/simplemerge .
d5c3a70f8422 polish the simplemerge command; add a test
Alexis S. L. Carvalho <alexis@cecm.usp.br>
parents:
diff changeset
     4
d5c3a70f8422 polish the simplemerge command; add a test
Alexis S. L. Carvalho <alexis@cecm.usp.br>
parents:
diff changeset
     5
echo base > base
d5c3a70f8422 polish the simplemerge command; add a test
Alexis S. L. Carvalho <alexis@cecm.usp.br>
parents:
diff changeset
     6
d5c3a70f8422 polish the simplemerge command; add a test
Alexis S. L. Carvalho <alexis@cecm.usp.br>
parents:
diff changeset
     7
echo local > local
d5c3a70f8422 polish the simplemerge command; add a test
Alexis S. L. Carvalho <alexis@cecm.usp.br>
parents:
diff changeset
     8
cat base >> local
d5c3a70f8422 polish the simplemerge command; add a test
Alexis S. L. Carvalho <alexis@cecm.usp.br>
parents:
diff changeset
     9
cp local orig
d5c3a70f8422 polish the simplemerge command; add a test
Alexis S. L. Carvalho <alexis@cecm.usp.br>
parents:
diff changeset
    10
d5c3a70f8422 polish the simplemerge command; add a test
Alexis S. L. Carvalho <alexis@cecm.usp.br>
parents:
diff changeset
    11
cat base > other
d5c3a70f8422 polish the simplemerge command; add a test
Alexis S. L. Carvalho <alexis@cecm.usp.br>
parents:
diff changeset
    12
echo other >> other
d5c3a70f8422 polish the simplemerge command; add a test
Alexis S. L. Carvalho <alexis@cecm.usp.br>
parents:
diff changeset
    13
d5c3a70f8422 polish the simplemerge command; add a test
Alexis S. L. Carvalho <alexis@cecm.usp.br>
parents:
diff changeset
    14
echo '% changing local directly'
d5c3a70f8422 polish the simplemerge command; add a test
Alexis S. L. Carvalho <alexis@cecm.usp.br>
parents:
diff changeset
    15
python simplemerge local base other && echo "merge succeeded"
d5c3a70f8422 polish the simplemerge command; add a test
Alexis S. L. Carvalho <alexis@cecm.usp.br>
parents:
diff changeset
    16
cat local
d5c3a70f8422 polish the simplemerge command; add a test
Alexis S. L. Carvalho <alexis@cecm.usp.br>
parents:
diff changeset
    17
cp orig local
d5c3a70f8422 polish the simplemerge command; add a test
Alexis S. L. Carvalho <alexis@cecm.usp.br>
parents:
diff changeset
    18
d5c3a70f8422 polish the simplemerge command; add a test
Alexis S. L. Carvalho <alexis@cecm.usp.br>
parents:
diff changeset
    19
echo '% printing to stdout'
d5c3a70f8422 polish the simplemerge command; add a test
Alexis S. L. Carvalho <alexis@cecm.usp.br>
parents:
diff changeset
    20
python simplemerge -p local base other
d5c3a70f8422 polish the simplemerge command; add a test
Alexis S. L. Carvalho <alexis@cecm.usp.br>
parents:
diff changeset
    21
echo ' local:'
d5c3a70f8422 polish the simplemerge command; add a test
Alexis S. L. Carvalho <alexis@cecm.usp.br>
parents:
diff changeset
    22
cat local
d5c3a70f8422 polish the simplemerge command; add a test
Alexis S. L. Carvalho <alexis@cecm.usp.br>
parents:
diff changeset
    23
d5c3a70f8422 polish the simplemerge command; add a test
Alexis S. L. Carvalho <alexis@cecm.usp.br>
parents:
diff changeset
    24
echo '% conflicts'
d5c3a70f8422 polish the simplemerge command; add a test
Alexis S. L. Carvalho <alexis@cecm.usp.br>
parents:
diff changeset
    25
cp base conflict-local
d5c3a70f8422 polish the simplemerge command; add a test
Alexis S. L. Carvalho <alexis@cecm.usp.br>
parents:
diff changeset
    26
cp other conflict-other
d5c3a70f8422 polish the simplemerge command; add a test
Alexis S. L. Carvalho <alexis@cecm.usp.br>
parents:
diff changeset
    27
echo not other >> conflict-local
d5c3a70f8422 polish the simplemerge command; add a test
Alexis S. L. Carvalho <alexis@cecm.usp.br>
parents:
diff changeset
    28
echo end >> conflict-local
d5c3a70f8422 polish the simplemerge command; add a test
Alexis S. L. Carvalho <alexis@cecm.usp.br>
parents:
diff changeset
    29
echo end >> conflict-other
d5c3a70f8422 polish the simplemerge command; add a test
Alexis S. L. Carvalho <alexis@cecm.usp.br>
parents:
diff changeset
    30
python simplemerge -p conflict-local base conflict-other || echo "merge failed"
d5c3a70f8422 polish the simplemerge command; add a test
Alexis S. L. Carvalho <alexis@cecm.usp.br>
parents:
diff changeset
    31
d5c3a70f8422 polish the simplemerge command; add a test
Alexis S. L. Carvalho <alexis@cecm.usp.br>
parents:
diff changeset
    32
echo '% --no-minimal'
d5c3a70f8422 polish the simplemerge command; add a test
Alexis S. L. Carvalho <alexis@cecm.usp.br>
parents:
diff changeset
    33
python simplemerge -p --no-minimal conflict-local base conflict-other
d5c3a70f8422 polish the simplemerge command; add a test
Alexis S. L. Carvalho <alexis@cecm.usp.br>
parents:
diff changeset
    34
d5c3a70f8422 polish the simplemerge command; add a test
Alexis S. L. Carvalho <alexis@cecm.usp.br>
parents:
diff changeset
    35
echo '% 1 label'
d5c3a70f8422 polish the simplemerge command; add a test
Alexis S. L. Carvalho <alexis@cecm.usp.br>
parents:
diff changeset
    36
python simplemerge -p -L foo conflict-local base conflict-other
d5c3a70f8422 polish the simplemerge command; add a test
Alexis S. L. Carvalho <alexis@cecm.usp.br>
parents:
diff changeset
    37
d5c3a70f8422 polish the simplemerge command; add a test
Alexis S. L. Carvalho <alexis@cecm.usp.br>
parents:
diff changeset
    38
echo '% 2 labels'
d5c3a70f8422 polish the simplemerge command; add a test
Alexis S. L. Carvalho <alexis@cecm.usp.br>
parents:
diff changeset
    39
python simplemerge -p -L foo -L bar conflict-local base conflict-other
d5c3a70f8422 polish the simplemerge command; add a test
Alexis S. L. Carvalho <alexis@cecm.usp.br>
parents:
diff changeset
    40
d5c3a70f8422 polish the simplemerge command; add a test
Alexis S. L. Carvalho <alexis@cecm.usp.br>
parents:
diff changeset
    41
echo '% too many labels'
d5c3a70f8422 polish the simplemerge command; add a test
Alexis S. L. Carvalho <alexis@cecm.usp.br>
parents:
diff changeset
    42
python simplemerge -p -L foo -L bar -L baz conflict-local base conflict-other
d5c3a70f8422 polish the simplemerge command; add a test
Alexis S. L. Carvalho <alexis@cecm.usp.br>
parents:
diff changeset
    43
d5c3a70f8422 polish the simplemerge command; add a test
Alexis S. L. Carvalho <alexis@cecm.usp.br>
parents:
diff changeset
    44
echo '% binary file'
4367
c6413f8f2f8e Use python instead of shell printf with \x for test-simplemerge-cmd
Thomas Arendsen Hein <thomas@intevation.de>
parents: 4364
diff changeset
    45
python -c "f = file('binary-local', 'w'); f.write('\x00'); f.close()"
4364
d5c3a70f8422 polish the simplemerge command; add a test
Alexis S. L. Carvalho <alexis@cecm.usp.br>
parents:
diff changeset
    46
cat orig >> binary-local
d5c3a70f8422 polish the simplemerge command; add a test
Alexis S. L. Carvalho <alexis@cecm.usp.br>
parents:
diff changeset
    47
python simplemerge -p binary-local base other
d5c3a70f8422 polish the simplemerge command; add a test
Alexis S. L. Carvalho <alexis@cecm.usp.br>
parents:
diff changeset
    48
d5c3a70f8422 polish the simplemerge command; add a test
Alexis S. L. Carvalho <alexis@cecm.usp.br>
parents:
diff changeset
    49
echo '% binary file --text'
d5c3a70f8422 polish the simplemerge command; add a test
Alexis S. L. Carvalho <alexis@cecm.usp.br>
parents:
diff changeset
    50
python simplemerge -a -p binary-local base other
d5c3a70f8422 polish the simplemerge command; add a test
Alexis S. L. Carvalho <alexis@cecm.usp.br>
parents:
diff changeset
    51
d5c3a70f8422 polish the simplemerge command; add a test
Alexis S. L. Carvalho <alexis@cecm.usp.br>
parents:
diff changeset
    52
echo '% help'
d5c3a70f8422 polish the simplemerge command; add a test
Alexis S. L. Carvalho <alexis@cecm.usp.br>
parents:
diff changeset
    53
python simplemerge --help
d5c3a70f8422 polish the simplemerge command; add a test
Alexis S. L. Carvalho <alexis@cecm.usp.br>
parents:
diff changeset
    54
d5c3a70f8422 polish the simplemerge command; add a test
Alexis S. L. Carvalho <alexis@cecm.usp.br>
parents:
diff changeset
    55
echo '% wrong number of arguments'
d5c3a70f8422 polish the simplemerge command; add a test
Alexis S. L. Carvalho <alexis@cecm.usp.br>
parents:
diff changeset
    56
python simplemerge
d5c3a70f8422 polish the simplemerge command; add a test
Alexis S. L. Carvalho <alexis@cecm.usp.br>
parents:
diff changeset
    57
d5c3a70f8422 polish the simplemerge command; add a test
Alexis S. L. Carvalho <alexis@cecm.usp.br>
parents:
diff changeset
    58
echo '% bad option'
d5c3a70f8422 polish the simplemerge command; add a test
Alexis S. L. Carvalho <alexis@cecm.usp.br>
parents:
diff changeset
    59
python simplemerge --foo -p local base other
d5c3a70f8422 polish the simplemerge command; add a test
Alexis S. L. Carvalho <alexis@cecm.usp.br>
parents:
diff changeset
    60
d5c3a70f8422 polish the simplemerge command; add a test
Alexis S. L. Carvalho <alexis@cecm.usp.br>
parents:
diff changeset
    61
exit 0