tests/test-rebase-detach
author Peter Arrenbrecht <peter.arrenbrecht@gmail.com>
Thu, 08 Apr 2010 17:21:42 +0200
changeset 10877 dc097666de01
parent 10352 66d954e76ffb
child 11198 b345b1cc124f
permissions -rwxr-xr-x
localrepo: refactor prepush logic Simplifies the prepush check logic and makes it a lot more direct and comprehensible. Instead of comparing the total local vs. remote head count, it compares the number of new vs. removed heads.
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
10352
66d954e76ffb rebase: add --detach option to detach intermediate revisions (issue1950)
Stefano Tortarolo <stefano.tortarolo@gmail.com>
parents:
diff changeset
     1
#!/bin/sh
66d954e76ffb rebase: add --detach option to detach intermediate revisions (issue1950)
Stefano Tortarolo <stefano.tortarolo@gmail.com>
parents:
diff changeset
     2
66d954e76ffb rebase: add --detach option to detach intermediate revisions (issue1950)
Stefano Tortarolo <stefano.tortarolo@gmail.com>
parents:
diff changeset
     3
echo "[extensions]" >> $HGRCPATH
66d954e76ffb rebase: add --detach option to detach intermediate revisions (issue1950)
Stefano Tortarolo <stefano.tortarolo@gmail.com>
parents:
diff changeset
     4
echo "graphlog=" >> $HGRCPATH
66d954e76ffb rebase: add --detach option to detach intermediate revisions (issue1950)
Stefano Tortarolo <stefano.tortarolo@gmail.com>
parents:
diff changeset
     5
echo "rebase=" >> $HGRCPATH
66d954e76ffb rebase: add --detach option to detach intermediate revisions (issue1950)
Stefano Tortarolo <stefano.tortarolo@gmail.com>
parents:
diff changeset
     6
66d954e76ffb rebase: add --detach option to detach intermediate revisions (issue1950)
Stefano Tortarolo <stefano.tortarolo@gmail.com>
parents:
diff changeset
     7
BASE=`pwd`
66d954e76ffb rebase: add --detach option to detach intermediate revisions (issue1950)
Stefano Tortarolo <stefano.tortarolo@gmail.com>
parents:
diff changeset
     8
66d954e76ffb rebase: add --detach option to detach intermediate revisions (issue1950)
Stefano Tortarolo <stefano.tortarolo@gmail.com>
parents:
diff changeset
     9
addcommit () {
66d954e76ffb rebase: add --detach option to detach intermediate revisions (issue1950)
Stefano Tortarolo <stefano.tortarolo@gmail.com>
parents:
diff changeset
    10
    echo $1 > $1
66d954e76ffb rebase: add --detach option to detach intermediate revisions (issue1950)
Stefano Tortarolo <stefano.tortarolo@gmail.com>
parents:
diff changeset
    11
    hg add $1
66d954e76ffb rebase: add --detach option to detach intermediate revisions (issue1950)
Stefano Tortarolo <stefano.tortarolo@gmail.com>
parents:
diff changeset
    12
    hg commit -d "${2} 0" -m $1
66d954e76ffb rebase: add --detach option to detach intermediate revisions (issue1950)
Stefano Tortarolo <stefano.tortarolo@gmail.com>
parents:
diff changeset
    13
}
66d954e76ffb rebase: add --detach option to detach intermediate revisions (issue1950)
Stefano Tortarolo <stefano.tortarolo@gmail.com>
parents:
diff changeset
    14
66d954e76ffb rebase: add --detach option to detach intermediate revisions (issue1950)
Stefano Tortarolo <stefano.tortarolo@gmail.com>
parents:
diff changeset
    15
