tests/test-backout.t
author Mads Kiilerich <mads@kiilerich.com>
Wed, 29 Sep 2010 01:33:31 +0200
changeset 12585 385fd0eee005
parent 12328 b63f6422d2a7
child 12727 52971985be14
permissions -rw-r--r--
test-convert-cvs-detectmerge: add sleep so cvs notices changes
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
11856
db969ebdebd9 tests: unify test-backout
Martin Geisler <mg@lazybytes.net>
parents: 8167
diff changeset
     1
  $ HGMERGE=true; export HGMERGE
db969ebdebd9 tests: unify test-backout
Martin Geisler <mg@lazybytes.net>
parents: 8167
diff changeset
     2
db969ebdebd9 tests: unify test-backout
Martin Geisler <mg@lazybytes.net>
parents: 8167
diff changeset
     3
  $ hg init basic
db969ebdebd9 tests: unify test-backout
Martin Geisler <mg@lazybytes.net>
parents: 8167
diff changeset
     4
  $ cd basic
2158
ec96c4518236 add backout command.
Vadim Gelfer <vadim.gelfer@gmail.com>
parents:
diff changeset
     5
12328
b63f6422d2a7 tests: fix a bunch of pointless #s in unified tests
Matt Mackall <mpm@selenic.com>
parents: 12327
diff changeset
     6
should complain
4365
46280c004f22 change tests to use simplemerge by default
Alexis S. L. Carvalho <alexis@cecm.usp.br>
parents: 2614
diff changeset
     7
11856
db969ebdebd9 tests: unify test-backout
Martin Geisler <mg@lazybytes.net>
parents: 8167
diff changeset
     8
  $ hg backout
db969ebdebd9 tests: unify test-backout
Martin Geisler <mg@lazybytes.net>
parents: 8167
diff changeset
     9
  abort: please specify a revision to backout
12316
4134686b83e1 tests: add exit codes to unified tests
Matt Mackall <mpm@selenic.com>
parents: 11856
diff changeset
    10
  [255]
11856
db969ebdebd9 tests: unify test-backout
Martin Geisler <mg@lazybytes.net>
parents: 8167
diff changeset
    11
  $ hg backout -r 0 0
db969ebdebd9 tests: unify test-backout
Martin Geisler <mg@lazybytes.net>
parents: 8167
diff changeset
    12
  abort: please specify just one revision
12316
4134686b83e1 tests: add exit codes to unified tests
Matt Mackall <mpm@selenic.com>
parents: 11856
diff changeset
    13
  [255]
4726
f6e961c0155b Fix and test 'hg backout' without or with too many revisions.
Thomas Arendsen Hein <thomas@intevation.de>
parents: 4365
diff changeset
    14
12328
b63f6422d2a7 tests: fix a bunch of pointless #s in unified tests
Matt Mackall <mpm@selenic.com>
parents: 12327
diff changeset
    15
basic operation
4726
f6e961c0155b Fix and test 'hg backout' without or with too many revisions.
Thomas Arendsen Hein <thomas@intevation.de>
parents: 4365
diff changeset
    16
11856
db969ebdebd9 tests: unify test-backout
Martin Geisler <mg@lazybytes.net>
parents: 8167
diff changeset
    17
  $ echo a > a
db969ebdebd9 tests: unify test-backout
Martin Geisler <mg@lazybytes.net>
parents: 8167
diff changeset
    18
  $ hg commit -d '0 0' -A -m a
db969ebdebd9 tests: unify test-backout
Martin Geisler <mg@lazybytes.net>
parents: 8167
diff changeset
    19
  adding a
db969ebdebd9 tests: unify test-backout
Martin Geisler <mg@lazybytes.net>
parents: 8167
diff changeset
    20
  $ echo b >> a
db969ebdebd9 tests: unify test-backout
Martin Geisler <mg@lazybytes.net>
parents: 8167
diff changeset
    21
  $ hg commit -d '1 0' -m b
db969ebdebd9 tests: unify test-backout
Martin Geisler <mg@lazybytes.net>
parents: 8167
diff changeset
    22
db969ebdebd9 tests: unify test-backout
Martin Geisler <mg@lazybytes.net>
parents: 8167
diff changeset
    23
  $ hg backout -d '2 0' tip
db969ebdebd9 tests: unify test-backout
Martin Geisler <mg@lazybytes.net>
parents: 8167
diff changeset
    24
  reverting a
db969ebdebd9 tests: unify test-backout
Martin Geisler <mg@lazybytes.net>
parents: 8167
diff changeset
    25
  changeset 2:2929462c3dff backs out changeset 1:a820f4f40a57
db969ebdebd9 tests: unify test-backout
Martin Geisler <mg@lazybytes.net>
parents: 8167
diff changeset
    26
  $ cat a
db969ebdebd9 tests: unify test-backout
Martin Geisler <mg@lazybytes.net>
parents: 8167
diff changeset
    27
  a
2158
ec96c4518236 add backout command.
Vadim Gelfer <vadim.gelfer@gmail.com>
parents:
diff changeset
    28
12328
b63f6422d2a7 tests: fix a bunch of pointless #s in unified tests
Matt Mackall <mpm@selenic.com>
parents: 12327
diff changeset
    29
file that was removed is recreated
11856
db969ebdebd9 tests: unify test-backout
Martin Geisler <mg@lazybytes.net>
parents: 8167
diff changeset
    30
db969ebdebd9 tests: unify test-backout
Martin Geisler <mg@lazybytes.net>
parents: 8167
diff changeset
    31
  $ cd ..
