tests/test-backout
author Thomas Arendsen Hein <thomas@intevation.de>
Sat, 16 Dec 2006 23:33:24 +0100
changeset 3919 5f0e00224cde
parent 2614 8ba1c31f6864
child 4365 46280c004f22
permissions -rwxr-xr-x
Adjust test-help output for the change in 3c82ab166eea.
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
2158
ec96c4518236 add backout command.
Vadim Gelfer <vadim.gelfer@gmail.com>
parents:
diff changeset
     1
#!/bin/sh
ec96c4518236 add backout command.
Vadim Gelfer <vadim.gelfer@gmail.com>
parents:
diff changeset
     2
ec96c4518236 add backout command.
Vadim Gelfer <vadim.gelfer@gmail.com>
parents:
diff changeset
     3
echo '# basic operation'
ec96c4518236 add backout command.
Vadim Gelfer <vadim.gelfer@gmail.com>
parents:
diff changeset
     4
hg init basic
ec96c4518236 add backout command.
Vadim Gelfer <vadim.gelfer@gmail.com>
parents:
diff changeset
     5
cd basic
ec96c4518236 add backout command.
Vadim Gelfer <vadim.gelfer@gmail.com>
parents:
diff changeset
     6
echo a > a
ec96c4518236 add backout command.
Vadim Gelfer <vadim.gelfer@gmail.com>
parents:
diff changeset
     7
hg commit -d '0 0' -A -m a
ec96c4518236 add backout command.
Vadim Gelfer <vadim.gelfer@gmail.com>
parents:
diff changeset
     8
echo b >> a
ec96c4518236 add backout command.
Vadim Gelfer <vadim.gelfer@gmail.com>
parents:
diff changeset
     9
hg commit -d '1 0' -m b
ec96c4518236 add backout command.
Vadim Gelfer <vadim.gelfer@gmail.com>
parents:
diff changeset
    10
ec96c4518236 add backout command.
Vadim Gelfer <vadim.gelfer@gmail.com>
parents:
diff changeset
    11
hg backout -d '2 0' tip
ec96c4518236 add backout command.
Vadim Gelfer <vadim.gelfer@gmail.com>
parents:
diff changeset
    12
cat a
ec96c4518236 add backout command.
Vadim Gelfer <vadim.gelfer@gmail.com>
parents:
diff changeset
    13
ec96c4518236 add backout command.
Vadim Gelfer <vadim.gelfer@gmail.com>
parents:
diff changeset
    14
echo '# file that was removed is recreated'
ec96c4518236 add backout command.
Vadim Gelfer <vadim.gelfer@gmail.com>
parents:
diff changeset
    15
cd ..
ec96c4518236 add backout command.
Vadim Gelfer <vadim.gelfer@gmail.com>
parents:
diff changeset
    16
hg init remove
ec96c4518236 add backout command.
Vadim Gelfer <vadim.gelfer@gmail.com>
parents:
diff changeset
    17
cd remove
ec96c4518236 add backout command.
Vadim Gelfer <vadim.gelfer@gmail.com>
parents:
diff changeset
    18
ec96c4518236 add backout command.
Vadim Gelfer <vadim.gelfer@gmail.com>
parents:
diff changeset
    19
echo content > a
ec96c4518236 add backout command.
Vadim Gelfer <vadim.gelfer@gmail.com>
parents:
diff changeset
    20
hg commit -d '0 0' -A -m a
ec96c4518236 add backout command.
Vadim Gelfer <vadim.gelfer@gmail.com>
parents:
diff changeset
    21
ec96c4518236 add backout command.
Vadim Gelfer <vadim.gelfer@gmail.com>
parents:
diff changeset
    22
hg rm a
ec96c4518236 add backout command.
Vadim Gelfer <vadim.gelfer@gmail.com>
parents:
diff changeset
    23
hg commit -d '1 0' -m b
ec96c4518236 add backout command.
Vadim Gelfer <vadim.gelfer@gmail.com>
parents:
diff changeset
    24
ec96c4518236 add backout command.
Vadim Gelfer <vadim.gelfer@gmail.com>
parents:
diff changeset
    25
hg backout -d '2 0' --merge tip
ec96c4518236 add backout command.
Vadim Gelfer <vadim.gelfer@gmail.com>
parents:
diff changeset
    26
