tests/test-merge-prompt
author Renato Cunha <renatoc@gmail.com>
Tue, 03 Aug 2010 13:41:47 -0300
changeset 11747 40d5633889bb
parent 5672 8a65ea986755
permissions -rwxr-xr-x
hgfixes: add a fixer to convert plain strings to bytestrings This patch implements a 2to3 fixer that converts all plain strings in a python source file to byte strings syntax. Example: foo = 'Normal string' would become foo = b'Normal string' The motivation behind this fixer can be found in http://selenic.com/pipermail/mercurial-devel/2010-June/022363.html or, in other words: the current hg source assumes that _most_ strings are "meant" to be byte sequences, so it makes sense to make the convertion implemented by this patch. As mentioned above, not all mercurial modules want to use strings as bytes, examples include i18n (which uses unicode), and demandimport (in py3k, module names are normal strings, thus unicode, and there's no need for a convertion). Therefore, these modules are blacklisted in the fixer. There are also a few functions that can take only unicode arguments, thus the convertion shouldn't be done for those.
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
5672
8a65ea986755 Tests for b5605d88dc27 and 840e2b315c1f (interactive prompts during merge)
Thomas Arendsen Hein <thomas@intevation.de>
parents:
diff changeset
     1
#!/bin/sh
8a65ea986755 Tests for b5605d88dc27 and 840e2b315c1f (interactive prompts during merge)
Thomas Arendsen Hein <thomas@intevation.de>
parents:
diff changeset
     2
#
8a65ea986755 Tests for b5605d88dc27 and 840e2b315c1f (interactive prompts during merge)
Thomas Arendsen Hein <thomas@intevation.de>
parents:
diff changeset
     3
# Test for b5605d88dc27
8a65ea986755 Tests for b5605d88dc27 and 840e2b315c1f (interactive prompts during merge)
Thomas Arendsen Hein <thomas@intevation.de>
parents:
diff changeset
     4
#  Make ui.prompt repeat on "unrecognized response" again (issue897)
8a65ea986755 Tests for b5605d88dc27 and 840e2b315c1f (interactive prompts during merge)
Thomas Arendsen Hein <thomas@intevation.de>
parents:
diff changeset
     5
# and for 840e2b315c1f
8a65ea986755 Tests for b5605d88dc27 and 840e2b315c1f (interactive prompts during merge)
Thomas Arendsen Hein <thomas@intevation.de>
parents:
diff changeset
     6
#  Fix misleading error and prompts during update/merge (issue556)
8a65ea986755 Tests for b5605d88dc27 and 840e2b315c1f (interactive prompts during merge)
Thomas Arendsen Hein <thomas@intevation.de>
parents:
diff changeset
     7
8a65ea986755 Tests for b5605d88dc27 and 840e2b315c1f (interactive prompts during merge)
Thomas Arendsen Hein <thomas@intevation.de>
parents:
diff changeset
     8