db969ebdebd9 tests: unify test-backout
Martin Geisler <mg@lazybytes.net>
parents: 8167
diff changeset
    32
  $ hg init remove
db969ebdebd9 tests: unify test-backout
Martin Geisler <mg@lazybytes.net>
parents: 8167
diff changeset
    33
  $ cd remove
2158
ec96c4518236 add backout command.
Vadim Gelfer <vadim.gelfer@gmail.com>
parents:
diff changeset
    34
11856
db969ebdebd9 tests: unify test-backout
Martin Geisler <mg@lazybytes.net>
parents: 8167
diff changeset
    35
  $ echo content > a
db969ebdebd9 tests: unify test-backout
Martin Geisler <mg@lazybytes.net>
parents: 8167
diff changeset
    36
  $ hg commit -d '0 0' -A -m a
db969ebdebd9 tests: unify test-backout
Martin Geisler <mg@lazybytes.net>
parents: 8167
diff changeset
    37
  adding a
db969ebdebd9 tests: unify test-backout
Martin Geisler <mg@lazybytes.net>
parents: 8167
diff changeset
    38
db969ebdebd9 tests: unify test-backout
Martin Geisler <mg@lazybytes.net>
parents: 8167
diff changeset
    39
  $ hg rm a
db969ebdebd9 tests: unify test-backout
Martin Geisler <mg@lazybytes.net>
parents: 8167
diff changeset
    40
  $ hg commit -d '1 0' -m b
2158
ec96c4518236 add backout command.
Vadim Gelfer <vadim.gelfer@gmail.com>
parents:
diff changeset
    41
11856
db969ebdebd9 tests: unify test-backout
Martin Geisler <mg@lazybytes.net>
parents: 8167
diff changeset
    42
  $ hg backout -d '2 0' --merge tip
db969ebdebd9 tests: unify test-backout
Martin Geisler <mg@lazybytes.net>
parents: 8167
diff changeset
    43
  adding a
db969ebdebd9 tests: unify test-backout
Martin Geisler <mg@lazybytes.net>
parents: 8167
diff changeset
    44
  changeset 2:de31bdc76c0d backs out changeset 1:76862dcce372
db969ebdebd9 tests: unify test-backout
Martin Geisler <mg@lazybytes.net>
parents: 8167
diff changeset
    45
  $ cat a
db969ebdebd9 tests: unify test-backout
Martin Geisler <mg@lazybytes.net>
parents: 8167
diff changeset
    46
  content
db969ebdebd9 tests: unify test-backout
Martin Geisler <mg@lazybytes.net>
parents: 8167
diff changeset
    47
12328
b63f6422d2a7 tests: fix a bunch of pointless #s in unified tests
Matt Mackall <mpm@selenic.com>
parents: 12327
diff changeset
    48
backout of backout is as if nothing happened
2158
ec96c4518236 add backout command.
Vadim Gelfer <vadim.gelfer@gmail.com>
parents:
diff changeset
    49
11856
db969ebdebd9 tests: unify test-backout
Martin Geisler <mg@lazybytes.net>
parents: 8167
diff changeset
    50
  $ hg backout -d '3 0' --merge tip
db969ebdebd9 tests: unify test-backout
Martin Geisler <mg@lazybytes.net>
parents: 8167
diff changeset
    51
  removing a
db969ebdebd9 tests: unify test-backout
Martin Geisler <mg@lazybytes.net>
parents: 8167
diff changeset
    52
  changeset 3:7f6d0f120113 backs out changeset 2:de31bdc76c0d
db969ebdebd9 tests: unify test-backout
Martin Geisler <mg@lazybytes.net>
parents: 8167
diff changeset
    53
  $ cat a 2>/dev/null || echo cat: a: No such file or directory
db969ebdebd9 tests: unify test-backout
Martin Geisler <mg@lazybytes.net>
parents: 8167
diff changeset
    54
  cat: a: No such file or directory
2158
ec96c4518236 add backout command.
Vadim Gelfer <vadim.gelfer@gmail.com>
parents:
diff changeset
    55
12328
b63f6422d2a7 tests: fix a bunch of pointless #s in unified tests
Matt Mackall <mpm@selenic.com>
parents: 12327
diff changeset
    56
across branch
2158
ec96c4518236 add backout command.
Vadim Gelfer <vadim.gelfer@gmail.com>
parents:
diff changeset
    57
11856
db969ebdebd9 tests: unify test-backout
Martin Geisler <mg@lazybytes.net>
parents: 8167
diff changeset
    58
  $ cd ..
db969ebdebd9 tests: unify test-backout
Martin Geisler <mg@lazybytes.net>
parents: 8167
diff changeset
    59
  $ hg init branch
db969ebdebd9 tests: unify test-backout
Martin Geisler <mg@lazybytes.net>
parents: 8167
diff changeset
    60
  $ cd branch
db969ebdebd9 tests: unify test-backout
Martin Geisler <mg@lazybytes.net>
parents: 8167
diff changeset
    61
  $ echo a > a
db969ebdebd9 tests: unify test-backout
Martin Geisler <mg@lazybytes.net>
parents: 8167
diff changeset
    62
  $ hg ci -Am0
db969ebdebd9 tests: unify test-backout
Martin Geisler <mg@lazybytes.net>
parents: 8167
diff changeset
    63
  adding a
db969ebdebd9 tests: unify test-backout
Martin Geisler <mg@lazybytes.net>
parents: 8167
diff changeset
    64
  $ echo b > b
db969ebdebd9 tests: unify test-backout
Martin Geisler <mg@lazybytes.net>
parents: 8167
diff changeset
    65
  $ hg ci -Am1
