tests/test-rebase-conflicts
author David Soria Parra <dsp@php.net>
Sun, 07 Dec 2008 08:47:02 +0100
changeset 7485 ecfb683675ed
parent 7278 45495d784ad6
child 8168 8766fee6f225
permissions -rwxr-xr-x
Merge bookmarks
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
6906
808f03f61ebe Add rebase extension
Stefano Tortarolo <stefano.tortarolo@gmail.com>
parents:
diff changeset
     1
#!/bin/sh
808f03f61ebe Add rebase extension
Stefano Tortarolo <stefano.tortarolo@gmail.com>
parents:
diff changeset
     2
808f03f61ebe Add rebase extension
Stefano Tortarolo <stefano.tortarolo@gmail.com>
parents:
diff changeset
     3
echo "[extensions]" >> $HGRCPATH
808f03f61ebe Add rebase extension
Stefano Tortarolo <stefano.tortarolo@gmail.com>
parents:
diff changeset
     4
echo "graphlog=" >> $HGRCPATH
808f03f61ebe Add rebase extension
Stefano Tortarolo <stefano.tortarolo@gmail.com>
parents:
diff changeset
     5
echo "rebase=" >> $HGRCPATH
808f03f61ebe Add rebase extension
Stefano Tortarolo <stefano.tortarolo@gmail.com>
parents:
diff changeset
     6
6910
93609576244e Debashify rebase tests
Brendan Cully <brendan@kublai.com>
parents: 6906
diff changeset
     7
cleanoutput () {
6906
808f03f61ebe Add rebase extension
Stefano Tortarolo <stefano.tortarolo@gmail.com>
parents:
diff changeset
     8
    sed -e 's/\(Rebase status stored to\).*/\1/'  \
808f03f61ebe Add rebase extension
Stefano Tortarolo <stefano.tortarolo@gmail.com>
parents:
diff changeset
     9
        -e 's/\(Rebase status restored from\).*/\1/' \
808f03f61ebe Add rebase extension
Stefano Tortarolo <stefano.tortarolo@gmail.com>
parents:
diff changeset
    10
        -e 's/\(saving bundle to \).*/\1/'
808f03f61ebe Add rebase extension
Stefano Tortarolo <stefano.tortarolo@gmail.com>
parents:
diff changeset
    11
}
808f03f61ebe Add rebase extension
Stefano Tortarolo <stefano.tortarolo@gmail.com>
parents:
diff changeset
    12
808f03f61ebe Add rebase extension
Stefano Tortarolo <stefano.tortarolo@gmail.com>
parents:
diff changeset
    13
hg init a
808f03f61ebe Add rebase extension
Stefano Tortarolo <stefano.tortarolo@gmail.com>
parents:
diff changeset
    14
cd a
808f03f61ebe Add rebase extension
Stefano Tortarolo <stefano.tortarolo@gmail.com>
parents:
diff changeset
    15
echo 'c1' >common
808f03f61ebe Add rebase extension
Stefano Tortarolo <stefano.tortarolo@gmail.com>
parents:
diff changeset
    16
hg add common
808f03f61ebe Add rebase extension
Stefano Tortarolo <stefano.tortarolo@gmail.com>
parents:
diff changeset
    17
hg commit -d '0 0' -u test -m "C1"
808f03f61ebe Add rebase extension
Stefano Tortarolo <stefano.tortarolo@gmail.com>
parents:
diff changeset
    18
808f03f61ebe Add rebase extension
Stefano Tortarolo <stefano.tortarolo@gmail.com>
parents:
diff changeset
    19
echo 'c2' >>common
808f03f61ebe Add rebase extension
Stefano Tortarolo <stefano.tortarolo@gmail.com>
parents:
diff changeset
    20
hg commit -d '1 0' -u test -m "C2"
808f03f61ebe Add rebase extension
Stefano Tortarolo <stefano.tortarolo@gmail.com>
parents:
diff changeset
    21
808f03f61ebe Add rebase extension
Stefano Tortarolo <stefano.tortarolo@gmail.com>
parents:
diff changeset
    22
echo 'c3' >>common
808f03f61ebe Add rebase extension
Stefano Tortarolo <stefano.tortarolo@gmail.com>
parents:
diff changeset
    23
hg commit -d '2 0' -u test -m "C3"
808f03f61ebe Add rebase extension
Stefano Tortarolo <stefano.tortarolo@gmail.com>
parents:
diff changeset
    24
808f03f61ebe Add rebase extension
Stefano Tortarolo <stefano.tortarolo@gmail.com>
parents:
diff changeset
    25
hg update -C 1
808f03f61ebe Add rebase extension
Stefano Tortarolo <stefano.tortarolo@gmail.com>
parents:
diff changeset
    26
