tests/test-rollback.t
author Martin Geisler <mg@aragost.com>
Mon, 28 Feb 2011 11:31:36 +0100
branchstable
changeset 13503 5007ff32f356
parent 13446 1e497df514e2
child 13956 ffb5c09ba822
child 13957 044e1356327d
permissions -rw-r--r--
eol: test win32text compatible encode/decode filters
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
336
aa6cbde09f72 Add some more tests
mpm@selenic.com
parents:
diff changeset
     1
12485
8fdc11fec6ae tests: unify test-rollback
Matt Mackall <mpm@selenic.com>
parents: 12156
diff changeset
     2
  $ mkdir t
8fdc11fec6ae tests: unify test-rollback
Matt Mackall <mpm@selenic.com>
parents: 12156
diff changeset
     3
  $ cd t
8fdc11fec6ae tests: unify test-rollback
Matt Mackall <mpm@selenic.com>
parents: 12156
diff changeset
     4
  $ hg init
8fdc11fec6ae tests: unify test-rollback
Matt Mackall <mpm@selenic.com>
parents: 12156
diff changeset
     5
  $ echo a > a
8fdc11fec6ae tests: unify test-rollback
Matt Mackall <mpm@selenic.com>
parents: 12156
diff changeset
     6
  $ hg add a
8fdc11fec6ae tests: unify test-rollback
Matt Mackall <mpm@selenic.com>
parents: 12156
diff changeset
     7
  $ hg commit -m "test"
8fdc11fec6ae tests: unify test-rollback
Matt Mackall <mpm@selenic.com>
parents: 12156
diff changeset
     8
  $ hg verify
8fdc11fec6ae tests: unify test-rollback
Matt Mackall <mpm@selenic.com>
parents: 12156
diff changeset
     9
  checking changesets
8fdc11fec6ae tests: unify test-rollback
Matt Mackall <mpm@selenic.com>
parents: 12156
diff changeset
    10
  checking manifests
8fdc11fec6ae tests: unify test-rollback
Matt Mackall <mpm@selenic.com>
parents: 12156
diff changeset
    11
  crosschecking files in changesets and manifests
8fdc11fec6ae tests: unify test-rollback
Matt Mackall <mpm@selenic.com>
parents: 12156
diff changeset
    12
  checking files
8fdc11fec6ae tests: unify test-rollback
Matt Mackall <mpm@selenic.com>
parents: 12156
diff changeset
    13
  1 files, 1 changesets, 1 total revisions
8fdc11fec6ae tests: unify test-rollback
Matt Mackall <mpm@selenic.com>
parents: 12156
diff changeset
    14
  $ hg parents
8fdc11fec6ae tests: unify test-rollback
Matt Mackall <mpm@selenic.com>
parents: 12156
diff changeset
    15
  changeset:   0:acb14030fe0a
8fdc11fec6ae tests: unify test-rollback
Matt Mackall <mpm@selenic.com>
parents: 12156
diff changeset
    16
  tag:         tip
8fdc11fec6ae tests: unify test-rollback
Matt Mackall <mpm@selenic.com>
parents: 12156
diff changeset
    17
  user:        test
8fdc11fec6ae tests: unify test-rollback
Matt Mackall <mpm@selenic.com>
parents: 12156
diff changeset
    18
  date:        Thu Jan 01 00:00:00 1970 +0000
8fdc11fec6ae tests: unify test-rollback
Matt Mackall <mpm@selenic.com>
parents: 12156
diff changeset
    19
  summary:     test
8fdc11fec6ae tests: unify test-rollback
Matt Mackall <mpm@selenic.com>
parents: 12156
diff changeset
    20
  
8fdc11fec6ae tests: unify test-rollback
Matt Mackall <mpm@selenic.com>
parents: 12156
diff changeset
    21
  $ hg status
8fdc11fec6ae tests: unify test-rollback
Matt Mackall <mpm@selenic.com>
parents: 12156
diff changeset
    22
  $ hg rollback
13446
1e497df514e2 rollback: clarifies the message about the reverted state (issue2628)
Gilles Moris <gilles.moris@free.fr>
parents: 13185
diff changeset
    23
  repository tip rolled back to revision -1 (undo commit)
