tests/test-transplant
author Matt Mackall <mpm@selenic.com>
Wed, 07 Nov 2007 14:38:04 -0600
changeset 5509 305b035c5fda
parent 5384 e3a0c092b4e2
child 6639 6334569c8caa
permissions -rwxr-xr-x
Mark failing test as a known bug
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
3714
198173f3957c Add transplant extension
Brendan Cully <brendan@kublai.com>
parents:
diff changeset
     1
#!/bin/sh
198173f3957c Add transplant extension
Brendan Cully <brendan@kublai.com>
parents:
diff changeset
     2
198173f3957c Add transplant extension
Brendan Cully <brendan@kublai.com>
parents:
diff changeset
     3
cat <<EOF >> $HGRCPATH
198173f3957c Add transplant extension
Brendan Cully <brendan@kublai.com>
parents:
diff changeset
     4
[extensions]
198173f3957c Add transplant extension
Brendan Cully <brendan@kublai.com>
parents:
diff changeset
     5
transplant=
198173f3957c Add transplant extension
Brendan Cully <brendan@kublai.com>
parents:
diff changeset
     6
EOF
198173f3957c Add transplant extension
Brendan Cully <brendan@kublai.com>
parents:
diff changeset
     7
198173f3957c Add transplant extension
Brendan Cully <brendan@kublai.com>
parents:
diff changeset
     8
hg init t
198173f3957c Add transplant extension
Brendan Cully <brendan@kublai.com>
parents:
diff changeset
     9
cd t
198173f3957c Add transplant extension
Brendan Cully <brendan@kublai.com>
parents:
diff changeset
    10
echo r1 > r1
198173f3957c Add transplant extension
Brendan Cully <brendan@kublai.com>
parents:
diff changeset
    11
hg ci -Amr1 -d'0 0'
198173f3957c Add transplant extension
Brendan Cully <brendan@kublai.com>
parents:
diff changeset
    12
echo r2 > r2
198173f3957c Add transplant extension
Brendan Cully <brendan@kublai.com>
parents:
diff changeset
    13
hg ci -Amr2 -d'1 0'
198173f3957c Add transplant extension
Brendan Cully <brendan@kublai.com>
parents:
diff changeset
    14
hg up 0
198173f3957c Add transplant extension
Brendan Cully <brendan@kublai.com>
parents:
diff changeset
    15
198173f3957c Add transplant extension
Brendan Cully <brendan@kublai.com>
parents:
diff changeset
    16
echo b1 > b1
198173f3957c Add transplant extension
Brendan Cully <brendan@kublai.com>
parents:
diff changeset
    17
hg ci -Amb1 -d '0 0'
198173f3957c Add transplant extension
Brendan Cully <brendan@kublai.com>
parents:
diff changeset
    18
echo b2 > b2
198173f3957c Add transplant extension
Brendan Cully <brendan@kublai.com>
parents:
diff changeset
    19
hg ci -Amb2 -d '1 0'
198173f3957c Add transplant extension
Brendan Cully <brendan@kublai.com>
parents:
diff changeset
    20
echo b3 > b3
198173f3957c Add transplant extension
Brendan Cully <brendan@kublai.com>
parents:
diff changeset
    21
hg ci -Amb3 -d '2 0'
198173f3957c Add transplant extension
Brendan Cully <brendan@kublai.com>
parents:
diff changeset
    22
198173f3957c Add transplant extension
Brendan Cully <brendan@kublai.com>
parents:
diff changeset
    23
hg log --template '{rev} {parents} {desc}\n'
198173f3957c Add transplant extension
Brendan Cully <brendan@kublai.com>
parents:
diff changeset
    24
4034
9bd078ce8de9 Minor test-transplant cleanup
Brendan Cully <brendan@kublai.com>
parents: 3758
diff changeset
    25
hg clone . ../rebase
9bd078ce8de9 Minor test-transplant cleanup
Brendan Cully <brendan@kublai.com>
parents: 3758
diff changeset
    26
