tests/test-simplemerge-cmd
author Alexis S. L. Carvalho <alexis@cecm.usp.br>
Thu, 04 Oct 2007 23:21:37 -0300
changeset 5378 8a2915f57dfc
parent 4363 c6413f8f2f8e
permissions -rwxr-xr-x
convert: add a mode where mercurial_sink skips empty revisions. The getchanges function of some converter_source classes can return some false positives. I.e. they sometimes claim that a file "foo" was changed in some revision, even though its contents are still the same. convert_svn is particularly bad, but I think this can also happen with convert_cvs and, at least in theory, with mercurial_source. For regular conversions this is not really a problem - as long as getfile returns the right contents, we'll get a converted revision with the right contents. But when we use --filemap, this could lead to superfluous revisions being converted. Instead of fixing every converter_source, I decided to change mercurial_sink to work around this problem. When --filemap is used, we're interested only in revisions that touch some specific files. If a revision doesn't change any of these files, then we're not interested in it (at least for revisions with a single parent; merges are special). For mercurial_sink, we abuse this property and rollback a commit if the manifest text hasn't changed. This avoids duplicating the logic from localrepo.filecommit to detect unchanged files.
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
4360
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'
4363
c6413f8f2f8e Use python instead of shell printf with \x for test-simplemerge-cmd
Thomas Arendsen Hein <thomas@intevation.de>
parents: 4360
diff changeset
    45
python -c "f = file('binary-local', 'w'); f.write('\x00'); f.close()"
4360
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