1e497df514e2 rollback: clarifies the message about the reverted state (issue2628)
Gilles Moris <gilles.moris@free.fr>
parents: 13185
diff changeset
    24
  working directory now based on revision -1
12485
8fdc11fec6ae tests: unify test-rollback
Matt Mackall <mpm@selenic.com>
parents: 12156
diff changeset
    25
  $ hg verify
8fdc11fec6ae tests: unify test-rollback
Matt Mackall <mpm@selenic.com>
parents: 12156
diff changeset
    26
  checking changesets
8fdc11fec6ae tests: unify test-rollback
Matt Mackall <mpm@selenic.com>
parents: 12156
diff changeset
    27
  checking manifests
8fdc11fec6ae tests: unify test-rollback
Matt Mackall <mpm@selenic.com>
parents: 12156
diff changeset
    28
  crosschecking files in changesets and manifests
8fdc11fec6ae tests: unify test-rollback
Matt Mackall <mpm@selenic.com>
parents: 12156
diff changeset
    29
  checking files
8fdc11fec6ae tests: unify test-rollback
Matt Mackall <mpm@selenic.com>
parents: 12156
diff changeset
    30
  0 files, 0 changesets, 0 total revisions
8fdc11fec6ae tests: unify test-rollback
Matt Mackall <mpm@selenic.com>
parents: 12156
diff changeset
    31
  $ hg parents
8fdc11fec6ae tests: unify test-rollback
Matt Mackall <mpm@selenic.com>
parents: 12156
diff changeset
    32
  $ hg status
8fdc11fec6ae tests: unify test-rollback
Matt Mackall <mpm@selenic.com>
parents: 12156
diff changeset
    33
  A a
5814
dd5a501cb97f restore branch after rollback (issue 902)
Alexandre Vassalotti <mercurial-bugs@selenic.com>
parents: 2227
diff changeset
    34
12485
8fdc11fec6ae tests: unify test-rollback
Matt Mackall <mpm@selenic.com>
parents: 12156
diff changeset
    35
Test issue 902
8fdc11fec6ae tests: unify test-rollback
Matt Mackall <mpm@selenic.com>
parents: 12156
diff changeset
    36
8fdc11fec6ae tests: unify test-rollback
Matt Mackall <mpm@selenic.com>
parents: 12156
diff changeset
    37
  $ hg commit -m "test2"
8fdc11fec6ae tests: unify test-rollback
Matt Mackall <mpm@selenic.com>
parents: 12156
diff changeset
    38
  $ hg branch test
8fdc11fec6ae tests: unify test-rollback
Matt Mackall <mpm@selenic.com>
parents: 12156
diff changeset
    39
  marked working directory as branch test
8fdc11fec6ae tests: unify test-rollback
Matt Mackall <mpm@selenic.com>
parents: 12156
diff changeset
    40
  $ hg rollback
13446
1e497df514e2 rollback: clarifies the message about the reverted state (issue2628)
Gilles Moris <gilles.moris@free.fr>
parents: 13185
diff changeset
    41
  repository tip rolled back to revision -1 (undo commit)
1e497df514e2 rollback: clarifies the message about the reverted state (issue2628)
Gilles Moris <gilles.moris@free.fr>
parents: 13185
diff changeset
    42
  working directory now based on revision -1
12485
8fdc11fec6ae tests: unify test-rollback
Matt Mackall <mpm@selenic.com>
parents: 12156
diff changeset
    43
  $ hg branch
8fdc11fec6ae tests: unify test-rollback
Matt Mackall <mpm@selenic.com>
parents: 12156
diff changeset
    44
  default
8fdc11fec6ae tests: unify test-rollback
Matt Mackall <mpm@selenic.com>
parents: 12156
diff changeset
    45
8fdc11fec6ae tests: unify test-rollback
Matt Mackall <mpm@selenic.com>
parents: 12156
diff changeset
    46
Test issue 1635 (commit message saved)
8fdc11fec6ae tests: unify test-rollback
Matt Mackall <mpm@selenic.com>
parents: 12156
diff changeset
    47