db969ebdebd9 tests: unify test-backout
Martin Geisler <mg@lazybytes.net>
parents: 8167
diff changeset
    66
  adding b
db969ebdebd9 tests: unify test-backout
Martin Geisler <mg@lazybytes.net>
parents: 8167
diff changeset
    67
  $ hg co -C 0
db969ebdebd9 tests: unify test-backout
Martin Geisler <mg@lazybytes.net>
parents: 8167
diff changeset
    68
  0 files updated, 0 files merged, 1 files removed, 0 files unresolved
db969ebdebd9 tests: unify test-backout
Martin Geisler <mg@lazybytes.net>
parents: 8167
diff changeset
    69
db969ebdebd9 tests: unify test-backout
Martin Geisler <mg@lazybytes.net>
parents: 8167
diff changeset
    70
should fail
2158
ec96c4518236 add backout command.
Vadim Gelfer <vadim.gelfer@gmail.com>
parents:
diff changeset
    71
11856
db969ebdebd9 tests: unify test-backout
Martin Geisler <mg@lazybytes.net>
parents: 8167
diff changeset
    72
  $ hg backout 1
db969ebdebd9 tests: unify test-backout
Martin Geisler <mg@lazybytes.net>
parents: 8167
diff changeset
    73
  abort: cannot backout change on a different branch
12316
4134686b83e1 tests: add exit codes to unified tests
Matt Mackall <mpm@selenic.com>
parents: 11856
diff changeset
    74
  [255]
11856
db969ebdebd9 tests: unify test-backout
Martin Geisler <mg@lazybytes.net>
parents: 8167
diff changeset
    75
  $ echo c > c
db969ebdebd9 tests: unify test-backout
Martin Geisler <mg@lazybytes.net>
parents: 8167
diff changeset
    76
  $ hg ci -Am2
db969ebdebd9 tests: unify test-backout
Martin Geisler <mg@lazybytes.net>
parents: 8167
diff changeset
    77
  adding c
db969ebdebd9 tests: unify test-backout
Martin Geisler <mg@lazybytes.net>
parents: 8167
diff changeset
    78
  created new head
db969ebdebd9 tests: unify test-backout
Martin Geisler <mg@lazybytes.net>
parents: 8167
diff changeset
    79
db969ebdebd9 tests: unify test-backout
Martin Geisler <mg@lazybytes.net>
parents: 8167
diff changeset
    80
should fail
db969ebdebd9 tests: unify test-backout
Martin Geisler <mg@lazybytes.net>
parents: 8167
diff changeset
    81
db969ebdebd9 tests: unify test-backout
Martin Geisler <mg@lazybytes.net>
parents: 8167
diff changeset
    82
  $ hg backout 1
db969ebdebd9 tests: unify test-backout
Martin Geisler <mg@lazybytes.net>
parents: 8167
diff changeset
    83
  abort: cannot backout change on a different branch
12316
4134686b83e1 tests: add exit codes to unified tests
Matt Mackall <mpm@selenic.com>
parents: 11856
diff changeset
    84
  [255]
11856
db969ebdebd9 tests: unify test-backout
Martin Geisler <mg@lazybytes.net>
parents: 8167
diff changeset
    85
12328
b63f6422d2a7 tests: fix a bunch of pointless #s in unified tests
Matt Mackall <mpm@selenic.com>
parents: 12327
diff changeset
    86
backout with merge
11856
db969ebdebd9 tests: unify test-backout
Martin Geisler <mg@lazybytes.net>
parents: 8167
diff changeset
    87
db969ebdebd9 tests: unify test-backout
Martin Geisler <mg@lazybytes.net>
parents: 8167
diff changeset
    88
  $ cd ..
db969ebdebd9 tests: unify test-backout
Martin Geisler <mg@lazybytes.net>
parents: 8167
diff changeset
    89
  $ hg init merge
db969ebdebd9 tests: unify test-backout
Martin Geisler <mg@lazybytes.net>
parents: 8167
diff changeset
    90
  $ cd merge
5568
de620356064f backout: disallow across branches (issue655)
Matt Mackall <mpm@selenic.com>
parents: 4726
diff changeset
    91
11856
db969ebdebd9 tests: unify test-backout
Martin Geisler <mg@lazybytes.net>
parents: 8167
diff changeset
    92
  $ echo line 1 > a
db969ebdebd9 tests: unify test-backout
Martin Geisler <mg@lazybytes.net>
parents: 8167
diff changeset
    93
  $ echo line 2 >> a
db969ebdebd9 tests: unify test-backout
Martin Geisler <mg@lazybytes.net>
parents: 8167
diff changeset
    94
  $ hg commit -d '0 0' -A -m a
db969ebdebd9 tests: unify test-backout
Martin Geisler <mg@lazybytes.net>
parents: 8167
diff changeset
    95
  adding a
db969ebdebd9 tests: unify test-backout
Martin Geisler <mg@lazybytes.net>
parents: 8167
diff changeset
    96
db969ebdebd9 tests: unify test-backout
Martin Geisler <mg@lazybytes.net>
parents: 8167
diff changeset
    97
remove line 1
db969ebdebd9 tests: unify test-backout
Martin Geisler <mg@lazybytes.net>
parents: 8167
diff changeset
    98
db969ebdebd9 tests: unify test-backout
Martin Geisler <mg@lazybytes.net>
parents: 8167
diff changeset
    99
  $ echo line 2 > a
db969ebdebd9 tests: unify test-backout
Martin Geisler <mg@lazybytes.net>
parents: 8167
diff changeset
   100
  $ hg commit -d '1 0' -m b