cd ../rebase
3714
198173f3957c Add transplant extension
Brendan Cully <brendan@kublai.com>
parents:
diff changeset
    27
198173f3957c Add transplant extension
Brendan Cully <brendan@kublai.com>
parents:
diff changeset
    28
hg up -C 1
198173f3957c Add transplant extension
Brendan Cully <brendan@kublai.com>
parents:
diff changeset
    29
echo '% rebase b onto r1'
198173f3957c Add transplant extension
Brendan Cully <brendan@kublai.com>
parents:
diff changeset
    30
hg transplant -a -b tip
198173f3957c Add transplant extension
Brendan Cully <brendan@kublai.com>
parents:
diff changeset
    31
hg log --template '{rev} {parents} {desc}\n'
198173f3957c Add transplant extension
Brendan Cully <brendan@kublai.com>
parents:
diff changeset
    32
4034
9bd078ce8de9 Minor test-transplant cleanup
Brendan Cully <brendan@kublai.com>
parents: 3758
diff changeset
    33
hg clone ../t ../prune
9bd078ce8de9 Minor test-transplant cleanup
Brendan Cully <brendan@kublai.com>
parents: 3758
diff changeset
    34
cd ../prune
3714
198173f3957c Add transplant extension
Brendan Cully <brendan@kublai.com>
parents:
diff changeset
    35
198173f3957c Add transplant extension
Brendan Cully <brendan@kublai.com>
parents:
diff changeset
    36
hg up -C 1
198173f3957c Add transplant extension
Brendan Cully <brendan@kublai.com>
parents:
diff changeset
    37
echo '% rebase b onto r1, skipping b2'
198173f3957c Add transplant extension
Brendan Cully <brendan@kublai.com>
parents:
diff changeset
    38
hg transplant -a -b tip -p 3
198173f3957c Add transplant extension
Brendan Cully <brendan@kublai.com>
parents:
diff changeset
    39
hg log --template '{rev} {parents} {desc}\n'
198173f3957c Add transplant extension
Brendan Cully <brendan@kublai.com>
parents:
diff changeset
    40
198173f3957c Add transplant extension
Brendan Cully <brendan@kublai.com>
parents:
diff changeset
    41
echo '% remote transplant'
4034
9bd078ce8de9 Minor test-transplant cleanup
Brendan Cully <brendan@kublai.com>
parents: 3758
diff changeset
    42
hg clone -r 1 ../t ../remote
9bd078ce8de9 Minor test-transplant cleanup
Brendan Cully <brendan@kublai.com>
parents: 3758
diff changeset
    43
cd ../remote
3714
198173f3957c Add transplant extension
Brendan Cully <brendan@kublai.com>
parents:
diff changeset
    44
hg transplant --log -s ../t 2 4
198173f3957c Add transplant extension
Brendan Cully <brendan@kublai.com>
parents:
diff changeset
    45
hg log --template '{rev} {parents} {desc}\n'
198173f3957c Add transplant extension
Brendan Cully <brendan@kublai.com>
parents:
diff changeset
    46
198173f3957c Add transplant extension
Brendan Cully <brendan@kublai.com>
parents:
diff changeset
    47
echo '% skip previous transplants'
198173f3957c Add transplant extension
Brendan Cully <brendan@kublai.com>
parents:
diff changeset
    48
hg transplant -s ../t -a -b 4
198173f3957c Add transplant extension
Brendan Cully <brendan@kublai.com>
parents:
diff changeset
    49
hg log --template '{rev} {parents} {desc}\n'
198173f3957c Add transplant extension
Brendan Cully <brendan@kublai.com>
parents:
diff changeset
    50
198173f3957c Add transplant extension
Brendan Cully <brendan@kublai.com>
parents:
diff changeset
    51
echo '% skip local changes transplanted to the source'
198173f3957c Add transplant extension
Brendan Cully <brendan@kublai.com>
parents:
diff changeset
    52
echo b4 > b4
198173f3957c Add transplant extension
Brendan Cully <brendan@kublai.com>
parents:
diff changeset
    53
