tests/test-transplant
author Alexis S. L. Carvalho <alexis@cecm.usp.br>
Thu, 15 Feb 2007 08:49:20 -0200
changeset 4091 3d7480ada3e5
parent 3758 889f7e74a0d9
child 4034 9bd078ce8de9
permissions -rwxr-xr-x
hgweb/server.py: use hg.repository to create a repo object
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
198173f3957c Add transplant extension
Brendan Cully <brendan@kublai.com>
parents:
diff changeset
    25
cd ..
198173f3957c Add transplant extension
Brendan Cully <brendan@kublai.com>
parents:
diff changeset
    26
hg clone t rebase
198173f3957c Add transplant extension
Brendan Cully <brendan@kublai.com>
parents:
diff changeset
    27
cd rebase
198173f3957c Add transplant extension
Brendan Cully <brendan@kublai.com>
parents:
diff changeset
    28
198173f3957c Add transplant extension
Brendan Cully <brendan@kublai.com>
parents:
diff changeset
    29
hg up -C 1
198173f3957c Add transplant extension
Brendan Cully <brendan@kublai.com>
parents:
diff changeset
    30
echo '% rebase b onto r1'
198173f3957c Add transplant extension
Brendan Cully <brendan@kublai.com>
parents:
diff changeset
    31
hg transplant -a -b tip
198173f3957c Add transplant extension
Brendan Cully <brendan@kublai.com>
parents:
diff changeset
    32
hg log --template '{rev} {parents} {desc}\n'
198173f3957c Add transplant extension
Brendan Cully <brendan@kublai.com>
parents:
diff changeset
    33
198173f3957c Add transplant extension
Brendan Cully <brendan@kublai.com>
parents:
diff changeset
    34
cd ..
198173f3957c Add transplant extension
Brendan Cully <brendan@kublai.com>
parents:
diff changeset
    35
hg clone t prune
198173f3957c Add transplant extension
Brendan Cully <brendan@kublai.com>
parents:
diff changeset
    36
cd prune
198173f3957c Add transplant extension
Brendan Cully <brendan@kublai.com>
parents:
diff changeset
    37
198173f3957c Add transplant extension
Brendan Cully <brendan@kublai.com>
parents:
diff changeset
    38
hg up -C 1
198173f3957c Add transplant extension
Brendan Cully <brendan@kublai.com>
parents:
diff changeset
    39
echo '% rebase b onto r1, skipping b2'
198173f3957c Add transplant extension
Brendan Cully <brendan@kublai.com>
parents:
diff changeset
    40
hg transplant -a -b tip -p 3
198173f3957c Add transplant extension
Brendan Cully <brendan@kublai.com>
parents:
diff changeset
    41
hg log --template '{rev} {parents} {desc}\n'
198173f3957c Add transplant extension
Brendan Cully <brendan@kublai.com>
parents:
diff changeset
    42
198173f3957c Add transplant extension
Brendan Cully <brendan@kublai.com>
parents:
diff changeset
    43
cd ..
198173f3957c Add transplant extension
Brendan Cully <brendan@kublai.com>
parents:
diff changeset
    44
echo '% remote transplant'
198173f3957c Add transplant extension
Brendan Cully <brendan@kublai.com>
parents:
diff changeset
    45
hg clone -r 1 t remote
198173f3957c Add transplant extension
Brendan Cully <brendan@kublai.com>
parents:
diff changeset
    46
cd remote
198173f3957c Add transplant extension
Brendan Cully <brendan@kublai.com>
parents:
diff changeset
    47
hg transplant --log -s ../t 2 4
198173f3957c Add transplant extension
Brendan Cully <brendan@kublai.com>
parents:
diff changeset
    48
hg log --template '{rev} {parents} {desc}\n'
198173f3957c Add transplant extension
Brendan Cully <brendan@kublai.com>
parents:
diff changeset
    49
198173f3957c Add transplant extension
Brendan Cully <brendan@kublai.com>
parents:
diff changeset
    50
echo '% skip previous transplants'
198173f3957c Add transplant extension
Brendan Cully <brendan@kublai.com>
parents:
diff changeset
    51
hg transplant -s ../t -a -b 4
198173f3957c Add transplant extension
Brendan Cully <brendan@kublai.com>
parents:
diff changeset
    52
hg log --template '{rev} {parents} {desc}\n'
198173f3957c Add transplant extension
Brendan Cully <brendan@kublai.com>
parents:
diff changeset
    53
198173f3957c Add transplant extension
Brendan Cully <brendan@kublai.com>
parents:
diff changeset
    54
echo '% skip local changes transplanted to the source'
198173f3957c Add transplant extension
Brendan Cully <brendan@kublai.com>
parents:
diff changeset
    55
echo b4 > b4
198173f3957c Add transplant extension
Brendan Cully <brendan@kublai.com>
parents:
diff changeset
    56
hg ci -Amb4 -d '3 0'
198173f3957c Add transplant extension
Brendan Cully <brendan@kublai.com>
parents:
diff changeset
    57
cd ..
198173f3957c Add transplant extension
Brendan Cully <brendan@kublai.com>
parents:
diff changeset
    58
hg clone t pullback
198173f3957c Add transplant extension
Brendan Cully <brendan@kublai.com>
parents:
diff changeset
    59
cd pullback
198173f3957c Add transplant extension
Brendan Cully <brendan@kublai.com>
parents:
diff changeset
    60
hg transplant -s ../remote -a -b tip
3724
ea523d6f5f1a transplant: fix --continue; add --continue test
Brendan Cully <brendan@kublai.com>
parents: 3714
diff changeset
    61