echo 'l1' >>extra
808f03f61ebe Add rebase extension
Stefano Tortarolo <stefano.tortarolo@gmail.com>
parents:
diff changeset
    27
hg add extra
808f03f61ebe Add rebase extension
Stefano Tortarolo <stefano.tortarolo@gmail.com>
parents:
diff changeset
    28
hg commit -d '3 0' -u test -m "L1"
808f03f61ebe Add rebase extension
Stefano Tortarolo <stefano.tortarolo@gmail.com>
parents:
diff changeset
    29
808f03f61ebe Add rebase extension
Stefano Tortarolo <stefano.tortarolo@gmail.com>
parents:
diff changeset
    30
sed -e 's/c2/l2/' common > common.new
808f03f61ebe Add rebase extension
Stefano Tortarolo <stefano.tortarolo@gmail.com>
parents:
diff changeset
    31
mv common.new common
808f03f61ebe Add rebase extension
Stefano Tortarolo <stefano.tortarolo@gmail.com>
parents:
diff changeset
    32
hg commit -d '4 0' -u test -m "L2"
808f03f61ebe Add rebase extension
Stefano Tortarolo <stefano.tortarolo@gmail.com>
parents:
diff changeset
    33
7278
45495d784ad6 rebase: avoid redundant merges (issue1301)
Stefano Tortarolo <stefano.tortarolo@gmail.com>
parents: 6910
diff changeset
    34
echo 'l3' >> extra2
45495d784ad6 rebase: avoid redundant merges (issue1301)
Stefano Tortarolo <stefano.tortarolo@gmail.com>
parents: 6910
diff changeset
    35
hg add extra2
45495d784ad6 rebase: avoid redundant merges (issue1301)
Stefano Tortarolo <stefano.tortarolo@gmail.com>
parents: 6910
diff changeset
    36
hg commit -d '5 0' -u test -m "L3"
45495d784ad6 rebase: avoid redundant merges (issue1301)
Stefano Tortarolo <stefano.tortarolo@gmail.com>
parents: 6910
diff changeset
    37
6906
808f03f61ebe Add rebase extension
Stefano Tortarolo <stefano.tortarolo@gmail.com>
parents:
diff changeset
    38
hg glog  --template '{rev}: {desc}\n'
808f03f61ebe Add rebase extension
Stefano Tortarolo <stefano.tortarolo@gmail.com>
parents:
diff changeset
    39
808f03f61ebe Add rebase extension
Stefano Tortarolo <stefano.tortarolo@gmail.com>
parents:
diff changeset
    40
echo
808f03f61ebe Add rebase extension
Stefano Tortarolo <stefano.tortarolo@gmail.com>
parents:
diff changeset
    41
echo '% Try to call --continue'
808f03f61ebe Add rebase extension
Stefano Tortarolo <stefano.tortarolo@gmail.com>
parents:
diff changeset
    42
hg rebase --continue
808f03f61ebe Add rebase extension
Stefano Tortarolo <stefano.tortarolo@gmail.com>
parents:
diff changeset
    43
808f03f61ebe Add rebase extension
Stefano Tortarolo <stefano.tortarolo@gmail.com>
parents:
diff changeset
    44
echo
808f03f61ebe Add rebase extension
Stefano Tortarolo <stefano.tortarolo@gmail.com>
parents:
diff changeset
    45
echo '% Conflicting rebase'
808f03f61ebe Add rebase extension
Stefano Tortarolo <stefano.tortarolo@gmail.com>
parents:
diff changeset
    46
hg rebase -s 3 -d 2
808f03f61ebe Add rebase extension
Stefano Tortarolo <stefano.tortarolo@gmail.com>
parents:
diff changeset
    47
808f03f61ebe Add rebase extension
Stefano Tortarolo <stefano.tortarolo@gmail.com>
parents:
diff changeset
    48
echo
808f03f61ebe Add rebase extension
Stefano Tortarolo <stefano.tortarolo@gmail.com>
parents:
diff changeset
    49
echo '% Try to continue without solving the conflict'
808f03f61ebe Add rebase extension
Stefano Tortarolo <stefano.tortarolo@gmail.com>
parents:
diff changeset
    50
hg rebase --continue 
808f03f61ebe Add rebase extension
Stefano Tortarolo <stefano.tortarolo@gmail.com>
parents:
diff changeset
    51
808f03f61ebe Add rebase extension
Stefano Tortarolo <stefano.tortarolo@gmail.com>
parents:
diff changeset
    52
echo
808f03f61ebe Add rebase extension
Stefano Tortarolo <stefano.tortarolo@gmail.com>
parents:
diff changeset
    53
echo '% Conclude rebase'
7278
45495d784ad6 rebase: avoid redundant merges (issue1301)
Stefano Tortarolo <stefano.tortarolo@gmail.com>
parents: 6910
diff changeset
    54