status() {
8a65ea986755 Tests for b5605d88dc27 and 840e2b315c1f (interactive prompts during merge)
Thomas Arendsen Hein <thomas@intevation.de>
parents:
diff changeset
     9
    [ $? -ne 0 ] && echo "failed."
8a65ea986755 Tests for b5605d88dc27 and 840e2b315c1f (interactive prompts during merge)
Thomas Arendsen Hein <thomas@intevation.de>
parents:
diff changeset
    10
    echo "status:"
8a65ea986755 Tests for b5605d88dc27 and 840e2b315c1f (interactive prompts during merge)
Thomas Arendsen Hein <thomas@intevation.de>
parents:
diff changeset
    11
    hg st -A file1 file2
8a65ea986755 Tests for b5605d88dc27 and 840e2b315c1f (interactive prompts during merge)
Thomas Arendsen Hein <thomas@intevation.de>
parents:
diff changeset
    12
    for file in file1 file2; do
8a65ea986755 Tests for b5605d88dc27 and 840e2b315c1f (interactive prompts during merge)
Thomas Arendsen Hein <thomas@intevation.de>
parents:
diff changeset
    13
        if [ -f $file ]; then
8a65ea986755 Tests for b5605d88dc27 and 840e2b315c1f (interactive prompts during merge)
Thomas Arendsen Hein <thomas@intevation.de>
parents:
diff changeset
    14
            echo "$file:"
8a65ea986755 Tests for b5605d88dc27 and 840e2b315c1f (interactive prompts during merge)
Thomas Arendsen Hein <thomas@intevation.de>
parents:
diff changeset
    15
            cat $file
8a65ea986755 Tests for b5605d88dc27 and 840e2b315c1f (interactive prompts during merge)
Thomas Arendsen Hein <thomas@intevation.de>
parents:
diff changeset
    16
        else
8a65ea986755 Tests for b5605d88dc27 and 840e2b315c1f (interactive prompts during merge)
Thomas Arendsen Hein <thomas@intevation.de>
parents:
diff changeset
    17
            echo "$file does not exist"
8a65ea986755 Tests for b5605d88dc27 and 840e2b315c1f (interactive prompts during merge)
Thomas Arendsen Hein <thomas@intevation.de>
parents:
diff changeset
    18
        fi
8a65ea986755 Tests for b5605d88dc27 and 840e2b315c1f (interactive prompts during merge)
Thomas Arendsen Hein <thomas@intevation.de>
parents:
diff changeset
    19
    done
8a65ea986755 Tests for b5605d88dc27 and 840e2b315c1f (interactive prompts during merge)
Thomas Arendsen Hein <thomas@intevation.de>
parents:
diff changeset
    20
}
8a65ea986755 Tests for b5605d88dc27 and 840e2b315c1f (interactive prompts during merge)
Thomas Arendsen Hein <thomas@intevation.de>
parents:
diff changeset
    21
8a65ea986755 Tests for b5605d88dc27 and 840e2b315c1f (interactive prompts during merge)
Thomas Arendsen Hein <thomas@intevation.de>
parents:
diff changeset
    22
hg init repo
8a65ea986755 Tests for b5605d88dc27 and 840e2b315c1f (interactive prompts during merge)
Thomas Arendsen Hein <thomas@intevation.de>
parents:
diff changeset
    23
cd repo
8a65ea986755 Tests for b5605d88dc27 and 840e2b315c1f (interactive prompts during merge)
Thomas Arendsen Hein <thomas@intevation.de>
parents:
diff changeset
    24
echo 1 > file1
8a65ea986755 Tests for b5605d88dc27 and 840e2b315c1f (interactive prompts during merge)
Thomas Arendsen Hein <thomas@intevation.de>
parents:
diff changeset
    25
echo 2 > file2
8a65ea986755 Tests for b5605d88dc27 and 840e2b315c1f (interactive prompts during merge)
Thomas Arendsen Hein <thomas@intevation.de>
parents:
diff changeset
    26
hg ci -Am 'added file1 and file2' # rev 0
8a65ea986755 Tests for b5605d88dc27 and 840e2b315c1f (interactive prompts during merge)
Thomas Arendsen Hein <thomas@intevation.de>
parents:
diff changeset
    27
8a65ea986755 Tests for b5605d88dc27 and 840e2b315c1f (interactive prompts during merge)
Thomas Arendsen Hein <thomas@intevation.de>
parents:
diff changeset
    28
hg rm file1
8a65ea986755 Tests for b5605d88dc27 and 840e2b315c1f (interactive prompts during merge)
Thomas Arendsen Hein <thomas@intevation.de>
parents:
diff changeset
    29
echo changed >> file2
8a65ea986755 Tests for b5605d88dc27 and 840e2b315c1f (interactive prompts during merge)
Thomas Arendsen Hein <thomas@intevation.de>
parents:
diff changeset
    30
hg ci -m 'removed file1, changed file2' # rev 1
8a65ea986755 Tests for b5605d88dc27 and 840e2b315c1f (interactive prompts during merge)
Thomas Arendsen Hein <thomas@intevation.de>
parents:
diff changeset
    31
8a65ea986755 Tests for b5605d88dc27 and 840e2b315c1f (interactive prompts during merge)
Thomas Arendsen Hein <thomas@intevation.de>
parents:
diff changeset
    32