cat a
ec96c4518236 add backout command.
Vadim Gelfer <vadim.gelfer@gmail.com>
parents:
diff changeset
    27
ec96c4518236 add backout command.
Vadim Gelfer <vadim.gelfer@gmail.com>
parents:
diff changeset
    28
echo '# backout of backout is as if nothing happened'
ec96c4518236 add backout command.
Vadim Gelfer <vadim.gelfer@gmail.com>
parents:
diff changeset
    29
ec96c4518236 add backout command.
Vadim Gelfer <vadim.gelfer@gmail.com>
parents:
diff changeset
    30
hg backout -d '3 0' --merge tip
2186
1092533fd11c tests: fix compatibility on Solaris
TK Soh <teekaysoh@yahoo.com>
parents: 2158
diff changeset
    31
cat a 2>/dev/null || echo cat: a: No such file or directory
2158
ec96c4518236 add backout command.
Vadim Gelfer <vadim.gelfer@gmail.com>
parents:
diff changeset
    32
ec96c4518236 add backout command.
Vadim Gelfer <vadim.gelfer@gmail.com>
parents:
diff changeset
    33
echo '# backout with merge'
ec96c4518236 add backout command.
Vadim Gelfer <vadim.gelfer@gmail.com>
parents:
diff changeset
    34
cd ..
ec96c4518236 add backout command.
Vadim Gelfer <vadim.gelfer@gmail.com>
parents:
diff changeset
    35
hg init merge
ec96c4518236 add backout command.
Vadim Gelfer <vadim.gelfer@gmail.com>
parents:
diff changeset
    36
cd merge
ec96c4518236 add backout command.
Vadim Gelfer <vadim.gelfer@gmail.com>
parents:
diff changeset
    37
ec96c4518236 add backout command.
Vadim Gelfer <vadim.gelfer@gmail.com>
parents:
diff changeset
    38
echo line 1 > a
ec96c4518236 add backout command.
Vadim Gelfer <vadim.gelfer@gmail.com>
parents:
diff changeset
    39
hg commit -d '0 0' -A -m a
ec96c4518236 add backout command.
Vadim Gelfer <vadim.gelfer@gmail.com>
parents:
diff changeset
    40
ec96c4518236 add backout command.
Vadim Gelfer <vadim.gelfer@gmail.com>
parents:
diff changeset
    41
echo line 2 >> a
ec96c4518236 add backout command.
Vadim Gelfer <vadim.gelfer@gmail.com>
parents:
diff changeset
    42
hg commit -d '1 0' -m b
ec96c4518236 add backout command.
Vadim Gelfer <vadim.gelfer@gmail.com>
parents:
diff changeset
    43
ec96c4518236 add backout command.
Vadim Gelfer <vadim.gelfer@gmail.com>
parents:
diff changeset
    44
echo line 3 >> a
ec96c4518236 add backout command.
Vadim Gelfer <vadim.gelfer@gmail.com>
parents:
diff changeset
    45
hg commit -d '2 0' -m c
ec96c4518236 add backout command.
Vadim Gelfer <vadim.gelfer@gmail.com>
parents:
diff changeset
    46
ec96c4518236 add backout command.
Vadim Gelfer <vadim.gelfer@gmail.com>
parents:
diff changeset
    47
hg backout --merge -d '3 0' 1
ec96c4518236 add backout command.
Vadim Gelfer <vadim.gelfer@gmail.com>
parents:
diff changeset
    48
hg commit -d '4 0' -m d
ec96c4518236 add backout command.
Vadim Gelfer <vadim.gelfer@gmail.com>
parents:
diff changeset
    49
cat a
ec96c4518236 add backout command.
Vadim Gelfer <vadim.gelfer@gmail.com>
parents:
diff changeset
    50
2492
2f4addf56715 Test case for #295
Brendan Cully <brendan@kublai.com>
parents: 2186
diff changeset
    51
echo '# backout should not back out subsequent changesets'
2f4addf56715 Test case for #295
Brendan Cully <brendan@kublai.com>
parents: 2186
diff changeset
    52
hg init onecs
2f4addf56715 Test case for #295
Brendan Cully <brendan@kublai.com>
parents: 2186
diff changeset
    53
cd onecs
2f4addf56715 Test case for #295
Brendan Cully <brendan@kublai.com>
parents: 2186
diff changeset
    54
