tests/test-mq-strip
author Nicolas Dumazet <nicdumz.commits@gmail.com>
Sat, 17 Jul 2010 00:47:06 +0900
changeset 11789 e2bce1c717fa
parent 11637 64f284da1278
permissions -rwxr-xr-x
strip: support multiple revisions
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
8452
cb93eee1fbcd tests: add missing interpreter lines
Martin Geisler <mg@lazybytes.net>
parents: 6635
diff changeset
     1
#!/bin/sh
cb93eee1fbcd tests: add missing interpreter lines
Martin Geisler <mg@lazybytes.net>
parents: 6635
diff changeset
     2
11208
2313dc4d9817 tests: fix bashism to load helpers.sh
Yuya Nishihara <yuya@tcha.org>
parents: 11200
diff changeset
     3
. $TESTDIR/helpers.sh
11200
12e5149cafca strip: improve full backup message
Matt Mackall <mpm@selenic.com>
parents: 8452
diff changeset
     4
6635
d90d83ebea9e mq: don't update the working copy on strip if parents aren't stripped
Dirkjan Ochtman <dirkjan@ochtman.nl>
parents:
diff changeset
     5
echo "[extensions]" >> $HGRCPATH
d90d83ebea9e mq: don't update the working copy on strip if parents aren't stripped
Dirkjan Ochtman <dirkjan@ochtman.nl>
parents:
diff changeset
     6
echo "mq=" >> $HGRCPATH
11789
e2bce1c717fa strip: support multiple revisions
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 11637
diff changeset
     7
echo "graphlog=" >> $HGRCPATH
6635
d90d83ebea9e mq: don't update the working copy on strip if parents aren't stripped
Dirkjan Ochtman <dirkjan@ochtman.nl>
parents:
diff changeset
     8
11789
e2bce1c717fa strip: support multiple revisions
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 11637
diff changeset
     9