hg ci -Amb4 -d '3 0'
4034
9bd078ce8de9 Minor test-transplant cleanup
Brendan Cully <brendan@kublai.com>
parents: 3758
diff changeset
    54
hg clone ../t ../pullback
9bd078ce8de9 Minor test-transplant cleanup
Brendan Cully <brendan@kublai.com>
parents: 3758
diff changeset
    55
cd ../pullback
3714
198173f3957c Add transplant extension
Brendan Cully <brendan@kublai.com>
parents:
diff changeset
    56
hg transplant -s ../remote -a -b tip
3724
ea523d6f5f1a transplant: fix --continue; add --continue test
Brendan Cully <brendan@kublai.com>
parents: 3714
diff changeset
    57
4036
ebf1a05f6479 Make test-transplant test pull case
Brendan Cully <brendan@kublai.com>
parents: 4034
diff changeset
    58
echo '% remote transplant with pull'
5384
e3a0c092b4e2 Allow tests to run in parallel.
Bryan O'Sullivan <bos@serpentine.com>
parents: 4050
diff changeset
    59
hg -R ../t serve -p $HGPORT -d --pid-file=../t.pid
4050
75313c36aa04 transplant: test non-local source
Brendan Cully <brendan@kublai.com>
parents: 4036
diff changeset
    60
cat ../t.pid >> $DAEMON_PIDS
75313c36aa04 transplant: test non-local source
Brendan Cully <brendan@kublai.com>
parents: 4036
diff changeset
    61
4036
ebf1a05f6479 Make test-transplant test pull case
Brendan Cully <brendan@kublai.com>
parents: 4034
diff changeset
    62
hg clone -r 0 ../t ../rp
ebf1a05f6479 Make test-transplant test pull case
Brendan Cully <brendan@kublai.com>
parents: 4034
diff changeset
    63
cd ../rp
5384
e3a0c092b4e2 Allow tests to run in parallel.
Bryan O'Sullivan <bos@serpentine.com>
parents: 4050
diff changeset
    64
hg transplant -s http://localhost:$HGPORT/ 2 4
4036
ebf1a05f6479 Make test-transplant test pull case
Brendan Cully <brendan@kublai.com>
parents: 4034
diff changeset
    65
hg log --template '{rev} {parents} {desc}\n'
ebf1a05f6479 Make test-transplant test pull case
Brendan Cully <brendan@kublai.com>
parents: 4034
diff changeset
    66
3724
ea523d6f5f1a transplant: fix --continue; add --continue test
Brendan Cully <brendan@kublai.com>
parents: 3714
diff changeset
    67
echo '% transplant --continue'
ea523d6f5f1a transplant: fix --continue; add --continue test
Brendan Cully <brendan@kublai.com>
parents: 3714
diff changeset
    68
hg init ../tc
ea523d6f5f1a transplant: fix --continue; add --continue test
Brendan Cully <brendan@kublai.com>
parents: 3714
diff changeset
    69
cd ../tc
ea523d6f5f1a transplant: fix --continue; add --continue test
Brendan Cully <brendan@kublai.com>
parents: 3714
diff changeset
    70
cat <<EOF > foo
ea523d6f5f1a transplant: fix --continue; add --continue test
Brendan Cully <brendan@kublai.com>
parents: 3714
diff changeset
    71
foo
ea523d6f5f1a transplant: fix --continue; add --continue test
Brendan Cully <brendan@kublai.com>
parents: 3714
diff changeset
    72
bar
ea523d6f5f1a transplant: fix --continue; add --continue test
Brendan Cully <brendan@kublai.com>
parents: 3714
diff changeset
    73
baz
ea523d6f5f1a transplant: fix --continue; add --continue test
Brendan Cully <brendan@kublai.com>
parents: 3714
diff changeset
    74
EOF
3726
752884db5037 transplant: recover added/removed files after failed application
Brendan Cully <brendan@kublai.com>
parents: 3724
diff changeset
    75
echo toremove > toremove
3724
ea523d6f5f1a transplant: fix --continue; add --continue test
Brendan Cully <brendan@kublai.com>
parents: 3714
diff changeset
    76
