tests/test-rebase-check-restore
author Matt Mackall <mpm@selenic.com>
Fri, 13 Aug 2010 13:20:15 -0500
changeset 11903 a4cc9e6f41c3
parent 11208 2313dc4d9817
permissions -rwxr-xr-x
test-walk: enable absolute path tests
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
7952
b214066b7e1d rebase: store/restore arguments correctly
Stefano Tortarolo <stefano.tortarolo@gmail.com>
parents:
diff changeset
     1
#!/bin/sh
b214066b7e1d rebase: store/restore arguments correctly
Stefano Tortarolo <stefano.tortarolo@gmail.com>
parents:
diff changeset
     2
11208
2313dc4d9817 tests: fix bashism to load helpers.sh
Yuya Nishihara <yuya@tcha.org>
parents: 11198
diff changeset
     3
. $TESTDIR/helpers.sh
11198
b345b1cc124f rebase: use helpers.sh in tests
Matt Mackall <mpm@selenic.com>
parents: 8168
diff changeset
     4
7952
b214066b7e1d rebase: store/restore arguments correctly
Stefano Tortarolo <stefano.tortarolo@gmail.com>
parents:
diff changeset
     5
echo "[extensions]" >> $HGRCPATH
b214066b7e1d rebase: store/restore arguments correctly
Stefano Tortarolo <stefano.tortarolo@gmail.com>
parents:
diff changeset
     6
echo "graphlog=" >> $HGRCPATH
b214066b7e1d rebase: store/restore arguments correctly
Stefano Tortarolo <stefano.tortarolo@gmail.com>
parents:
diff changeset
     7
echo "rebase=" >> $HGRCPATH
b214066b7e1d rebase: store/restore arguments correctly
Stefano Tortarolo <stefano.tortarolo@gmail.com>
parents:
diff changeset
     8
b214066b7e1d rebase: store/restore arguments correctly
Stefano Tortarolo <stefano.tortarolo@gmail.com>
parents:
diff changeset
     9
BASE=`pwd`
b214066b7e1d rebase: store/restore arguments correctly
Stefano Tortarolo <stefano.tortarolo@gmail.com>
parents:
diff changeset
    10
b214066b7e1d rebase: store/restore arguments correctly
Stefano Tortarolo <stefano.tortarolo@gmail.com>
parents:
diff changeset
    11
addcommit () {
b214066b7e1d rebase: store/restore arguments correctly
Stefano Tortarolo <stefano.tortarolo@gmail.com>
parents:
diff changeset
    12
    echo $1 > $1
b214066b7e1d rebase: store/restore arguments correctly
Stefano Tortarolo <stefano.tortarolo@gmail.com>
parents:
diff changeset
    13
    hg add $1
8168
8766fee6f225 tests: removed redundant "-u test" from test scripts
Martin Geisler <mg@lazybytes.net>
parents: 7952
diff changeset
    14
    hg commit -d "${2} 0" -m $1
7952
b214066b7e1d rebase: store/restore arguments correctly
Stefano Tortarolo <stefano.tortarolo@gmail.com>
parents:
diff changeset
    15
}
b214066b7e1d rebase: store/restore arguments correctly
Stefano Tortarolo <stefano.tortarolo@gmail.com>
parents:
diff changeset
    16
b214066b7e1d rebase: store/restore arguments correctly
Stefano Tortarolo <stefano.tortarolo@gmail.com>
parents:
diff changeset
    17
commit () {
8168
8766fee6f225 tests: removed redundant "-u test" from test scripts
Martin Geisler <mg@lazybytes.net>
parents: 7952
diff changeset
    18
    hg commit -d "${2} 0" -m $1
7952
b214066b7e1d rebase: store/restore arguments correctly
Stefano Tortarolo <stefano.tortarolo@gmail.com>
parents:
diff changeset
    19
}
b214066b7e1d rebase: store/restore arguments correctly
Stefano Tortarolo <stefano.tortarolo@gmail.com>
parents:
diff changeset
    20
b214066b7e1d rebase: store/restore arguments correctly
Stefano Tortarolo <stefano.tortarolo@gmail.com>
parents:
diff changeset
    21