commit () {
66d954e76ffb rebase: add --detach option to detach intermediate revisions (issue1950)
Stefano Tortarolo <stefano.tortarolo@gmail.com>
parents:
diff changeset
    16
    hg commit -d "${2} 0" -m $1
66d954e76ffb rebase: add --detach option to detach intermediate revisions (issue1950)
Stefano Tortarolo <stefano.tortarolo@gmail.com>
parents:
diff changeset
    17
}
66d954e76ffb rebase: add --detach option to detach intermediate revisions (issue1950)
Stefano Tortarolo <stefano.tortarolo@gmail.com>
parents:
diff changeset
    18
66d954e76ffb rebase: add --detach option to detach intermediate revisions (issue1950)
Stefano Tortarolo <stefano.tortarolo@gmail.com>
parents:
diff changeset
    19
createrepo () {
66d954e76ffb rebase: add --detach option to detach intermediate revisions (issue1950)
Stefano Tortarolo <stefano.tortarolo@gmail.com>
parents:
diff changeset
    20
    cd $BASE
66d954e76ffb rebase: add --detach option to detach intermediate revisions (issue1950)
Stefano Tortarolo <stefano.tortarolo@gmail.com>
parents:
diff changeset
    21
    rm -rf a
66d954e76ffb rebase: add --detach option to detach intermediate revisions (issue1950)
Stefano Tortarolo <stefano.tortarolo@gmail.com>
parents:
diff changeset
    22
    hg init a
66d954e76ffb rebase: add --detach option to detach intermediate revisions (issue1950)
Stefano Tortarolo <stefano.tortarolo@gmail.com>
parents:
diff changeset
    23
    cd a
66d954e76ffb rebase: add --detach option to detach intermediate revisions (issue1950)
Stefano Tortarolo <stefano.tortarolo@gmail.com>
parents:
diff changeset
    24
    addcommit "A" 0
66d954e76ffb rebase: add --detach option to detach intermediate revisions (issue1950)
Stefano Tortarolo <stefano.tortarolo@gmail.com>
parents:
diff changeset
    25
    addcommit "B" 1
66d954e76ffb rebase: add --detach option to detach intermediate revisions (issue1950)
Stefano Tortarolo <stefano.tortarolo@gmail.com>
parents:
diff changeset
    26
    addcommit "C" 2
66d954e76ffb rebase: add --detach option to detach intermediate revisions (issue1950)
Stefano Tortarolo <stefano.tortarolo@gmail.com>
parents:
diff changeset
    27
    addcommit "D" 3
66d954e76ffb rebase: add --detach option to detach intermediate revisions (issue1950)
Stefano Tortarolo <stefano.tortarolo@gmail.com>
parents:
diff changeset
    28
66d954e76ffb rebase: add --detach option to detach intermediate revisions (issue1950)
Stefano Tortarolo <stefano.tortarolo@gmail.com>
parents:
diff changeset
    29
    hg update -C 0
66d954e76ffb rebase: add --detach option to detach intermediate revisions (issue1950)
Stefano Tortarolo <stefano.tortarolo@gmail.com>
parents:
diff changeset
    30
    addcommit "E" 4
66d954e76ffb rebase: add --detach option to detach intermediate revisions (issue1950)
Stefano Tortarolo <stefano.tortarolo@gmail.com>
parents:
diff changeset
    31
}
66d954e76ffb rebase: add --detach option to detach intermediate revisions (issue1950)
Stefano Tortarolo <stefano.tortarolo@gmail.com>
parents:
diff changeset
    32
66d954e76ffb rebase: add --detach option to detach intermediate revisions (issue1950)
Stefano Tortarolo <stefano.tortarolo@gmail.com>
parents:
diff changeset
    33
createrepo > /dev/null 2>&1
66d954e76ffb rebase: add --detach option to detach intermediate revisions (issue1950)
Stefano Tortarolo <stefano.tortarolo@gmail.com>
parents:
diff changeset
    34
hg glog  --template '{rev}: {desc}\n'
66d954e76ffb rebase: add --detach option to detach intermediate revisions (issue1950)
Stefano Tortarolo <stefano.tortarolo@gmail.com>
parents:
diff changeset
    35