hg co 0
8a65ea986755 Tests for b5605d88dc27 and 840e2b315c1f (interactive prompts during merge)
Thomas Arendsen Hein <thomas@intevation.de>
parents:
diff changeset
    33
echo changed >> file1
8a65ea986755 Tests for b5605d88dc27 and 840e2b315c1f (interactive prompts during merge)
Thomas Arendsen Hein <thomas@intevation.de>
parents:
diff changeset
    34
hg rm file2
8a65ea986755 Tests for b5605d88dc27 and 840e2b315c1f (interactive prompts during merge)
Thomas Arendsen Hein <thomas@intevation.de>
parents:
diff changeset
    35
hg ci -m 'changed file1, removed file2' # rev 2
8a65ea986755 Tests for b5605d88dc27 and 840e2b315c1f (interactive prompts during merge)
Thomas Arendsen Hein <thomas@intevation.de>
parents:
diff changeset
    36
8a65ea986755 Tests for b5605d88dc27 and 840e2b315c1f (interactive prompts during merge)
Thomas Arendsen Hein <thomas@intevation.de>
parents:
diff changeset
    37
echo
8a65ea986755 Tests for b5605d88dc27 and 840e2b315c1f (interactive prompts during merge)
Thomas Arendsen Hein <thomas@intevation.de>
parents:
diff changeset
    38
echo "# non-interactive merge"
8a65ea986755 Tests for b5605d88dc27 and 840e2b315c1f (interactive prompts during merge)
Thomas Arendsen Hein <thomas@intevation.de>
parents:
diff changeset
    39
hg merge -y || echo "failed"
8a65ea986755 Tests for b5605d88dc27 and 840e2b315c1f (interactive prompts during merge)
Thomas Arendsen Hein <thomas@intevation.de>
parents:
diff changeset
    40
status
8a65ea986755 Tests for b5605d88dc27 and 840e2b315c1f (interactive prompts during merge)
Thomas Arendsen Hein <thomas@intevation.de>
parents:
diff changeset
    41
8a65ea986755 Tests for b5605d88dc27 and 840e2b315c1f (interactive prompts during merge)
Thomas Arendsen Hein <thomas@intevation.de>
parents:
diff changeset
    42
echo
8a65ea986755 Tests for b5605d88dc27 and 840e2b315c1f (interactive prompts during merge)
Thomas Arendsen Hein <thomas@intevation.de>
parents:
diff changeset
    43
echo "# interactive merge"
8a65ea986755 Tests for b5605d88dc27 and 840e2b315c1f (interactive prompts during merge)
Thomas Arendsen Hein <thomas@intevation.de>
parents:
diff changeset
    44
hg co -C
8a65ea986755 Tests for b5605d88dc27 and 840e2b315c1f (interactive prompts during merge)
Thomas Arendsen Hein <thomas@intevation.de>
parents:
diff changeset
    45
hg merge --config ui.interactive=true <<EOF || echo "failed"
8a65ea986755 Tests for b5605d88dc27 and 840e2b315c1f (interactive prompts during merge)
Thomas Arendsen Hein <thomas@intevation.de>
parents:
diff changeset
    46
c
8a65ea986755 Tests for b5605d88dc27 and 840e2b315c1f (interactive prompts during merge)
Thomas Arendsen Hein <thomas@intevation.de>
parents:
diff changeset
    47
d
8a65ea986755 Tests for b5605d88dc27 and 840e2b315c1f (interactive prompts during merge)
Thomas Arendsen Hein <thomas@intevation.de>
parents:
diff changeset
    48
EOF
8a65ea986755 Tests for b5605d88dc27 and 840e2b315c1f (interactive prompts during merge)
Thomas Arendsen Hein <thomas@intevation.de>
parents:
diff changeset
    49
status
8a65ea986755 Tests for b5605d88dc27 and 840e2b315c1f (interactive prompts during merge)
Thomas Arendsen Hein <thomas@intevation.de>
parents:
diff changeset
    50