.hg/last-message.txt:
6058
88b4d726332a Do not abort rollback if undo.branch isn't available, but warn.
Thomas Arendsen Hein <thomas@intevation.de>
parents: 5814
diff changeset
    48
12485
8fdc11fec6ae tests: unify test-rollback
Matt Mackall <mpm@selenic.com>
parents: 12156
diff changeset
    49
  $ cat .hg/last-message.txt ; echo
8fdc11fec6ae tests: unify test-rollback
Matt Mackall <mpm@selenic.com>
parents: 12156
diff changeset
    50
  test2
8fdc11fec6ae tests: unify test-rollback
Matt Mackall <mpm@selenic.com>
parents: 12156
diff changeset
    51
8fdc11fec6ae tests: unify test-rollback
Matt Mackall <mpm@selenic.com>
parents: 12156
diff changeset
    52
Test rollback of hg before issue 902 was fixed
9934
720f70b720d3 commit: save commit message so it's not destroyed by rollback.
Greg Ward <greg-hg@gerg.ca>
parents: 6058
diff changeset
    53
12485
8fdc11fec6ae tests: unify test-rollback
Matt Mackall <mpm@selenic.com>
parents: 12156
diff changeset
    54
  $ hg commit -m "test3"
8fdc11fec6ae tests: unify test-rollback
Matt Mackall <mpm@selenic.com>
parents: 12156
diff changeset
    55
  $ hg branch test
8fdc11fec6ae tests: unify test-rollback
Matt Mackall <mpm@selenic.com>
parents: 12156
diff changeset
    56
  marked working directory as branch test
8fdc11fec6ae tests: unify test-rollback
Matt Mackall <mpm@selenic.com>
parents: 12156
diff changeset
    57
  $ rm .hg/undo.branch
8fdc11fec6ae tests: unify test-rollback
Matt Mackall <mpm@selenic.com>
parents: 12156
diff changeset
    58
  $ hg rollback
13446
1e497df514e2 rollback: clarifies the message about the reverted state (issue2628)
Gilles Moris <gilles.moris@free.fr>
parents: 13185
diff changeset
    59
  repository tip rolled back to revision -1 (undo commit)
12485
8fdc11fec6ae tests: unify test-rollback
Matt Mackall <mpm@selenic.com>
parents: 12156
diff changeset
    60
  Named branch could not be reset, current branch still is: test
13446
1e497df514e2 rollback: clarifies the message about the reverted state (issue2628)
Gilles Moris <gilles.moris@free.fr>
parents: 13185
diff changeset
    61
  working directory now based on revision -1
12485
8fdc11fec6ae tests: unify test-rollback
Matt Mackall <mpm@selenic.com>
parents: 12156
diff changeset
    62
  $ hg branch
8fdc11fec6ae tests: unify test-rollback
Matt Mackall <mpm@selenic.com>
parents: 12156
diff changeset
    63
  test
8fdc11fec6ae tests: unify test-rollback
Matt Mackall <mpm@selenic.com>
parents: 12156
diff changeset
    64
8fdc11fec6ae tests: unify test-rollback
Matt Mackall <mpm@selenic.com>
parents: 12156
diff changeset
    65
rollback by pretxncommit saves commit message (issue 1635)
9934
720f70b720d3 commit: save commit message so it's not destroyed by rollback.
Greg Ward <greg-hg@gerg.ca>
parents: 6058
diff changeset
    66
12485
8fdc11fec6ae tests: unify test-rollback
Matt Mackall <mpm@selenic.com>
parents: 12156
diff changeset
    67
  $ echo a >> a
8fdc11fec6ae tests: unify test-rollback
Matt Mackall <mpm@selenic.com>
parents: 12156
diff changeset
    68
  $ hg --config hooks.pretxncommit=false commit -m"precious commit message"
8fdc11fec6ae tests: unify test-rollback
Matt Mackall <mpm@selenic.com>
parents: 12156
diff changeset
    69
  transaction abort!
8fdc11fec6ae tests: unify test-rollback
Matt Mackall <mpm@selenic.com>
parents: 12156
diff changeset
    70
  rollback completed