echo '% Rebasing D onto E detaching from C'
66d954e76ffb rebase: add --detach option to detach intermediate revisions (issue1950)
Stefano Tortarolo <stefano.tortarolo@gmail.com>
parents:
diff changeset
    36
hg rebase --detach -s 3 -d 4 2>&1 | sed 's/\(saving bundle to \).*/\1/'
66d954e76ffb rebase: add --detach option to detach intermediate revisions (issue1950)
Stefano Tortarolo <stefano.tortarolo@gmail.com>
parents:
diff changeset
    37
hg glog  --template '{rev}: {desc}\n'
66d954e76ffb rebase: add --detach option to detach intermediate revisions (issue1950)
Stefano Tortarolo <stefano.tortarolo@gmail.com>
parents:
diff changeset
    38
echo "Expected A, D, E"
66d954e76ffb rebase: add --detach option to detach intermediate revisions (issue1950)
Stefano Tortarolo <stefano.tortarolo@gmail.com>
parents:
diff changeset
    39
hg manifest
66d954e76ffb rebase: add --detach option to detach intermediate revisions (issue1950)
Stefano Tortarolo <stefano.tortarolo@gmail.com>
parents:
diff changeset
    40
66d954e76ffb rebase: add --detach option to detach intermediate revisions (issue1950)
Stefano Tortarolo <stefano.tortarolo@gmail.com>
parents:
diff changeset
    41
echo
66d954e76ffb rebase: add --detach option to detach intermediate revisions (issue1950)
Stefano Tortarolo <stefano.tortarolo@gmail.com>
parents:
diff changeset
    42
createrepo > /dev/null 2>&1
66d954e76ffb rebase: add --detach option to detach intermediate revisions (issue1950)
Stefano Tortarolo <stefano.tortarolo@gmail.com>
parents:
diff changeset
    43
hg glog  --template '{rev}: {desc}\n'
66d954e76ffb rebase: add --detach option to detach intermediate revisions (issue1950)
Stefano Tortarolo <stefano.tortarolo@gmail.com>
parents:
diff changeset
    44
echo '% Rebasing C onto E detaching from B'
66d954e76ffb rebase: add --detach option to detach intermediate revisions (issue1950)
Stefano Tortarolo <stefano.tortarolo@gmail.com>
parents:
diff changeset
    45
hg rebase --detach -s 2 -d 4 2>&1 | sed 's/\(saving bundle to \).*/\1/'
66d954e76ffb rebase: add --detach option to detach intermediate revisions (issue1950)
Stefano Tortarolo <stefano.tortarolo@gmail.com>
parents:
diff changeset
    46
hg glog  --template '{rev}: {desc}\n'
66d954e76ffb rebase: add --detach option to detach intermediate revisions (issue1950)
Stefano Tortarolo <stefano.tortarolo@gmail.com>
parents:
diff changeset
    47
echo "Expected A, C, D, E"
66d954e76ffb rebase: add --detach option to detach intermediate revisions (issue1950)
Stefano Tortarolo <stefano.tortarolo@gmail.com>
parents:
diff changeset
    48
hg manifest
66d954e76ffb rebase: add --detach option to detach intermediate revisions (issue1950)
Stefano Tortarolo <stefano.tortarolo@gmail.com>
parents:
diff changeset
    49
66d954e76ffb rebase: add --detach option to detach intermediate revisions (issue1950)
Stefano Tortarolo <stefano.tortarolo@gmail.com>
parents:
diff changeset
    50
echo
66d954e76ffb rebase: add --detach option to detach intermediate revisions (issue1950)
Stefano Tortarolo <stefano.tortarolo@gmail.com>
parents:
diff changeset
    51
createrepo > /dev/null 2>&1
66d954e76ffb rebase: add --detach option to detach intermediate revisions (issue1950)
Stefano Tortarolo <stefano.tortarolo@gmail.com>
parents:
diff changeset
    52