db969ebdebd9 tests: unify test-backout
Martin Geisler <mg@lazybytes.net>
parents: 8167
diff changeset
   101
db969ebdebd9 tests: unify test-backout
Martin Geisler <mg@lazybytes.net>
parents: 8167
diff changeset
   102
  $ echo line 3 >> a
db969ebdebd9 tests: unify test-backout
Martin Geisler <mg@lazybytes.net>
parents: 8167
diff changeset
   103
  $ hg commit -d '2 0' -m c
2158
ec96c4518236 add backout command.
Vadim Gelfer <vadim.gelfer@gmail.com>
parents:
diff changeset
   104
11856
db969ebdebd9 tests: unify test-backout
Martin Geisler <mg@lazybytes.net>
parents: 8167
diff changeset
   105
  $ hg backout --merge -d '3 0' 1
db969ebdebd9 tests: unify test-backout
Martin Geisler <mg@lazybytes.net>
parents: 8167
diff changeset
   106
  reverting a
db969ebdebd9 tests: unify test-backout
Martin Geisler <mg@lazybytes.net>
parents: 8167
diff changeset
   107
  created new head
db969ebdebd9 tests: unify test-backout
Martin Geisler <mg@lazybytes.net>
parents: 8167
diff changeset
   108
  changeset 3:26b8ccb9ad91 backs out changeset 1:5a50a024c182
db969ebdebd9 tests: unify test-backout
Martin Geisler <mg@lazybytes.net>
parents: 8167
diff changeset
   109
  merging with changeset 3:26b8ccb9ad91
db969ebdebd9 tests: unify test-backout
Martin Geisler <mg@lazybytes.net>
parents: 8167
diff changeset
   110
  merging a
db969ebdebd9 tests: unify test-backout
Martin Geisler <mg@lazybytes.net>
parents: 8167
diff changeset
   111
  0 files updated, 1 files merged, 0 files removed, 0 files unresolved