restore() {
e2bce1c717fa strip: support multiple revisions
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 11637
diff changeset
    10
    hg unbundle -q .hg/strip-backup/*
e2bce1c717fa strip: support multiple revisions
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 11637
diff changeset
    11
    rm .hg/strip-backup/*
e2bce1c717fa strip: support multiple revisions
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 11637
diff changeset
    12
}
6635
d90d83ebea9e mq: don't update the working copy on strip if parents aren't stripped
Dirkjan Ochtman <dirkjan@ochtman.nl>
parents:
diff changeset
    13
teststrip() {
d90d83ebea9e mq: don't update the working copy on strip if parents aren't stripped
Dirkjan Ochtman <dirkjan@ochtman.nl>
parents:
diff changeset
    14
    hg up -C $1
d90d83ebea9e mq: don't update the working copy on strip if parents aren't stripped
Dirkjan Ochtman <dirkjan@ochtman.nl>
parents:
diff changeset
    15
    echo % before update $1, strip $2
d90d83ebea9e mq: don't update the working copy on strip if parents aren't stripped
Dirkjan Ochtman <dirkjan@ochtman.nl>
parents:
diff changeset
    16
    hg parents
11789
e2bce1c717fa strip: support multiple revisions
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 11637
diff changeset
    17
    hg --traceback strip $2 | hidebackup
6635
d90d83ebea9e mq: don't update the working copy on strip if parents aren't stripped
Dirkjan Ochtman <dirkjan@ochtman.nl>
parents:
diff changeset
    18
    echo % after update $1, strip $2
d90d83ebea9e mq: don't update the working copy on strip if parents aren't stripped
Dirkjan Ochtman <dirkjan@ochtman.nl>
parents:
diff changeset
    19
    hg parents
11789
e2bce1c717fa strip: support multiple revisions
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 11637
diff changeset
    20
    restore
6635
d90d83ebea9e mq: don't update the working copy on strip if parents aren't stripped
Dirkjan Ochtman <dirkjan@ochtman.nl>
parents:
diff changeset
    21
}
d90d83ebea9e mq: don't update the working copy on strip if parents aren't stripped
Dirkjan Ochtman <dirkjan@ochtman.nl>
parents:
diff changeset
    22
d90d83ebea9e mq: don't update the working copy on strip if parents aren't stripped
Dirkjan Ochtman <dirkjan@ochtman.nl>
parents:
diff changeset
    23
hg init test
d90d83ebea9e mq: don't update the working copy on strip if parents aren't stripped
Dirkjan Ochtman <dirkjan@ochtman.nl>
parents:
diff changeset
    24
cd test
d90d83ebea9e mq: don't update the working copy on strip if parents aren't stripped
Dirkjan Ochtman <dirkjan@ochtman.nl>
parents:
diff changeset
    25
d90d83ebea9e mq: don't update the working copy on strip if parents aren't stripped
Dirkjan Ochtman <dirkjan@ochtman.nl>
parents:
diff changeset
    26
echo foo > bar
d90d83ebea9e mq: don't update the working copy on strip if parents aren't stripped
Dirkjan Ochtman <dirkjan@ochtman.nl>
parents:
diff changeset
    27
hg ci -Ama
d90d83ebea9e mq: don't update the working copy on strip if parents aren't stripped
Dirkjan Ochtman <dirkjan@ochtman.nl>
parents:
diff changeset
    28
d90d83ebea9e mq: don't update the working copy on strip if parents aren't stripped
Dirkjan Ochtman <dirkjan@ochtman.nl>
parents:
diff changeset
    29
echo more >> bar
d90d83ebea9e mq: don't update the working copy on strip if parents aren't stripped
Dirkjan Ochtman <dirkjan@ochtman.nl>
parents:
diff changeset
    30
hg ci -Amb
d90d83ebea9e mq: don't update the working copy on strip if parents aren't stripped
Dirkjan Ochtman <dirkjan@ochtman.nl>
parents:
diff changeset
    31
d90d83ebea9e mq: don't update the working copy on strip if parents aren't stripped
Dirkjan Ochtman <dirkjan@ochtman.nl>
parents:
diff changeset
    32
echo blah >> bar
d90d83ebea9e mq: don't update the working copy on strip if parents aren't stripped
Dirkjan Ochtman <dirkjan@ochtman.nl>
parents:
diff changeset
    33
hg ci -Amc
d90d83ebea9e mq: don't update the working copy on strip if parents aren't stripped
Dirkjan Ochtman <dirkjan@ochtman.nl>
parents:
diff changeset
    34
d90d83ebea9e mq: don't update the working copy on strip if parents aren't stripped
Dirkjan Ochtman <dirkjan@ochtman.nl>
parents:
diff changeset
    35
hg up 1
d90d83ebea9e mq: don't update the working copy on strip if parents aren't stripped
Dirkjan Ochtman <dirkjan@ochtman.nl>
parents:
diff changeset
    36
echo blah >> bar
d90d83ebea9e mq: don't update the working copy on strip if parents aren't stripped
Dirkjan Ochtman <dirkjan@ochtman.nl>
parents:
diff changeset
    37
hg ci -Amd
d90d83ebea9e mq: don't update the working copy on strip if parents aren't stripped
Dirkjan Ochtman <dirkjan@ochtman.nl>
parents:
diff changeset
    38
d90d83ebea9e mq: don't update the working copy on strip if parents aren't stripped
Dirkjan Ochtman <dirkjan@ochtman.nl>
parents:
diff changeset
    39
echo final >> bar
d90d83ebea9e mq: don't update the working copy on strip if parents aren't stripped
Dirkjan Ochtman <dirkjan@ochtman.nl>
parents:
diff changeset
    40
hg ci -Ame
d90d83ebea9e mq: don't update the working copy on strip if parents aren't stripped
Dirkjan Ochtman <dirkjan@ochtman.nl>
parents:
diff changeset
    41
d90d83ebea9e mq: don't update the working copy on strip if parents aren't stripped
Dirkjan Ochtman <dirkjan@ochtman.nl>
parents:
diff changeset
    42
hg log
d90d83ebea9e mq: don't update the working copy on strip if parents aren't stripped
Dirkjan Ochtman <dirkjan@ochtman.nl>
parents:
diff changeset
    43
d90d83ebea9e mq: don't update the working copy on strip if parents aren't stripped
Dirkjan Ochtman <dirkjan@ochtman.nl>
parents:
diff changeset
    44
teststrip 4 4
d90d83ebea9e mq: don't update the working copy on strip if parents aren't stripped
Dirkjan Ochtman <dirkjan@ochtman.nl>
parents:
diff changeset
    45
teststrip 4 3
d90d83ebea9e mq: don't update the working copy on strip if parents aren't stripped
Dirkjan Ochtman <dirkjan@ochtman.nl>
parents:
diff changeset
    46
teststrip 1 4
d90d83ebea9e mq: don't update the working copy on strip if parents aren't stripped
Dirkjan Ochtman <dirkjan@ochtman.nl>
parents:
diff changeset
    47
teststrip 4 2
d90d83ebea9e mq: don't update the working copy on strip if parents aren't stripped
Dirkjan Ochtman <dirkjan@ochtman.nl>
parents:
diff changeset
    48
teststrip 4 1
d90d83ebea9e mq: don't update the working copy on strip if parents aren't stripped
Dirkjan Ochtman <dirkjan@ochtman.nl>
parents:
diff changeset
    49
teststrip null 4
d90d83ebea9e mq: don't update the working copy on strip if parents aren't stripped
Dirkjan Ochtman <dirkjan@ochtman.nl>
parents:
diff changeset
    50
d90d83ebea9e mq: don't update the working copy on strip if parents aren't stripped
Dirkjan Ochtman <dirkjan@ochtman.nl>
parents:
diff changeset
    51
hg log
d90d83ebea9e mq: don't update the working copy on strip if parents aren't stripped
Dirkjan Ochtman <dirkjan@ochtman.nl>
parents:
diff changeset
    52
d90d83ebea9e mq: don't update the working copy on strip if parents aren't stripped
Dirkjan Ochtman <dirkjan@ochtman.nl>
parents:
diff changeset
    53
hg up -C 2
d90d83ebea9e mq: don't update the working copy on strip if parents aren't stripped
Dirkjan Ochtman <dirkjan@ochtman.nl>
parents:
diff changeset
    54
hg merge 4
d90d83ebea9e mq: don't update the working copy on strip if parents aren't stripped
Dirkjan Ochtman <dirkjan@ochtman.nl>
parents:
diff changeset
    55
echo % before strip of merge parent
d90d83ebea9e mq: don't update the working copy on strip if parents aren't stripped
Dirkjan Ochtman <dirkjan@ochtman.nl>
parents:
diff changeset
    56
hg parents
11200
12e5149cafca strip: improve full backup message
Matt Mackall <mpm@selenic.com>
parents: 8452
diff changeset
    57
hg strip 4 2>&1 | hidebackup
6635
d90d83ebea9e mq: don't update the working copy on strip if parents aren't stripped
Dirkjan Ochtman <dirkjan@ochtman.nl>
parents:
diff changeset
    58
echo % after strip of merge parent
d90d83ebea9e mq: don't update the working copy on strip if parents aren't stripped
Dirkjan Ochtman <dirkjan@ochtman.nl>
parents:
diff changeset
    59
hg parents
11789
e2bce1c717fa strip: support multiple revisions
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 11637
diff changeset
    60
restore
e2bce1c717fa strip: support multiple revisions
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 11637
diff changeset
    61
e2bce1c717fa strip: support multiple revisions
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 11637
diff changeset
    62
hg up
e2bce1c717fa strip: support multiple revisions
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 11637
diff changeset
    63
hg glog
e2bce1c717fa strip: support multiple revisions
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 11637
diff changeset
    64
echo % 2 is parent of 3, only one strip should happen
e2bce1c717fa strip: support multiple revisions
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 11637
diff changeset
    65
hg strip 2 3 | hidebackup
e2bce1c717fa strip: support multiple revisions
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 11637
diff changeset
    66
hg glog
e2bce1c717fa strip: support multiple revisions
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 11637
diff changeset
    67
restore
e2bce1c717fa strip: support multiple revisions
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 11637
diff changeset
    68
hg glog
e2bce1c717fa strip: support multiple revisions
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 11637
diff changeset
    69
echo % 2 different branches: 2 strips
e2bce1c717fa strip: support multiple revisions
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 11637
diff changeset
    70
hg strip 2 4 | hidebackup
e2bce1c717fa strip: support multiple revisions
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 11637
diff changeset
    71
hg glog
e2bce1c717fa strip: support multiple revisions
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 11637
diff changeset
    72
restore
e2bce1c717fa strip: support multiple revisions
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 11637
diff changeset
    73
echo % 2 different branches and a common ancestor: 1 strip
e2bce1c717fa strip: support multiple revisions
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 11637
diff changeset
    74
hg strip 1 2 4 | hidebackup
e2bce1c717fa strip: support multiple revisions
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 11637
diff changeset
    75
restore
e2bce1c717fa strip: support multiple revisions
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 11637
diff changeset
    76
e2bce1c717fa strip: support multiple revisions
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 11637
diff changeset
    77
# remove branchy history for qimport tests
e2bce1c717fa strip: support multiple revisions
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 11637
diff changeset
    78
hg strip 3 | hidebackup
11637
64f284da1278 mq: cleanup status if applied mq is stripped (issue1881)
Vishakh H <vsh426@gmail.com>
parents: 11208
diff changeset
    79
64f284da1278 mq: cleanup status if applied mq is stripped (issue1881)
Vishakh H <vsh426@gmail.com>
parents: 11208
diff changeset
    80
#strip of applied mq should cleanup status file
64f284da1278 mq: cleanup status if applied mq is stripped (issue1881)
Vishakh H <vsh426@gmail.com>
parents: 11208
diff changeset
    81
hg up -C 3
64f284da1278 mq: cleanup status if applied mq is stripped (issue1881)
Vishakh H <vsh426@gmail.com>
parents: 11208
diff changeset
    82
echo fooagain >> bar
64f284da1278 mq: cleanup status if applied mq is stripped (issue1881)
Vishakh H <vsh426@gmail.com>
parents: 11208
diff changeset
    83
hg ci -mf
64f284da1278 mq: cleanup status if applied mq is stripped (issue1881)
Vishakh H <vsh426@gmail.com>
parents: 11208
diff changeset
    84
hg qimport -r tip:2
64f284da1278 mq: cleanup status if applied mq is stripped (issue1881)
Vishakh H <vsh426@gmail.com>
parents: 11208
diff changeset
    85
echo % applied patches before strip
64f284da1278 mq: cleanup status if applied mq is stripped (issue1881)
Vishakh H <vsh426@gmail.com>
parents: 11208
diff changeset
    86
hg qapplied
64f284da1278 mq: cleanup status if applied mq is stripped (issue1881)
Vishakh H <vsh426@gmail.com>
parents: 11208
diff changeset
    87
echo % stripping revision in queue
64f284da1278 mq: cleanup status if applied mq is stripped (issue1881)
Vishakh H <vsh426@gmail.com>
parents: 11208
diff changeset
    88
hg strip 3 | hidebackup
64f284da1278 mq: cleanup status if applied mq is stripped (issue1881)
Vishakh H <vsh426@gmail.com>
parents: 11208
diff changeset
    89
echo % applied patches after stripping rev in queue
64f284da1278 mq: cleanup status if applied mq is stripped (issue1881)
Vishakh H <vsh426@gmail.com>
parents: 11208
diff changeset
    90
hg qapplied
64f284da1278 mq: cleanup status if applied mq is stripped (issue1881)
Vishakh H <vsh426@gmail.com>
parents: 11208
diff changeset
    91
echo % stripping ancestor of queue
64f284da1278 mq: cleanup status if applied mq is stripped (issue1881)
Vishakh H <vsh426@gmail.com>
parents: 11208
diff changeset
    92
hg strip 1 | hidebackup
64f284da1278 mq: cleanup status if applied mq is stripped (issue1881)
Vishakh H <vsh426@gmail.com>
parents: 11208
diff changeset
    93
echo % applied patches after stripping ancestor of queue
64f284da1278 mq: cleanup status if applied mq is stripped (issue1881)
Vishakh H <vsh426@gmail.com>
parents: 11208
diff changeset
    94
hg qapplied