hg glog  --template '{rev}: {desc}\n'
66d954e76ffb rebase: add --detach option to detach intermediate revisions (issue1950)
Stefano Tortarolo <stefano.tortarolo@gmail.com>
parents:
diff changeset
    53
echo '% Rebasing B onto E using detach (same as not using it)'
66d954e76ffb rebase: add --detach option to detach intermediate revisions (issue1950)
Stefano Tortarolo <stefano.tortarolo@gmail.com>
parents:
diff changeset
    54
hg rebase --detach -s 1 -d 4 2>&1 | sed 's/\(saving bundle to \).*/\1/'
66d954e76ffb rebase: add --detach option to detach intermediate revisions (issue1950)
Stefano Tortarolo <stefano.tortarolo@gmail.com>
parents:
diff changeset
    55
hg glog  --template '{rev}: {desc}\n'
66d954e76ffb rebase: add --detach option to detach intermediate revisions (issue1950)
Stefano Tortarolo <stefano.tortarolo@gmail.com>
parents:
diff changeset
    56
echo "Expected A, B, C, D, E"
66d954e76ffb rebase: add --detach option to detach intermediate revisions (issue1950)
Stefano Tortarolo <stefano.tortarolo@gmail.com>
parents:
diff changeset
    57
hg manifest
66d954e76ffb rebase: add --detach option to detach intermediate revisions (issue1950)
Stefano Tortarolo <stefano.tortarolo@gmail.com>
parents:
diff changeset
    58
66d954e76ffb rebase: add --detach option to detach intermediate revisions (issue1950)
Stefano Tortarolo <stefano.tortarolo@gmail.com>
parents:
diff changeset
    59
echo
66d954e76ffb rebase: add --detach option to detach intermediate revisions (issue1950)
Stefano Tortarolo <stefano.tortarolo@gmail.com>
parents:
diff changeset
    60
createrepo > /dev/null 2>&1
66d954e76ffb rebase: add --detach option to detach intermediate revisions (issue1950)
Stefano Tortarolo <stefano.tortarolo@gmail.com>
parents:
diff changeset
    61
hg glog  --template '{rev}: {desc}\n'
66d954e76ffb rebase: add --detach option to detach intermediate revisions (issue1950)
Stefano Tortarolo <stefano.tortarolo@gmail.com>
parents:
diff changeset
    62
echo '% Rebasing C onto E detaching from B and collapsing'
66d954e76ffb rebase: add --detach option to detach intermediate revisions (issue1950)
Stefano Tortarolo <stefano.tortarolo@gmail.com>
parents:
diff changeset
    63
hg rebase --detach --collapse -s 2 -d 4 2>&1 | sed 's/\(saving bundle to \).*/\1/'
66d954e76ffb rebase: add --detach option to detach intermediate revisions (issue1950)
Stefano Tortarolo <stefano.tortarolo@gmail.com>
parents:
diff changeset
    64
hg glog  --template '{rev}: {desc}\n'
66d954e76ffb rebase: add --detach option to detach intermediate revisions (issue1950)
Stefano Tortarolo <stefano.tortarolo@gmail.com>
parents:
diff changeset
    65
echo "Expected A, C, D, E"
66d954e76ffb rebase: add --detach option to detach intermediate revisions (issue1950)
Stefano Tortarolo <stefano.tortarolo@gmail.com>
parents:
diff changeset
    66
hg manifest
66d954e76ffb rebase: add --detach option to detach intermediate revisions (issue1950)
Stefano Tortarolo <stefano.tortarolo@gmail.com>
parents:
diff changeset
    67
66d954e76ffb rebase: add --detach option to detach intermediate revisions (issue1950)
Stefano Tortarolo <stefano.tortarolo@gmail.com>
parents:
diff changeset
    68
exit 0