echo 'resolved merge' >common
6906
808f03f61ebe Add rebase extension
Stefano Tortarolo <stefano.tortarolo@gmail.com>
parents:
diff changeset
    55
hg resolve -m common
808f03f61ebe Add rebase extension
Stefano Tortarolo <stefano.tortarolo@gmail.com>
parents:
diff changeset
    56
hg rebase --continue 2>&1 | cleanoutput
808f03f61ebe Add rebase extension
Stefano Tortarolo <stefano.tortarolo@gmail.com>
parents:
diff changeset
    57
7278
45495d784ad6 rebase: avoid redundant merges (issue1301)
Stefano Tortarolo <stefano.tortarolo@gmail.com>
parents: 6910
diff changeset
    58
hg glog  --template '{rev}: {desc}\n'
6906
808f03f61ebe Add rebase extension
Stefano Tortarolo <stefano.tortarolo@gmail.com>
parents:
diff changeset
    59
7278
45495d784ad6 rebase: avoid redundant merges (issue1301)
Stefano Tortarolo <stefano.tortarolo@gmail.com>
parents: 6910
diff changeset
    60
echo
45495d784ad6 rebase: avoid redundant merges (issue1301)
Stefano Tortarolo <stefano.tortarolo@gmail.com>
parents: 6910
diff changeset
    61
echo '% Check correctness'
45495d784ad6 rebase: avoid redundant merges (issue1301)
Stefano Tortarolo <stefano.tortarolo@gmail.com>
parents: 6910
diff changeset
    62
echo '  - Rev. 0'
45495d784ad6 rebase: avoid redundant merges (issue1301)
Stefano Tortarolo <stefano.tortarolo@gmail.com>
parents: 6910
diff changeset
    63
hg cat -r 0 common
45495d784ad6 rebase: avoid redundant merges (issue1301)
Stefano Tortarolo <stefano.tortarolo@gmail.com>
parents: 6910
diff changeset
    64
45495d784ad6 rebase: avoid redundant merges (issue1301)
Stefano Tortarolo <stefano.tortarolo@gmail.com>
parents: 6910
diff changeset
    65
echo '  - Rev. 1'
45495d784ad6 rebase: avoid redundant merges (issue1301)
Stefano Tortarolo <stefano.tortarolo@gmail.com>
parents: 6910
diff changeset
    66
hg cat -r 1 common
45495d784ad6 rebase: avoid redundant merges (issue1301)
Stefano Tortarolo <stefano.tortarolo@gmail.com>
parents: 6910
diff changeset
    67
45495d784ad6 rebase: avoid redundant merges (issue1301)
Stefano Tortarolo <stefano.tortarolo@gmail.com>
parents: 6910
diff changeset
    68
echo '  - Rev. 2'
45495d784ad6 rebase: avoid redundant merges (issue1301)
Stefano Tortarolo <stefano.tortarolo@gmail.com>
parents: 6910
diff changeset
    69
hg cat -r 2 common
45495d784ad6 rebase: avoid redundant merges (issue1301)
Stefano Tortarolo <stefano.tortarolo@gmail.com>
parents: 6910
diff changeset
    70
45495d784ad6 rebase: avoid redundant merges (issue1301)
Stefano Tortarolo <stefano.tortarolo@gmail.com>
parents: 6910
diff changeset
    71
echo '  - Rev. 3'
45495d784ad6 rebase: avoid redundant merges (issue1301)
Stefano Tortarolo <stefano.tortarolo@gmail.com>
parents: 6910
diff changeset
    72
hg cat -r 3 common
45495d784ad6 rebase: avoid redundant merges (issue1301)
Stefano Tortarolo <stefano.tortarolo@gmail.com>
parents: 6910
diff changeset
    73
45495d784ad6 rebase: avoid redundant merges (issue1301)
Stefano Tortarolo <stefano.tortarolo@gmail.com>
parents: 6910
diff changeset
    74
echo '  - Rev. 4'
45495d784ad6 rebase: avoid redundant merges (issue1301)
Stefano Tortarolo <stefano.tortarolo@gmail.com>
parents: 6910
diff changeset
    75
hg cat -r 4 common
45495d784ad6 rebase: avoid redundant merges (issue1301)
Stefano Tortarolo <stefano.tortarolo@gmail.com>
parents: 6910
diff changeset
    76
45495d784ad6 rebase: avoid redundant merges (issue1301)
Stefano Tortarolo <stefano.tortarolo@gmail.com>
parents: 6910
diff changeset
    77
echo '  - Rev. 5'
45495d784ad6 rebase: avoid redundant merges (issue1301)
Stefano Tortarolo <stefano.tortarolo@gmail.com>
parents: 6910
diff changeset
    78
hg cat -r 5 common