ea523d6f5f1a transplant: fix --continue; add --continue test
Brendan Cully <brendan@kublai.com>
parents: 3714
diff changeset
    62
echo '% transplant --continue'
ea523d6f5f1a transplant: fix --continue; add --continue test
Brendan Cully <brendan@kublai.com>
parents: 3714
diff changeset
    63
hg init ../tc
ea523d6f5f1a transplant: fix --continue; add --continue test
Brendan Cully <brendan@kublai.com>
parents: 3714
diff changeset
    64
cd ../tc
ea523d6f5f1a transplant: fix --continue; add --continue test
Brendan Cully <brendan@kublai.com>
parents: 3714
diff changeset
    65
cat <<EOF > foo
ea523d6f5f1a transplant: fix --continue; add --continue test
Brendan Cully <brendan@kublai.com>
parents: 3714
diff changeset
    66
foo
ea523d6f5f1a transplant: fix --continue; add --continue test
Brendan Cully <brendan@kublai.com>
parents: 3714
diff changeset
    67
bar
ea523d6f5f1a transplant: fix --continue; add --continue test
Brendan Cully <brendan@kublai.com>
parents: 3714
diff changeset
    68
baz
ea523d6f5f1a transplant: fix --continue; add --continue test
Brendan Cully <brendan@kublai.com>
parents: 3714
diff changeset
    69
EOF
3726
752884db5037 transplant: recover added/removed files after failed application
Brendan Cully <brendan@kublai.com>
parents: 3724
diff changeset
    70
echo toremove > toremove
3724
ea523d6f5f1a transplant: fix --continue; add --continue test
Brendan Cully <brendan@kublai.com>
parents: 3714
diff changeset
    71
hg ci -Amfoo -d '0 0'
ea523d6f5f1a transplant: fix --continue; add --continue test
Brendan Cully <brendan@kublai.com>
parents: 3714
diff changeset
    72
cat <<EOF > foo
ea523d6f5f1a transplant: fix --continue; add --continue test
Brendan Cully <brendan@kublai.com>
parents: 3714
diff changeset
    73
foo2
ea523d6f5f1a transplant: fix --continue; add --continue test
Brendan Cully <brendan@kublai.com>
parents: 3714
diff changeset
    74
bar2
ea523d6f5f1a transplant: fix --continue; add --continue test
Brendan Cully <brendan@kublai.com>
parents: 3714
diff changeset
    75
baz2
ea523d6f5f1a transplant: fix --continue; add --continue test
Brendan Cully <brendan@kublai.com>
parents: 3714
diff changeset
    76
EOF
3726
752884db5037 transplant: recover added/removed files after failed application
Brendan Cully <brendan@kublai.com>
parents: 3724
diff changeset
    77
rm toremove
752884db5037 transplant: recover added/removed files after failed application
Brendan Cully <brendan@kublai.com>
parents: 3724
diff changeset
    78
echo added > added
752884db5037 transplant: recover added/removed files after failed application
Brendan Cully <brendan@kublai.com>
parents: 3724
diff changeset
    79
hg ci -Amfoo2 -d '0 0'
3724
ea523d6f5f1a transplant: fix --continue; add --continue test
Brendan Cully <brendan@kublai.com>
parents: 3714
diff changeset
    80
echo bar > bar
ea523d6f5f1a transplant: fix --continue; add --continue test
Brendan Cully <brendan@kublai.com>
parents: 3714
diff changeset
    81
hg ci -Ambar -d '0 0'
ea523d6f5f1a transplant: fix --continue; add --continue test
Brendan Cully <brendan@kublai.com>
parents: 3714
diff changeset
    82
echo bar2 >> bar
ea523d6f5f1a transplant: fix --continue; add --continue test
Brendan Cully <brendan@kublai.com>
parents: 3714
diff changeset
    83
hg ci -mbar2 -d '0 0'
ea523d6f5f1a transplant: fix --continue; add --continue test
Brendan Cully <brendan@kublai.com>
parents: 3714
diff changeset
    84
hg up 0
ea523d6f5f1a transplant: fix --continue; add --continue test
Brendan Cully <brendan@kublai.com>
parents: 3714
diff changeset
    85
echo foobar > foo
ea523d6f5f1a transplant: fix --continue; add --continue test
Brendan Cully <brendan@kublai.com>
parents: 3714
diff changeset
    86
hg ci -mfoobar -d '0 0'
ea523d6f5f1a transplant: fix --continue; add --continue test
Brendan Cully <brendan@kublai.com>
parents: 3714
diff changeset
    87
hg transplant 1:3
3758
889f7e74a0d9 transplant: log source node when recovering too.
Brendan Cully <brendan@kublai.com>
parents: 3726
diff changeset
    88
# 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
    89
hg up -C
889f7e74a0d9 transplant: log source node when recovering too.
Brendan Cully <brendan@kublai.com>
parents: 3726
diff changeset
    90
hg transplant 1
3724
ea523d6f5f1a transplant: fix --continue; add --continue test
Brendan Cully <brendan@kublai.com>
parents: 3714
diff changeset
    91
hg transplant --continue
3758
889f7e74a0d9 transplant: log source node when recovering too.
Brendan Cully <brendan@kublai.com>
parents: 3726
diff changeset
    92
hg transplant 1:3
3726
752884db5037 transplant: recover added/removed files after failed application
Brendan Cully <brendan@kublai.com>
parents: 3724
diff changeset
    93
hg locate