createrepo () {
b214066b7e1d rebase: store/restore arguments correctly
Stefano Tortarolo <stefano.tortarolo@gmail.com>
parents:
diff changeset
    22
    cd $BASE
b214066b7e1d rebase: store/restore arguments correctly
Stefano Tortarolo <stefano.tortarolo@gmail.com>
parents:
diff changeset
    23
    rm -rf a
b214066b7e1d rebase: store/restore arguments correctly
Stefano Tortarolo <stefano.tortarolo@gmail.com>
parents:
diff changeset
    24
    hg init a
b214066b7e1d rebase: store/restore arguments correctly
Stefano Tortarolo <stefano.tortarolo@gmail.com>
parents:
diff changeset
    25
    cd a
b214066b7e1d rebase: store/restore arguments correctly
Stefano Tortarolo <stefano.tortarolo@gmail.com>
parents:
diff changeset
    26
    addcommit "A" 0
b214066b7e1d rebase: store/restore arguments correctly
Stefano Tortarolo <stefano.tortarolo@gmail.com>
parents:
diff changeset
    27
    addcommit "B" 1
b214066b7e1d rebase: store/restore arguments correctly
Stefano Tortarolo <stefano.tortarolo@gmail.com>
parents:
diff changeset
    28
    echo "C" >> A
b214066b7e1d rebase: store/restore arguments correctly
Stefano Tortarolo <stefano.tortarolo@gmail.com>
parents:
diff changeset
    29
    commit "C" 2
b214066b7e1d rebase: store/restore arguments correctly
Stefano Tortarolo <stefano.tortarolo@gmail.com>
parents:
diff changeset
    30
b214066b7e1d rebase: store/restore arguments correctly
Stefano Tortarolo <stefano.tortarolo@gmail.com>
parents:
diff changeset
    31
    hg update -C 0
b214066b7e1d rebase: store/restore arguments correctly
Stefano Tortarolo <stefano.tortarolo@gmail.com>
parents:
diff changeset
    32
    echo "D" >> A
b214066b7e1d rebase: store/restore arguments correctly
Stefano Tortarolo <stefano.tortarolo@gmail.com>
parents:
diff changeset
    33
    commit "D" 3
b214066b7e1d rebase: store/restore arguments correctly
Stefano Tortarolo <stefano.tortarolo@gmail.com>
parents:
diff changeset
    34
    addcommit "E" 4
b214066b7e1d rebase: store/restore arguments correctly
Stefano Tortarolo <stefano.tortarolo@gmail.com>
parents:
diff changeset
    35
b214066b7e1d rebase: store/restore arguments correctly
Stefano Tortarolo <stefano.tortarolo@gmail.com>
parents:
diff changeset
    36
    hg update -C 0
b214066b7e1d rebase: store/restore arguments correctly
Stefano Tortarolo <stefano.tortarolo@gmail.com>
parents:
diff changeset
    37
    hg branch 'notdefault'
b214066b7e1d rebase: store/restore arguments correctly
Stefano Tortarolo <stefano.tortarolo@gmail.com>
parents:
diff changeset
    38
    echo "F" >> A
b214066b7e1d rebase: store/restore arguments correctly
Stefano Tortarolo <stefano.tortarolo@gmail.com>
parents:
diff changeset
    39
    commit "F" 5
b214066b7e1d rebase: store/restore arguments correctly
Stefano Tortarolo <stefano.tortarolo@gmail.com>
parents:
diff changeset
    40
}
b214066b7e1d rebase: store/restore arguments correctly
Stefano Tortarolo <stefano.tortarolo@gmail.com>
parents:
diff changeset
    41
b214066b7e1d rebase: store/restore arguments correctly
Stefano Tortarolo <stefano.tortarolo@gmail.com>
parents:
diff changeset
    42
echo
b214066b7e1d rebase: store/restore arguments correctly
Stefano Tortarolo <stefano.tortarolo@gmail.com>
parents:
diff changeset
    43
echo "% - Rebasing B onto E - check keep"
b214066b7e1d rebase: store/restore arguments correctly
Stefano Tortarolo <stefano.tortarolo@gmail.com>
parents:
diff changeset
    44
createrepo > /dev/null 2>&1
b214066b7e1d rebase: store/restore arguments correctly
Stefano Tortarolo <stefano.tortarolo@gmail.com>
parents:
diff changeset
    45
hg glog  --template '{rev}:{desc}:{branches}\n'
11198
b345b1cc124f rebase: use helpers.sh in tests
Matt Mackall <mpm@selenic.com>
parents: 8168
diff changeset
    46
hg rebase -s 1 -d 4 --keep | hidebackup
7952
b214066b7e1d rebase: store/restore arguments correctly
Stefano Tortarolo <stefano.tortarolo@gmail.com>
parents:
diff changeset
    47