echo 1 > a
2f4addf56715 Test case for #295
Brendan Cully <brendan@kublai.com>
parents: 2186
diff changeset
    55
hg commit -d '0 0' -A -m a
2f4addf56715 Test case for #295
Brendan Cully <brendan@kublai.com>
parents: 2186
diff changeset
    56
echo 2 >> a
2f4addf56715 Test case for #295
Brendan Cully <brendan@kublai.com>
parents: 2186
diff changeset
    57
hg commit -d '1 0' -m b
2f4addf56715 Test case for #295
Brendan Cully <brendan@kublai.com>
parents: 2186
diff changeset
    58
echo 1 > b
2f4addf56715 Test case for #295
Brendan Cully <brendan@kublai.com>
parents: 2186
diff changeset
    59
hg commit -d '2 0' -A -m c
2f4addf56715 Test case for #295
Brendan Cully <brendan@kublai.com>
parents: 2186
diff changeset
    60
hg backout -d '3 0' 1
2f4addf56715 Test case for #295
Brendan Cully <brendan@kublai.com>
parents: 2186
diff changeset
    61
hg locate b
2f4addf56715 Test case for #295
Brendan Cully <brendan@kublai.com>
parents: 2186
diff changeset
    62
2614
8ba1c31f6864 backout: allow backout of merge changeset with --parent option.
Vadim Gelfer <vadim.gelfer@gmail.com>
parents: 2492
diff changeset
    63
cd ..
8ba1c31f6864 backout: allow backout of merge changeset with --parent option.
Vadim Gelfer <vadim.gelfer@gmail.com>
parents: 2492
diff changeset
    64
hg init m
8ba1c31f6864 backout: allow backout of merge changeset with --parent option.
Vadim Gelfer <vadim.gelfer@gmail.com>
parents: 2492
diff changeset
    65
cd m
8ba1c31f6864 backout: allow backout of merge changeset with --parent option.
Vadim Gelfer <vadim.gelfer@gmail.com>
parents: 2492
diff changeset
    66
echo a > a
8ba1c31f6864 backout: allow backout of merge changeset with --parent option.
Vadim Gelfer <vadim.gelfer@gmail.com>
parents: 2492
diff changeset
    67
hg commit -d '0 0' -A -m a
8ba1c31f6864 backout: allow backout of merge changeset with --parent option.
Vadim Gelfer <vadim.gelfer@gmail.com>
parents: 2492
diff changeset
    68
echo b > b
8ba1c31f6864 backout: allow backout of merge changeset with --parent option.
Vadim Gelfer <vadim.gelfer@gmail.com>
parents: 2492
diff changeset
    69
hg commit -d '1 0' -A -m b
8ba1c31f6864 backout: allow backout of merge changeset with --parent option.
Vadim Gelfer <vadim.gelfer@gmail.com>
parents: 2492
diff changeset
    70
echo c > c
8ba1c31f6864 backout: allow backout of merge changeset with --parent option.
Vadim Gelfer <vadim.gelfer@gmail.com>
parents: 2492
diff changeset
    71
hg commit -d '2 0' -A -m b
8ba1c31f6864 backout: allow backout of merge changeset with --parent option.
Vadim Gelfer <vadim.gelfer@gmail.com>
parents: 2492
diff changeset
    72
hg update 1
8ba1c31f6864 backout: allow backout of merge changeset with --parent option.
Vadim Gelfer <vadim.gelfer@gmail.com>
parents: 2492
diff changeset
    73
echo d > d
8ba1c31f6864 backout: allow backout of merge changeset with --parent option.
Vadim Gelfer <vadim.gelfer@gmail.com>
parents: 2492
diff changeset
    74
hg commit -d '3 0' -A -m c
8ba1c31f6864 backout: allow backout of merge changeset with --parent option.
Vadim Gelfer <vadim.gelfer@gmail.com>
parents: 2492
diff changeset
    75
hg merge 2
8ba1c31f6864 backout: allow backout of merge changeset with --parent option.
Vadim Gelfer <vadim.gelfer@gmail.com>
parents: 2492
diff changeset
    76
hg commit -d '4 0' -A -m d
8ba1c31f6864 backout: allow backout of merge changeset with --parent option.
Vadim Gelfer <vadim.gelfer@gmail.com>
parents: 2492
diff changeset
    77