8a65ea986755 Tests for b5605d88dc27 and 840e2b315c1f (interactive prompts during merge)
Thomas Arendsen Hein <thomas@intevation.de>
parents:
diff changeset
    51
echo
8a65ea986755 Tests for b5605d88dc27 and 840e2b315c1f (interactive prompts during merge)
Thomas Arendsen Hein <thomas@intevation.de>
parents:
diff changeset
    52
echo "# interactive merge with bad input"
8a65ea986755 Tests for b5605d88dc27 and 840e2b315c1f (interactive prompts during merge)
Thomas Arendsen Hein <thomas@intevation.de>
parents:
diff changeset
    53
hg co -C
8a65ea986755 Tests for b5605d88dc27 and 840e2b315c1f (interactive prompts during merge)
Thomas Arendsen Hein <thomas@intevation.de>
parents:
diff changeset
    54
hg merge --config ui.interactive=true <<EOF || echo "failed"
8a65ea986755 Tests for b5605d88dc27 and 840e2b315c1f (interactive prompts during merge)
Thomas Arendsen Hein <thomas@intevation.de>
parents:
diff changeset
    55
foo
8a65ea986755 Tests for b5605d88dc27 and 840e2b315c1f (interactive prompts during merge)
Thomas Arendsen Hein <thomas@intevation.de>
parents:
diff changeset
    56
bar
8a65ea986755 Tests for b5605d88dc27 and 840e2b315c1f (interactive prompts during merge)
Thomas Arendsen Hein <thomas@intevation.de>
parents:
diff changeset
    57
d
8a65ea986755 Tests for b5605d88dc27 and 840e2b315c1f (interactive prompts during merge)
Thomas Arendsen Hein <thomas@intevation.de>
parents:
diff changeset
    58
baz
8a65ea986755 Tests for b5605d88dc27 and 840e2b315c1f (interactive prompts during merge)
Thomas Arendsen Hein <thomas@intevation.de>
parents:
diff changeset
    59
c
8a65ea986755 Tests for b5605d88dc27 and 840e2b315c1f (interactive prompts during merge)
Thomas Arendsen Hein <thomas@intevation.de>
parents:
diff changeset
    60
EOF
8a65ea986755 Tests for b5605d88dc27 and 840e2b315c1f (interactive prompts during merge)
Thomas Arendsen Hein <thomas@intevation.de>
parents:
diff changeset
    61
status
8a65ea986755 Tests for b5605d88dc27 and 840e2b315c1f (interactive prompts during merge)
Thomas Arendsen Hein <thomas@intevation.de>
parents:
diff changeset
    62
8a65ea986755 Tests for b5605d88dc27 and 840e2b315c1f (interactive prompts during merge)
Thomas Arendsen Hein <thomas@intevation.de>
parents:
diff changeset
    63
echo
8a65ea986755 Tests for b5605d88dc27 and 840e2b315c1f (interactive prompts during merge)
Thomas Arendsen Hein <thomas@intevation.de>
parents:
diff changeset
    64
echo "# interactive merge with not enough input"
8a65ea986755 Tests for b5605d88dc27 and 840e2b315c1f (interactive prompts during merge)
Thomas Arendsen Hein <thomas@intevation.de>
parents:
diff changeset
    65
hg co -C
8a65ea986755 Tests for b5605d88dc27 and 840e2b315c1f (interactive prompts during merge)
Thomas Arendsen Hein <thomas@intevation.de>
parents:
diff changeset
    66
hg merge --config ui.interactive=true <<EOF || echo "failed"
8a65ea986755 Tests for b5605d88dc27 and 840e2b315c1f (interactive prompts during merge)
Thomas Arendsen Hein <thomas@intevation.de>
parents:
diff changeset
    67
d
8a65ea986755 Tests for b5605d88dc27 and 840e2b315c1f (interactive prompts during merge)
Thomas Arendsen Hein <thomas@intevation.de>
parents:
diff changeset
    68
EOF
8a65ea986755 Tests for b5605d88dc27 and 840e2b315c1f (interactive prompts during merge)
Thomas Arendsen Hein <thomas@intevation.de>
parents:
diff changeset
    69
status