db969ebdebd9 tests: unify test-backout
Martin Geisler <mg@lazybytes.net>
parents: 8167
diff changeset
   112
  (branch merge, don't forget to commit)
db969ebdebd9 tests: unify test-backout
Martin Geisler <mg@lazybytes.net>
parents: 8167
diff changeset
   113
  $ hg commit -d '4 0' -m d
2158
ec96c4518236 add backout command.
Vadim Gelfer <vadim.gelfer@gmail.com>
parents:
diff changeset
   114
11856
db969ebdebd9 tests: unify test-backout
Martin Geisler <mg@lazybytes.net>
parents: 8167
diff changeset
   115
check line 1 is back
2158
ec96c4518236 add backout command.
Vadim Gelfer <vadim.gelfer@gmail.com>
parents:
diff changeset
   116
11856
db969ebdebd9 tests: unify test-backout
Martin Geisler <mg@lazybytes.net>
parents: 8167
diff changeset
   117
  $ cat a
db969ebdebd9 tests: unify test-backout
Martin Geisler <mg@lazybytes.net>
parents: 8167
diff changeset
   118
  line 1
db969ebdebd9 tests: unify test-backout
Martin Geisler <mg@lazybytes.net>
parents: 8167
diff changeset
   119
  line 2
db969ebdebd9 tests: unify test-backout
Martin Geisler <mg@lazybytes.net>
parents: 8167
diff changeset
   120
  line 3
db969ebdebd9 tests: unify test-backout
Martin Geisler <mg@lazybytes.net>
parents: 8167
diff changeset
   121
12328
b63f6422d2a7 tests: fix a bunch of pointless #s in unified tests
Matt Mackall <mpm@selenic.com>
parents: 12327
diff changeset
   122
backout should not back out subsequent changesets
2158
ec96c4518236 add backout command.
Vadim Gelfer <vadim.gelfer@gmail.com>
parents:
diff changeset
   123
11856
db969ebdebd9 tests: unify test-backout
Martin Geisler <mg@lazybytes.net>
parents: 8167
diff changeset
   124
  $ hg init onecs
db969ebdebd9 tests: unify test-backout
Martin Geisler <mg@lazybytes.net>
parents: 8167
diff changeset
   125
  $ cd onecs
db969ebdebd9 tests: unify test-backout
Martin Geisler <mg@lazybytes.net>
parents: 8167
diff changeset
   126
  $ echo 1 > a
db969ebdebd9 tests: unify test-backout
Martin Geisler <mg@lazybytes.net>
parents: 8167
diff changeset
   127
  $ hg commit -d '0 0' -A -m a
db969ebdebd9 tests: unify test-backout
Martin Geisler <mg@lazybytes.net>
parents: 8167
diff changeset
   128
  adding a
db969ebdebd9 tests: unify test-backout
Martin Geisler <mg@lazybytes.net>
parents: 8167
diff changeset
   129
  $ echo 2 >> a
db969ebdebd9 tests: unify test-backout
Martin Geisler <mg@lazybytes.net>
parents: 8167
diff changeset
   130
  $ hg commit -d '1 0' -m b
db969ebdebd9 tests: unify test-backout
Martin Geisler <mg@lazybytes.net>
parents: 8167
diff changeset
   131
  $ echo 1 > b
db969ebdebd9 tests: unify test-backout
Martin Geisler <mg@lazybytes.net>
parents: 8167
diff changeset
   132
  $ hg commit -d '2 0' -A -m c
db969ebdebd9 tests: unify test-backout
Martin Geisler <mg@lazybytes.net>
parents: 8167
diff changeset
   133
  adding b
db969ebdebd9 tests: unify test-backout
Martin Geisler <mg@lazybytes.net>
parents: 8167
diff changeset
   134
  $ hg backout -d '3 0' 1
db969ebdebd9 tests: unify test-backout
Martin Geisler <mg@lazybytes.net>
parents: 8167
diff changeset
   135
  reverting a
db969ebdebd9 tests: unify test-backout
Martin Geisler <mg@lazybytes.net>
parents: 8167
diff changeset
   136
  created new head
db969ebdebd9 tests: unify test-backout
Martin Geisler <mg@lazybytes.net>
parents: 8167
diff changeset
   137
  changeset 3:3202beb76721 backs out changeset 1:22bca4c721e5
db969ebdebd9 tests: unify test-backout
Martin Geisler <mg@lazybytes.net>
parents: 8167
diff changeset
   138
  the backout changeset is a new head - do not forget to merge
db969ebdebd9 tests: unify test-backout
Martin Geisler <mg@lazybytes.net>
parents: 8167
diff changeset
   139
  (use "backout --merge" if you want to auto-merge)
db969ebdebd9 tests: unify test-backout
Martin Geisler <mg@lazybytes.net>
parents: 8167
diff changeset
   140
  $ hg locate b
db969ebdebd9 tests: unify test-backout
Martin Geisler <mg@lazybytes.net>
parents: 8167
diff changeset
   141
  b
db969ebdebd9 tests: unify test-backout
Martin Geisler <mg@lazybytes.net>
parents: 8167
diff changeset
   142
  $ hg update -C tip
db969ebdebd9 tests: unify test-backout
Martin Geisler <mg@lazybytes.net>
parents: 8167
diff changeset
   143
  1 files updated, 0 files merged, 1 files removed, 0 files unresolved
db969ebdebd9 tests: unify test-backout
Martin Geisler <mg@lazybytes.net>
parents: 8167
diff changeset
   144
  $ hg locate b
12316
4134686b83e1 tests: add exit codes to unified tests
Matt Mackall <mpm@selenic.com>
parents: 11856
diff changeset
   145
  [1]
2492
2f4addf56715 Test case for #295
Brendan Cully <brendan@kublai.com>
parents: 2186
diff changeset
   146
11856
db969ebdebd9 tests: unify test-backout
Martin Geisler <mg@lazybytes.net>
parents: 8167
diff changeset
   147
  $ cd ..
db969ebdebd9 tests: unify test-backout
Martin Geisler <mg@lazybytes.net>
parents: 8167
diff changeset
   148
  $ hg init m
db969ebdebd9 tests: unify test-backout
Martin Geisler <mg@lazybytes.net>
parents: 8167
diff changeset
   149
  $ cd m
db969ebdebd9 tests: unify test-backout
Martin Geisler <mg@lazybytes.net>
parents: 8167
diff changeset
   150
  $ echo a > a
db969ebdebd9 tests: unify test-backout
Martin Geisler <mg@lazybytes.net>
parents: 8167
diff changeset
   151
  $ hg commit -d '0 0' -A -m a
db969ebdebd9 tests: unify test-backout
Martin Geisler <mg@lazybytes.net>
parents: 8167
diff changeset
   152
  adding a
db969ebdebd9 tests: unify test-backout
Martin Geisler <mg@lazybytes.net>
parents: 8167
diff changeset
   153
  $ echo b > b
db969ebdebd9 tests: unify test-backout
Martin Geisler <mg@lazybytes.net>
parents: 8167
diff changeset
   154
  $ hg commit -d '1 0' -A -m b
db969ebdebd9 tests: unify test-backout
Martin Geisler <mg@lazybytes.net>
parents: 8167
diff changeset
   155
  adding b
db969ebdebd9 tests: unify test-backout
Martin Geisler <mg@lazybytes.net>
parents: 8167
diff changeset
   156
  $ echo c > c
db969ebdebd9 tests: unify test-backout
Martin Geisler <mg@lazybytes.net>
parents: 8167
diff changeset
   157
  $ hg commit -d '2 0' -A -m b
db969ebdebd9 tests: unify test-backout
Martin Geisler <mg@lazybytes.net>
parents: 8167
diff changeset
   158
  adding c
db969ebdebd9 tests: unify test-backout
Martin Geisler <mg@lazybytes.net>
parents: 8167
diff changeset
   159
  $ hg update 1
db969ebdebd9 tests: unify test-backout
Martin Geisler <mg@lazybytes.net>
parents: 8167
diff changeset
   160
  0 files updated, 0 files merged, 1 files removed, 0 files unresolved
db969ebdebd9 tests: unify test-backout
Martin Geisler <mg@lazybytes.net>
parents: 8167
diff changeset
   161
  $ echo d > d
db969ebdebd9 tests: unify test-backout
Martin Geisler <mg@lazybytes.net>
parents: 8167
diff changeset
   162
  $ hg commit -d '3 0' -A -m c
db969ebdebd9 tests: unify test-backout
Martin Geisler <mg@lazybytes.net>
parents: 8167
diff changeset
   163
  adding d
db969ebdebd9 tests: unify test-backout
Martin Geisler <mg@lazybytes.net>
parents: 8167
diff changeset
   164
  created new head
db969ebdebd9 tests: unify test-backout
Martin Geisler <mg@lazybytes.net>
parents: 8167
diff changeset
   165
  $ hg merge 2
db969ebdebd9 tests: unify test-backout
Martin Geisler <mg@lazybytes.net>
parents: 8167
diff changeset
   166
  1 files updated, 0 files merged, 0 files removed, 0 files unresolved
db969ebdebd9 tests: unify test-backout
Martin Geisler <mg@lazybytes.net>
parents: 8167
diff changeset
   167
  (branch merge, don't forget to commit)
db969ebdebd9 tests: unify test-backout
Martin Geisler <mg@lazybytes.net>
parents: 8167
diff changeset
   168
  $ hg commit -d '4 0' -A -m d
2614
8ba1c31f6864 backout: allow backout of merge changeset with --parent option.
Vadim Gelfer <vadim.gelfer@gmail.com>
parents: 2492
diff changeset
   169
12328
b63f6422d2a7 tests: fix a bunch of pointless #s in unified tests
Matt Mackall <mpm@selenic.com>
parents: 12327
diff changeset
   170
backout of merge should fail
11856
db969ebdebd9 tests: unify test-backout
Martin Geisler <mg@lazybytes.net>
parents: 8167
diff changeset
   171
db969ebdebd9 tests: unify test-backout
Martin Geisler <mg@lazybytes.net>
parents: 8167
diff changeset
   172
  $ hg backout 4
db969ebdebd9 tests: unify test-backout
Martin Geisler <mg@lazybytes.net>
parents: 8167
diff changeset
   173
  abort: cannot backout a merge changeset without --parent
12316
4134686b83e1 tests: add exit codes to unified tests
Matt Mackall <mpm@selenic.com>
parents: 11856
diff changeset
   174
  [255]
2614
8ba1c31f6864 backout: allow backout of merge changeset with --parent option.
Vadim Gelfer <vadim.gelfer@gmail.com>
parents: 2492
diff changeset
   175
12328
b63f6422d2a7 tests: fix a bunch of pointless #s in unified tests
Matt Mackall <mpm@selenic.com>
parents: 12327
diff changeset
   176
backout of merge with bad parent should fail
2614
8ba1c31f6864 backout: allow backout of merge changeset with --parent option.
Vadim Gelfer <vadim.gelfer@gmail.com>
parents: 2492
diff changeset
   177
11856
db969ebdebd9 tests: unify test-backout
Martin Geisler <mg@lazybytes.net>
parents: 8167
diff changeset
   178
  $ hg backout --parent 0 4
db969ebdebd9 tests: unify test-backout
Martin Geisler <mg@lazybytes.net>
parents: 8167
diff changeset
   179
  abort: cb9a9f314b8b is not a parent of b2f3bb92043e
12316
4134686b83e1 tests: add exit codes to unified tests
Matt Mackall <mpm@selenic.com>
parents: 11856
diff changeset
   180
  [255]
2614
8ba1c31f6864 backout: allow backout of merge changeset with --parent option.
Vadim Gelfer <vadim.gelfer@gmail.com>
parents: 2492
diff changeset
   181
12328
b63f6422d2a7 tests: fix a bunch of pointless #s in unified tests
Matt Mackall <mpm@selenic.com>
parents: 12327
diff changeset
   182
backout of non-merge with parent should fail
11856
db969ebdebd9 tests: unify test-backout
Martin Geisler <mg@lazybytes.net>
parents: 8167
diff changeset
   183
db969ebdebd9 tests: unify test-backout
Martin Geisler <mg@lazybytes.net>
parents: 8167
diff changeset
   184
  $ hg backout --parent 0 3
db969ebdebd9 tests: unify test-backout
Martin Geisler <mg@lazybytes.net>
parents: 8167
diff changeset
   185
  abort: cannot use --parent on non-merge changeset
12316
4134686b83e1 tests: add exit codes to unified tests
Matt Mackall <mpm@selenic.com>
parents: 11856
diff changeset
   186
  [255]
2614
8ba1c31f6864 backout: allow backout of merge changeset with --parent option.
Vadim Gelfer <vadim.gelfer@gmail.com>
parents: 2492
diff changeset
   187
12328
b63f6422d2a7 tests: fix a bunch of pointless #s in unified tests
Matt Mackall <mpm@selenic.com>
parents: 12327
diff changeset
   188
backout with valid parent should be ok
2614
8ba1c31f6864 backout: allow backout of merge changeset with --parent option.
Vadim Gelfer <vadim.gelfer@gmail.com>
parents: 2492
diff changeset
   189
11856
db969ebdebd9 tests: unify test-backout
Martin Geisler <mg@lazybytes.net>
parents: 8167
diff changeset
   190
  $ hg backout -d '5 0' --parent 2 4
db969ebdebd9 tests: unify test-backout
Martin Geisler <mg@lazybytes.net>
parents: 8167
diff changeset
   191
  removing d
db969ebdebd9 tests: unify test-backout
Martin Geisler <mg@lazybytes.net>
parents: 8167
diff changeset
   192
  changeset 5:10e5328c8435 backs out changeset 4:b2f3bb92043e
2614
8ba1c31f6864 backout: allow backout of merge changeset with --parent option.
Vadim Gelfer <vadim.gelfer@gmail.com>
parents: 2492
diff changeset
   193
11856
db969ebdebd9 tests: unify test-backout
Martin Geisler <mg@lazybytes.net>
parents: 8167
diff changeset
   194
  $ hg rollback
db969ebdebd9 tests: unify test-backout
Martin Geisler <mg@lazybytes.net>
parents: 8167
diff changeset
   195
  rolling back to revision 4 (undo commit)
db969ebdebd9 tests: unify test-backout
Martin Geisler <mg@lazybytes.net>
parents: 8167
diff changeset
   196
  $ hg update -C
db969ebdebd9 tests: unify test-backout
Martin Geisler <mg@lazybytes.net>
parents: 8167
diff changeset
   197
  1 files updated, 0 files merged, 0 files removed, 0 files unresolved
2614
8ba1c31f6864 backout: allow backout of merge changeset with --parent option.
Vadim Gelfer <vadim.gelfer@gmail.com>
parents: 2492
diff changeset
   198
11856
db969ebdebd9 tests: unify test-backout
Martin Geisler <mg@lazybytes.net>
parents: 8167
diff changeset
   199
  $ hg backout -d '6 0' --parent 3 4
db969ebdebd9 tests: unify test-backout
Martin Geisler <mg@lazybytes.net>
parents: 8167
diff changeset
   200
  removing c
db969ebdebd9 tests: unify test-backout
Martin Geisler <mg@lazybytes.net>
parents: 8167
diff changeset
   201
  changeset 5:033590168430 backs out changeset 4:b2f3bb92043e
6162
554715e584e6 Add test case for backout on named branches (issue665)
Thomas Arendsen Hein <thomas@intevation.de>
parents: 6161
diff changeset
   202
11856
db969ebdebd9 tests: unify test-backout
Martin Geisler <mg@lazybytes.net>
parents: 8167
diff changeset
   203
  $ cd ..
6162
554715e584e6 Add test case for backout on named branches (issue665)
Thomas Arendsen Hein <thomas@intevation.de>
parents: 6161
diff changeset
   204
12328
b63f6422d2a7 tests: fix a bunch of pointless #s in unified tests
Matt Mackall <mpm@selenic.com>
parents: 12327
diff changeset
   205
named branches
11856
db969ebdebd9 tests: unify test-backout
Martin Geisler <mg@lazybytes.net>
parents: 8167
diff changeset
   206
db969ebdebd9 tests: unify test-backout
Martin Geisler <mg@lazybytes.net>
parents: 8167
diff changeset
   207
  $ hg init named_branches
db969ebdebd9 tests: unify test-backout
Martin Geisler <mg@lazybytes.net>
parents: 8167
diff changeset
   208
  $ cd named_branches
6162
554715e584e6 Add test case for backout on named branches (issue665)
Thomas Arendsen Hein <thomas@intevation.de>
parents: 6161
diff changeset
   209
11856
db969ebdebd9 tests: unify test-backout
Martin Geisler <mg@lazybytes.net>
parents: 8167
diff changeset
   210
  $ echo default > default
db969ebdebd9 tests: unify test-backout
Martin Geisler <mg@lazybytes.net>
parents: 8167
diff changeset
   211
  $ hg ci -d '0 0' -Am default
db969ebdebd9 tests: unify test-backout
Martin Geisler <mg@lazybytes.net>
parents: 8167
diff changeset
   212
  adding default
db969ebdebd9 tests: unify test-backout
Martin Geisler <mg@lazybytes.net>
parents: 8167
diff changeset
   213
  $ hg branch branch1
db969ebdebd9 tests: unify test-backout
Martin Geisler <mg@lazybytes.net>
parents: 8167
diff changeset
   214
  marked working directory as branch branch1
db969ebdebd9 tests: unify test-backout
Martin Geisler <mg@lazybytes.net>
parents: 8167
diff changeset
   215
  $ echo branch1 > file1
db969ebdebd9 tests: unify test-backout
Martin Geisler <mg@lazybytes.net>
parents: 8167
diff changeset
   216
  $ hg ci -d '1 0' -Am file1
db969ebdebd9 tests: unify test-backout
Martin Geisler <mg@lazybytes.net>
parents: 8167
diff changeset
   217
  adding file1
db969ebdebd9 tests: unify test-backout
Martin Geisler <mg@lazybytes.net>
parents: 8167
diff changeset
   218
  $ hg branch branch2
db969ebdebd9 tests: unify test-backout
Martin Geisler <mg@lazybytes.net>
parents: 8167
diff changeset
   219
  marked working directory as branch branch2
db969ebdebd9 tests: unify test-backout
Martin Geisler <mg@lazybytes.net>
parents: 8167
diff changeset
   220
  $ echo branch2 > file2
db969ebdebd9 tests: unify test-backout
Martin Geisler <mg@lazybytes.net>
parents: 8167
diff changeset
   221
  $ hg ci -d '2 0' -Am file2
db969ebdebd9 tests: unify test-backout
Martin Geisler <mg@lazybytes.net>
parents: 8167
diff changeset
   222
  adding file2
db969ebdebd9 tests: unify test-backout
Martin Geisler <mg@lazybytes.net>
parents: 8167
diff changeset
   223
  $ hg backout -d '3 0' -r 1 -m 'backout on branch1'
db969ebdebd9 tests: unify test-backout
Martin Geisler <mg@lazybytes.net>
parents: 8167
diff changeset
   224
  removing file1
db969ebdebd9 tests: unify test-backout
Martin Geisler <mg@lazybytes.net>
parents: 8167
diff changeset
   225
  created new head
db969ebdebd9 tests: unify test-backout
Martin Geisler <mg@lazybytes.net>
parents: 8167
diff changeset
   226
  changeset 3:d4e8f6db59fb backs out changeset 1:bf1602f437f3
db969ebdebd9 tests: unify test-backout
Martin Geisler <mg@lazybytes.net>
parents: 8167
diff changeset
   227
  the backout changeset is a new head - do not forget to merge
db969ebdebd9 tests: unify test-backout
Martin Geisler <mg@lazybytes.net>
parents: 8167
diff changeset
   228
  (use "backout --merge" if you want to auto-merge)
db969ebdebd9 tests: unify test-backout
Martin Geisler <mg@lazybytes.net>
parents: 8167
diff changeset
   229
db969ebdebd9 tests: unify test-backout
Martin Geisler <mg@lazybytes.net>
parents: 8167
diff changeset
   230
XXX maybe backout shouldn't suggest a merge here as it is a different branch?
db969ebdebd9 tests: unify test-backout
Martin Geisler <mg@lazybytes.net>
parents: 8167
diff changeset
   231
db969ebdebd9 tests: unify test-backout
Martin Geisler <mg@lazybytes.net>
parents: 8167
diff changeset
   232
on branch2 with branch1 not merged, so file1 should still exist:
6162
554715e584e6 Add test case for backout on named branches (issue665)
Thomas Arendsen Hein <thomas@intevation.de>
parents: 6161
diff changeset
   233
11856
db969ebdebd9 tests: unify test-backout
Martin Geisler <mg@lazybytes.net>
parents: 8167
diff changeset
   234
  $ hg id
db969ebdebd9 tests: unify test-backout
Martin Geisler <mg@lazybytes.net>
parents: 8167
diff changeset
   235
  45bbcd363bf0 (branch2)
db969ebdebd9 tests: unify test-backout
Martin Geisler <mg@lazybytes.net>
parents: 8167
diff changeset
   236
  $ hg st -A
db969ebdebd9 tests: unify test-backout
Martin Geisler <mg@lazybytes.net>
parents: 8167
diff changeset
   237
  C default
db969ebdebd9 tests: unify test-backout
Martin Geisler <mg@lazybytes.net>
parents: 8167
diff changeset
   238
  C file1
db969ebdebd9 tests: unify test-backout
Martin Geisler <mg@lazybytes.net>
parents: 8167
diff changeset
   239
  C file2
db969ebdebd9 tests: unify test-backout
Martin Geisler <mg@lazybytes.net>
parents: 8167
diff changeset
   240
db969ebdebd9 tests: unify test-backout
Martin Geisler <mg@lazybytes.net>
parents: 8167
diff changeset
   241
on branch2 with branch1 merged, so file1 should be gone:
6162
554715e584e6 Add test case for backout on named branches (issue665)
Thomas Arendsen Hein <thomas@intevation.de>
parents: 6161
diff changeset
   242
11856
db969ebdebd9 tests: unify test-backout
Martin Geisler <mg@lazybytes.net>
parents: 8167
diff changeset
   243
  $ hg merge
db969ebdebd9 tests: unify test-backout
Martin Geisler <mg@lazybytes.net>
parents: 8167
diff changeset
   244
  0 files updated, 0 files merged, 1 files removed, 0 files unresolved
db969ebdebd9 tests: unify test-backout
Martin Geisler <mg@lazybytes.net>
parents: 8167
diff changeset
   245
  (branch merge, don't forget to commit)
db969ebdebd9 tests: unify test-backout
Martin Geisler <mg@lazybytes.net>
parents: 8167
diff changeset
   246
  $ hg ci -d '4 0' -m 'merge backout of branch1'
db969ebdebd9 tests: unify test-backout
Martin Geisler <mg@lazybytes.net>
parents: 8167
diff changeset
   247
  $ hg id
db969ebdebd9 tests: unify test-backout
Martin Geisler <mg@lazybytes.net>
parents: 8167
diff changeset
   248
  22149cdde76d (branch2) tip
db969ebdebd9 tests: unify test-backout
Martin Geisler <mg@lazybytes.net>
parents: 8167
diff changeset
   249
  $ hg st -A
db969ebdebd9 tests: unify test-backout
Martin Geisler <mg@lazybytes.net>
parents: 8167
diff changeset
   250
  C default
db969ebdebd9 tests: unify test-backout
Martin Geisler <mg@lazybytes.net>
parents: 8167
diff changeset
   251
  C file2
6162
554715e584e6 Add test case for backout on named branches (issue665)
Thomas Arendsen Hein <thomas@intevation.de>
parents: 6161
diff changeset
   252
11856
db969ebdebd9 tests: unify test-backout
Martin Geisler <mg@lazybytes.net>
parents: 8167
diff changeset
   253
on branch1, so no file1 and file2:
6162
554715e584e6 Add test case for backout on named branches (issue665)
Thomas Arendsen Hein <thomas@intevation.de>
parents: 6161
diff changeset
   254
11856
db969ebdebd9 tests: unify test-backout
Martin Geisler <mg@lazybytes.net>
parents: 8167
diff changeset
   255
  $ hg co -C branch1
db969ebdebd9 tests: unify test-backout
Martin Geisler <mg@lazybytes.net>
parents: 8167
diff changeset
   256
  1 files updated, 0 files merged, 1 files removed, 0 files unresolved
db969ebdebd9 tests: unify test-backout
Martin Geisler <mg@lazybytes.net>
parents: 8167
diff changeset
   257
  $ hg id
db969ebdebd9 tests: unify test-backout
Martin Geisler <mg@lazybytes.net>
parents: 8167
diff changeset
   258
  bf1602f437f3 (branch1)
db969ebdebd9 tests: unify test-backout
Martin Geisler <mg@lazybytes.net>
parents: 8167
diff changeset
   259
  $ hg st -A
db969ebdebd9 tests: unify test-backout
Martin Geisler <mg@lazybytes.net>
parents: 8167
diff changeset
   260
  C default
db969ebdebd9 tests: unify test-backout
Martin Geisler <mg@lazybytes.net>
parents: 8167
diff changeset
   261
  C file1