8ba1c31f6864 backout: allow backout of merge changeset with --parent option.
Vadim Gelfer <vadim.gelfer@gmail.com>
parents: 2492
diff changeset
    78
echo '# backout of merge should fail'
8ba1c31f6864 backout: allow backout of merge changeset with --parent option.
Vadim Gelfer <vadim.gelfer@gmail.com>
parents: 2492
diff changeset
    79
8ba1c31f6864 backout: allow backout of merge changeset with --parent option.
Vadim Gelfer <vadim.gelfer@gmail.com>
parents: 2492
diff changeset
    80
hg backout 4
8ba1c31f6864 backout: allow backout of merge changeset with --parent option.
Vadim Gelfer <vadim.gelfer@gmail.com>
parents: 2492
diff changeset
    81
8ba1c31f6864 backout: allow backout of merge changeset with --parent option.
Vadim Gelfer <vadim.gelfer@gmail.com>
parents: 2492
diff changeset
    82
echo '# backout of merge with bad parent should fail'
8ba1c31f6864 backout: allow backout of merge changeset with --parent option.
Vadim Gelfer <vadim.gelfer@gmail.com>
parents: 2492
diff changeset
    83
8ba1c31f6864 backout: allow backout of merge changeset with --parent option.
Vadim Gelfer <vadim.gelfer@gmail.com>
parents: 2492
diff changeset
    84
hg backout --parent 0 4
8ba1c31f6864 backout: allow backout of merge changeset with --parent option.
Vadim Gelfer <vadim.gelfer@gmail.com>
parents: 2492
diff changeset
    85
8ba1c31f6864 backout: allow backout of merge changeset with --parent option.
Vadim Gelfer <vadim.gelfer@gmail.com>
parents: 2492
diff changeset
    86
echo '# backout of non-merge with parent should fail'
8ba1c31f6864 backout: allow backout of merge changeset with --parent option.
Vadim Gelfer <vadim.gelfer@gmail.com>
parents: 2492
diff changeset
    87
8ba1c31f6864 backout: allow backout of merge changeset with --parent option.
Vadim Gelfer <vadim.gelfer@gmail.com>
parents: 2492
diff changeset
    88
hg backout --parent 0 3
8ba1c31f6864 backout: allow backout of merge changeset with --parent option.
Vadim Gelfer <vadim.gelfer@gmail.com>
parents: 2492
diff changeset
    89
8ba1c31f6864 backout: allow backout of merge changeset with --parent option.
Vadim Gelfer <vadim.gelfer@gmail.com>
parents: 2492
diff changeset
    90
echo '# backout with valid parent should be ok'
8ba1c31f6864 backout: allow backout of merge changeset with --parent option.
Vadim Gelfer <vadim.gelfer@gmail.com>
parents: 2492
diff changeset
    91
8ba1c31f6864 backout: allow backout of merge changeset with --parent option.
Vadim Gelfer <vadim.gelfer@gmail.com>
parents: 2492
diff changeset
    92
hg backout -d '5 0' --parent 2 4
8ba1c31f6864 backout: allow backout of merge changeset with --parent option.
Vadim Gelfer <vadim.gelfer@gmail.com>
parents: 2492
diff changeset
    93
8ba1c31f6864 backout: allow backout of merge changeset with --parent option.
Vadim Gelfer <vadim.gelfer@gmail.com>
parents: 2492
diff changeset
    94
hg rollback
8ba1c31f6864 backout: allow backout of merge changeset with --parent option.
Vadim Gelfer <vadim.gelfer@gmail.com>
parents: 2492
diff changeset
    95
hg update -C
8ba1c31f6864 backout: allow backout of merge changeset with --parent option.
Vadim Gelfer <vadim.gelfer@gmail.com>
parents: 2492
diff changeset
    96
8ba1c31f6864 backout: allow backout of merge changeset with --parent option.
Vadim Gelfer <vadim.gelfer@gmail.com>
parents: 2492
diff changeset
    97
hg backout -d '6 0' --parent 3 4
8ba1c31f6864 backout: allow backout of merge changeset with --parent option.
Vadim Gelfer <vadim.gelfer@gmail.com>
parents: 2492
diff changeset
    98
2158
ec96c4518236 add backout command.
Vadim Gelfer <vadim.gelfer@gmail.com>
parents:
diff changeset
    99
exit 0