b214066b7e1d rebase: store/restore arguments correctly
Stefano Tortarolo <stefano.tortarolo@gmail.com>
parents:
diff changeset
    48
echo
b214066b7e1d rebase: store/restore arguments correctly
Stefano Tortarolo <stefano.tortarolo@gmail.com>
parents:
diff changeset
    49
echo "% - Solve the conflict and go on"
b214066b7e1d rebase: store/restore arguments correctly
Stefano Tortarolo <stefano.tortarolo@gmail.com>
parents:
diff changeset
    50
echo 'conflict solved' > A
b214066b7e1d rebase: store/restore arguments correctly
Stefano Tortarolo <stefano.tortarolo@gmail.com>
parents:
diff changeset
    51
rm A.orig
b214066b7e1d rebase: store/restore arguments correctly
Stefano Tortarolo <stefano.tortarolo@gmail.com>
parents:
diff changeset
    52
hg resolve -m A
11198
b345b1cc124f rebase: use helpers.sh in tests
Matt Mackall <mpm@selenic.com>
parents: 8168
diff changeset
    53
hg rebase --continue | hidebackup
7952
b214066b7e1d rebase: store/restore arguments correctly
Stefano Tortarolo <stefano.tortarolo@gmail.com>
parents:
diff changeset
    54
hg glog  --template '{rev}:{desc}:{branches}\n'
b214066b7e1d rebase: store/restore arguments correctly
Stefano Tortarolo <stefano.tortarolo@gmail.com>
parents:
diff changeset
    55
b214066b7e1d rebase: store/restore arguments correctly
Stefano Tortarolo <stefano.tortarolo@gmail.com>
parents:
diff changeset
    56
echo
b214066b7e1d rebase: store/restore arguments correctly
Stefano Tortarolo <stefano.tortarolo@gmail.com>
parents:
diff changeset
    57
echo "% - Rebase F onto E - check keepbranches"
b214066b7e1d rebase: store/restore arguments correctly
Stefano Tortarolo <stefano.tortarolo@gmail.com>
parents:
diff changeset
    58
createrepo > /dev/null 2>&1
b214066b7e1d rebase: store/restore arguments correctly
Stefano Tortarolo <stefano.tortarolo@gmail.com>
parents:
diff changeset
    59
hg glog  --template '{rev}:{desc}:{branches}\n'
11198
b345b1cc124f rebase: use helpers.sh in tests
Matt Mackall <mpm@selenic.com>
parents: 8168
diff changeset
    60
hg rebase -s 5 -d 4 --keepbranches | hidebackup
7952
b214066b7e1d rebase: store/restore arguments correctly
Stefano Tortarolo <stefano.tortarolo@gmail.com>
parents:
diff changeset
    61
b214066b7e1d rebase: store/restore arguments correctly
Stefano Tortarolo <stefano.tortarolo@gmail.com>
parents:
diff changeset
    62
echo
b214066b7e1d rebase: store/restore arguments correctly
Stefano Tortarolo <stefano.tortarolo@gmail.com>
parents:
diff changeset
    63
echo "% - Solve the conflict and go on"
b214066b7e1d rebase: store/restore arguments correctly
Stefano Tortarolo <stefano.tortarolo@gmail.com>
parents:
diff changeset
    64
echo 'conflict solved' > A
b214066b7e1d rebase: store/restore arguments correctly
Stefano Tortarolo <stefano.tortarolo@gmail.com>
parents:
diff changeset
    65
rm A.orig
b214066b7e1d rebase: store/restore arguments correctly
Stefano Tortarolo <stefano.tortarolo@gmail.com>
parents:
diff changeset
    66
hg resolve -m A
11198
b345b1cc124f rebase: use helpers.sh in tests
Matt Mackall <mpm@selenic.com>
parents: 8168
diff changeset
    67
hg rebase --continue 2>&1 | hidebackup
7952
b214066b7e1d rebase: store/restore arguments correctly
Stefano Tortarolo <stefano.tortarolo@gmail.com>
parents:
diff changeset
    68
hg glog  --template '{rev}:{desc}:{branches}\n'
b214066b7e1d rebase: store/restore arguments correctly
Stefano Tortarolo <stefano.tortarolo@gmail.com>
parents:
diff changeset
    69
b214066b7e1d rebase: store/restore arguments correctly
Stefano Tortarolo <stefano.tortarolo@gmail.com>
parents:
diff changeset
    70
exit 0