8fdc11fec6ae tests: unify test-rollback
Matt Mackall <mpm@selenic.com>
parents: 12156
diff changeset
    71
  abort: pretxncommit hook exited with status * (glob)
8fdc11fec6ae tests: unify test-rollback
Matt Mackall <mpm@selenic.com>
parents: 12156
diff changeset
    72
  [255]
8fdc11fec6ae tests: unify test-rollback
Matt Mackall <mpm@selenic.com>
parents: 12156
diff changeset
    73
8fdc11fec6ae tests: unify test-rollback
Matt Mackall <mpm@selenic.com>
parents: 12156
diff changeset
    74
.hg/last-message.txt:
9935
48b81d9bca8d commit: if relevant, tell user their commit message was saved.
Greg Ward <greg-hg@gerg.ca>
parents: 9934
diff changeset
    75
12485
8fdc11fec6ae tests: unify test-rollback
Matt Mackall <mpm@selenic.com>
parents: 12156
diff changeset
    76
  $ cat .hg/last-message.txt ; echo
8fdc11fec6ae tests: unify test-rollback
Matt Mackall <mpm@selenic.com>
parents: 12156
diff changeset
    77
  precious commit message
13185
c6e00dfcdcb8 tests: clean up test-rollback.t
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 12642
diff changeset
    78
c6e00dfcdcb8 tests: clean up test-rollback.t
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 12642
diff changeset
    79
same thing, but run $EDITOR
c6e00dfcdcb8 tests: clean up test-rollback.t
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 12642
diff changeset
    80
12642
bb35840e965c tests: remove the last traces of $HGTMP
Mads Kiilerich <mads@kiilerich.com>
parents: 12485
diff changeset
    81
  $ cat > editor << '__EOF__'
12485
8fdc11fec6ae tests: unify test-rollback
Matt Mackall <mpm@selenic.com>
parents: 12156
diff changeset
    82
  > #!/bin/sh
8fdc11fec6ae tests: unify test-rollback
Matt Mackall <mpm@selenic.com>
parents: 12156
diff changeset
    83
  > echo "another precious commit message" > "$1"
8fdc11fec6ae tests: unify test-rollback
Matt Mackall <mpm@selenic.com>
parents: 12156
diff changeset
    84
  > __EOF__
12642
bb35840e965c tests: remove the last traces of $HGTMP
Mads Kiilerich <mads@kiilerich.com>
parents: 12485
diff changeset
    85
  $ chmod +x editor
bb35840e965c tests: remove the last traces of $HGTMP
Mads Kiilerich <mads@kiilerich.com>
parents: 12485
diff changeset
    86
  $ HGEDITOR="'`pwd`'"/editor hg --config hooks.pretxncommit=false commit 2>&1
12485
8fdc11fec6ae tests: unify test-rollback
Matt Mackall <mpm@selenic.com>
parents: 12156
diff changeset
    87
  transaction abort!
8fdc11fec6ae tests: unify test-rollback
Matt Mackall <mpm@selenic.com>
parents: 12156
diff changeset
    88
  rollback completed
8fdc11fec6ae tests: unify test-rollback
Matt Mackall <mpm@selenic.com>
parents: 12156
diff changeset
    89
  note: commit message saved in .hg/last-message.txt
8fdc11fec6ae tests: unify test-rollback
Matt Mackall <mpm@selenic.com>
parents: 12156
diff changeset
    90
  abort: pretxncommit hook exited with status * (glob)
12642
bb35840e965c tests: remove the last traces of $HGTMP
Mads Kiilerich <mads@kiilerich.com>
parents: 12485
diff changeset
    91
  [255]
bb35840e965c tests: remove the last traces of $HGTMP
Mads Kiilerich <mads@kiilerich.com>
parents: 12485
diff changeset
    92
  $ cat .hg/last-message.txt
12485
8fdc11fec6ae tests: unify test-rollback
Matt Mackall <mpm@selenic.com>
parents: 12156
diff changeset
    93
  another precious commit message
8fdc11fec6ae tests: unify test-rollback
Matt Mackall <mpm@selenic.com>
parents: 12156
diff changeset
    94