hg ci -Amfoo -d '0 0'
ea523d6f5f1a transplant: fix --continue; add --continue test
Brendan Cully <brendan@kublai.com>
parents: 3714
diff changeset
    77
cat <<EOF > foo
ea523d6f5f1a transplant: fix --continue; add --continue test
Brendan Cully <brendan@kublai.com>
parents: 3714
diff changeset
    78
foo2
ea523d6f5f1a transplant: fix --continue; add --continue test
Brendan Cully <brendan@kublai.com>
parents: 3714
diff changeset
    79
bar2
ea523d6f5f1a transplant: fix --continue; add --continue test
Brendan Cully <brendan@kublai.com>
parents: 3714
diff changeset
    80
baz2
ea523d6f5f1a transplant: fix --continue; add --continue test
Brendan Cully <brendan@kublai.com>
parents: 3714
diff changeset
    81
EOF
3726
752884db5037 transplant: recover added/removed files after failed application
Brendan Cully <brendan@kublai.com>
parents: 3724
diff changeset
    82
rm toremove
752884db5037 transplant: recover added/removed files after failed application
Brendan Cully <brendan@kublai.com>
parents: 3724
diff changeset
    83
echo added > added
752884db5037 transplant: recover added/removed files after failed application
Brendan Cully <brendan@kublai.com>
parents: 3724
diff changeset
    84
hg ci -Amfoo2 -d '0 0'
3724
ea523d6f5f1a transplant: fix --continue; add --continue test
Brendan Cully <brendan@kublai.com>
parents: 3714
diff changeset
    85
echo bar > bar
ea523d6f5f1a transplant: fix --continue; add --continue test
Brendan Cully <brendan@kublai.com>
parents: 3714
diff changeset
    86
hg ci -Ambar -d '0 0'
ea523d6f5f1a transplant: fix --continue; add --continue test
Brendan Cully <brendan@kublai.com>
parents: 3714
diff changeset
    87
echo bar2 >> bar
ea523d6f5f1a transplant: fix --continue; add --continue test
Brendan Cully <brendan@kublai.com>
parents: 3714
diff changeset
    88
hg ci -mbar2 -d '0 0'
ea523d6f5f1a transplant: fix --continue; add --continue test
Brendan Cully <brendan@kublai.com>
parents: 3714
diff changeset
    89
hg up 0
ea523d6f5f1a transplant: fix --continue; add --continue test
Brendan Cully <brendan@kublai.com>
parents: 3714
diff changeset
    90
echo foobar > foo
ea523d6f5f1a transplant: fix --continue; add --continue test
Brendan Cully <brendan@kublai.com>
parents: 3714
diff changeset
    91
hg ci -mfoobar -d '0 0'
ea523d6f5f1a transplant: fix --continue; add --continue test
Brendan Cully <brendan@kublai.com>
parents: 3714
diff changeset
    92
hg transplant 1:3
3758
889f7e74a0d9 transplant: log source node when recovering too.
Brendan Cully <brendan@kublai.com>
parents: 3726
diff changeset
    93
# transplant -c shouldn't use an old changeset
889f7e74a0d9 transplant: log source node when recovering too.
Brendan Cully <brendan@kublai.com>
parents: 3726
diff changeset
    94
hg up -C
889f7e74a0d9 transplant: log source node when recovering too.
Brendan Cully <brendan@kublai.com>
parents: 3726
diff changeset
    95
hg transplant 1
3724
ea523d6f5f1a transplant: fix --continue; add --continue test
Brendan Cully <brendan@kublai.com>
parents: 3714
diff changeset
    96
hg transplant --continue
3758
889f7e74a0d9 transplant: log source node when recovering too.
Brendan Cully <brendan@kublai.com>
parents: 3726
diff changeset
    97
hg transplant 1:3
3726
752884db5037 transplant: recover added/removed files after failed application
Brendan Cully <brendan@kublai.com>
parents: 3724
diff changeset
    98
hg locate