tests/test-rebase-check-restore
author Nicolas Dumazet <nicdumz.commits@gmail.com>
Sat, 03 Jul 2010 18:11:15 +0900
changeset 11608 183e63112698
parent 11208 2313dc4d9817
permissions -rwxr-xr-x
log: remove increasing windows usage in fastpath The purpose of increasing windows is to allow backwards iteration on the filelog at a reasonable cost. But is it needed? - if follow is False, we have no reason to iterate backwards. We basically just want to walk the complete filelog and yield all revisions within the revision range. We can do this forward or backwards, as it only reads the index. - when follow is True, we need to examine the contents of the filelog, and to do this efficiently we need to read the filelog forward. And on the other hand, to track ancestors and copies, we need to process revisions backwards. But is it necessary to use increasing windows for this? We can iterate over the complete filelog forward, stack the revisions, and read the reversed(pile), it does the same thing with a more readable code.
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