tests/test-revert.t
author Martin Geisler <mg@lazybytes.net>
Thu, 02 Sep 2010 23:22:51 +0200
changeset 12156 4c94b6d0fb1c
parent 12106 969176bec217
child 12316 4134686b83e1
permissions -rw-r--r--
tests: remove unneeded -d flags Many tests fixed the commit date of their changesets at '1000000 0' or similar. However testing with "Mon Jan 12 13:46:40 1970 +0000" is not better than testing with "Thu Jan 01 00:00:00 1970 +0000", which is the default run-tests.py installs. Removing the unnecessary flag removes some clutter and will hopefully make it clearer what the tests are really trying to test. Some tests did not even change their output when the dates were changed, in which case the -d flag was truly irrelevant. Dates used in sequence (such as '0 0', '1 0', etc...) were left alone since they may make the test easier to understand.
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
12106
969176bec217 tests: unify test-revert
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 6110
diff changeset
     1
  $ hg init repo
969176bec217 tests: unify test-revert
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 6110
diff changeset
     2
  $ cd repo
969176bec217 tests: unify test-revert
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 6110
diff changeset
     3
  $ echo 123 > a
969176bec217 tests: unify test-revert
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 6110
diff changeset
     4
  $ echo 123 > c
969176bec217 tests: unify test-revert
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 6110
diff changeset
     5
  $ echo 123 > e
969176bec217 tests: unify test-revert
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 6110
diff changeset
     6
  $ hg add a c e
12156
4c94b6d0fb1c tests: remove unneeded -d flags
Martin Geisler <mg@lazybytes.net>
parents: 12106
diff changeset
     7
  $ hg commit -m "first" a c e
12106
969176bec217 tests: unify test-revert
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 6110
diff changeset
     8
  $ echo 123 > b
969176bec217 tests: unify test-revert
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 6110
diff changeset
     9
969176bec217 tests: unify test-revert
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 6110
diff changeset
    10
should show b unknown
969176bec217 tests: unify test-revert
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 6110
diff changeset
    11
969176bec217 tests: unify test-revert
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 6110
diff changeset
    12
  $ hg status
969176bec217 tests: unify test-revert
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 6110
diff changeset
    13
  ? b
969176bec217 tests: unify test-revert
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 6110
diff changeset
    14
  $ echo 12 > c
969176bec217 tests: unify test-revert
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 6110
diff changeset
    15
969176bec217 tests: unify test-revert
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 6110
diff changeset
    16
should show b unknown and c modified
969176bec217 tests: unify test-revert
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 6110
diff changeset
    17
969176bec217 tests: unify test-revert
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 6110
diff changeset
    18
  $ hg status
969176bec217 tests: unify test-revert
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 6110
diff changeset
    19
  M c
969176bec217 tests: unify test-revert
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 6110
diff changeset
    20
  ? b
969176bec217 tests: unify test-revert
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 6110
diff changeset
    21
  $ hg add b
969176bec217 tests: unify test-revert
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 6110
diff changeset
    22
969176bec217 tests: unify test-revert
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 6110
diff changeset
    23
should show b added and c modified
969176bec217 tests: unify test-revert
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 6110
diff changeset
    24
969176bec217 tests: unify test-revert
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 6110
diff changeset
    25
  $ hg status
969176bec217 tests: unify test-revert
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 6110
diff changeset
    26
  M c
969176bec217 tests: unify test-revert
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 6110
diff changeset
    27
  A b
969176bec217 tests: unify test-revert
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 6110
diff changeset
    28
  $ hg rm a
969176bec217 tests: unify test-revert
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 6110
diff changeset
    29
969176bec217 tests: unify test-revert
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 6110
diff changeset
    30
should show a removed, b added and c modified
969176bec217 tests: unify test-revert
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 6110
diff changeset
    31
969176bec217 tests: unify test-revert
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 6110
diff changeset
    32
  $ hg status
969176bec217 tests: unify test-revert
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 6110
diff changeset
    33
  M c
969176bec217 tests: unify test-revert
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 6110
diff changeset
    34
  A b
969176bec217 tests: unify test-revert
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 6110
diff changeset
    35
  R a
969176bec217 tests: unify test-revert
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 6110
diff changeset
    36
  $ hg revert a
969176bec217 tests: unify test-revert
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 6110
diff changeset
    37
969176bec217 tests: unify test-revert
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 6110
diff changeset
    38
should show b added, copy saved, and c modified
969176bec217 tests: unify test-revert
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 6110
diff changeset
    39
969176bec217 tests: unify test-revert
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 6110
diff changeset
    40
  $ hg status
969176bec217 tests: unify test-revert
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 6110
diff changeset
    41
  M c
969176bec217 tests: unify test-revert
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 6110
diff changeset
    42
  A b
969176bec217 tests: unify test-revert
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 6110
diff changeset
    43
  $ hg revert b
969176bec217 tests: unify test-revert
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 6110
diff changeset
    44
969176bec217 tests: unify test-revert
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 6110
diff changeset
    45
should show b unknown, and c modified
969176bec217 tests: unify test-revert
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 6110
diff changeset
    46
969176bec217 tests: unify test-revert
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 6110
diff changeset
    47
  $ hg status
969176bec217 tests: unify test-revert
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 6110
diff changeset
    48
  M c
969176bec217 tests: unify test-revert
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 6110
diff changeset
    49
  ? b
969176bec217 tests: unify test-revert
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 6110
diff changeset
    50
  $ hg revert --no-backup c
969176bec217 tests: unify test-revert
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 6110
diff changeset
    51
969176bec217 tests: unify test-revert
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 6110
diff changeset
    52
should show unknown: b
969176bec217 tests: unify test-revert
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 6110
diff changeset
    53
969176bec217 tests: unify test-revert
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 6110
diff changeset
    54
  $ hg status
969176bec217 tests: unify test-revert
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 6110
diff changeset
    55
  ? b
969176bec217 tests: unify test-revert
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 6110
diff changeset
    56
  $ hg add b
969176bec217 tests: unify test-revert
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 6110
diff changeset
    57
969176bec217 tests: unify test-revert
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 6110
diff changeset
    58
should show b added
969176bec217 tests: unify test-revert
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 6110
diff changeset
    59
969176bec217 tests: unify test-revert
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 6110
diff changeset
    60
  $ hg status b
969176bec217 tests: unify test-revert
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 6110
diff changeset
    61
  A b
969176bec217 tests: unify test-revert
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 6110
diff changeset
    62
  $ rm b
969176bec217 tests: unify test-revert
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 6110
diff changeset
    63
969176bec217 tests: unify test-revert
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 6110
diff changeset
    64
should show b deleted
1447
508a3f559553 revert added and removed files to their normal state before reverting
Benoit Boissinot <benoit.boissinot@ens-lyon.org>
parents:
diff changeset
    65
12106
969176bec217 tests: unify test-revert
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 6110
diff changeset
    66
  $ hg status b
969176bec217 tests: unify test-revert
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 6110
diff changeset
    67
  ! b
969176bec217 tests: unify test-revert
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 6110
diff changeset
    68
  $ hg revert -v b
969176bec217 tests: unify test-revert
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 6110
diff changeset
    69
  forgetting b
969176bec217 tests: unify test-revert
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 6110
diff changeset
    70
969176bec217 tests: unify test-revert
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 6110
diff changeset
    71
should not find b
969176bec217 tests: unify test-revert
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 6110
diff changeset
    72
969176bec217 tests: unify test-revert
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 6110
diff changeset
    73
  $ hg status b
969176bec217 tests: unify test-revert
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 6110
diff changeset
    74
  b: No such file or directory
969176bec217 tests: unify test-revert
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 6110
diff changeset
    75
969176bec217 tests: unify test-revert
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 6110
diff changeset
    76
should show a c e
969176bec217 tests: unify test-revert
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 6110
diff changeset
    77
969176bec217 tests: unify test-revert
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 6110
diff changeset
    78
  $ ls
969176bec217 tests: unify test-revert
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 6110
diff changeset
    79
  a
969176bec217 tests: unify test-revert
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 6110
diff changeset
    80
  c
969176bec217 tests: unify test-revert
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 6110
diff changeset
    81
  e
969176bec217 tests: unify test-revert
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 6110
diff changeset
    82
969176bec217 tests: unify test-revert
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 6110
diff changeset
    83
should verbosely save backup to e.orig
969176bec217 tests: unify test-revert
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 6110
diff changeset
    84
969176bec217 tests: unify test-revert
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 6110
diff changeset
    85
  $ echo z > e
969176bec217 tests: unify test-revert
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 6110
diff changeset
    86
  $ hg revert --all -v
969176bec217 tests: unify test-revert
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 6110
diff changeset
    87
  saving current version of e as e.orig
969176bec217 tests: unify test-revert
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 6110
diff changeset
    88
  reverting e
969176bec217 tests: unify test-revert
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 6110
diff changeset
    89
969176bec217 tests: unify test-revert
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 6110
diff changeset
    90
should say no changes needed
969176bec217 tests: unify test-revert
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 6110
diff changeset
    91
969176bec217 tests: unify test-revert
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 6110
diff changeset
    92
  $ hg revert a
969176bec217 tests: unify test-revert
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 6110
diff changeset
    93
  no changes needed to a
969176bec217 tests: unify test-revert
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 6110
diff changeset
    94
969176bec217 tests: unify test-revert
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 6110
diff changeset
    95
should say file not managed
969176bec217 tests: unify test-revert
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 6110
diff changeset
    96
969176bec217 tests: unify test-revert
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 6110
diff changeset
    97
  $ echo q > q
969176bec217 tests: unify test-revert
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 6110
diff changeset
    98
  $ hg revert q
969176bec217 tests: unify test-revert
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 6110
diff changeset
    99
  file not managed: q
969176bec217 tests: unify test-revert
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 6110
diff changeset
   100
  $ rm q
969176bec217 tests: unify test-revert
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 6110
diff changeset
   101
969176bec217 tests: unify test-revert
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 6110
diff changeset
   102
should say file not found
969176bec217 tests: unify test-revert
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 6110
diff changeset
   103
969176bec217 tests: unify test-revert
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 6110
diff changeset
   104
  $ hg revert notfound
12156
4c94b6d0fb1c tests: remove unneeded -d flags
Martin Geisler <mg@lazybytes.net>
parents: 12106
diff changeset
   105
  notfound: no such file in rev 334a9e57682c
12106
969176bec217 tests: unify test-revert
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 6110
diff changeset
   106
  $ touch d
969176bec217 tests: unify test-revert
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 6110
diff changeset
   107
  $ hg add d
969176bec217 tests: unify test-revert
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 6110
diff changeset
   108
  $ hg rm a
12156
4c94b6d0fb1c tests: remove unneeded -d flags
Martin Geisler <mg@lazybytes.net>
parents: 12106
diff changeset
   109
  $ hg commit -m "second"
12106
969176bec217 tests: unify test-revert
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 6110
diff changeset
   110
  $ echo z > z
969176bec217 tests: unify test-revert
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 6110
diff changeset
   111
  $ hg add z
969176bec217 tests: unify test-revert
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 6110
diff changeset
   112
  $ hg st
969176bec217 tests: unify test-revert
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 6110
diff changeset
   113
  A z
969176bec217 tests: unify test-revert
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 6110
diff changeset
   114
  ? e.orig
969176bec217 tests: unify test-revert
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 6110
diff changeset
   115
969176bec217 tests: unify test-revert
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 6110
diff changeset
   116
should add a, remove d, forget z
969176bec217 tests: unify test-revert
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 6110
diff changeset
   117
969176bec217 tests: unify test-revert
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 6110
diff changeset
   118
  $ hg revert --all -r0
969176bec217 tests: unify test-revert
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 6110
diff changeset
   119
  adding a
969176bec217 tests: unify test-revert
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 6110
diff changeset
   120
  removing d
969176bec217 tests: unify test-revert
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 6110
diff changeset
   121
  forgetting z
969176bec217 tests: unify test-revert
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 6110
diff changeset
   122
969176bec217 tests: unify test-revert
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 6110
diff changeset
   123
should forget a, undelete d
969176bec217 tests: unify test-revert
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 6110
diff changeset
   124
969176bec217 tests: unify test-revert
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 6110
diff changeset
   125
  $ hg revert --all -rtip
969176bec217 tests: unify test-revert
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 6110
diff changeset
   126
  forgetting a
969176bec217 tests: unify test-revert
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 6110
diff changeset
   127
  undeleting d
969176bec217 tests: unify test-revert
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 6110
diff changeset
   128
  $ rm a *.orig
969176bec217 tests: unify test-revert
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 6110
diff changeset
   129
969176bec217 tests: unify test-revert
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 6110
diff changeset
   130
should silently add a
1447
508a3f559553 revert added and removed files to their normal state before reverting
Benoit Boissinot <benoit.boissinot@ens-lyon.org>
parents:
diff changeset
   131
12106
969176bec217 tests: unify test-revert
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 6110
diff changeset
   132
  $ hg revert -r0 a
969176bec217 tests: unify test-revert
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 6110
diff changeset
   133
  $ hg st a
969176bec217 tests: unify test-revert
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 6110
diff changeset
   134
  A a
969176bec217 tests: unify test-revert
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 6110
diff changeset
   135
  $ hg rm d
969176bec217 tests: unify test-revert
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 6110
diff changeset
   136
  $ hg st d
969176bec217 tests: unify test-revert
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 6110
diff changeset
   137
  R d
969176bec217 tests: unify test-revert
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 6110
diff changeset
   138
969176bec217 tests: unify test-revert
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 6110
diff changeset
   139
should silently keep d removed
969176bec217 tests: unify test-revert
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 6110
diff changeset
   140
969176bec217 tests: unify test-revert
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 6110
diff changeset
   141
  $ hg revert -r0 d
969176bec217 tests: unify test-revert
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 6110
diff changeset
   142
  $ hg st d
969176bec217 tests: unify test-revert
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 6110
diff changeset
   143
  R d
2157
1e82f2337498 make test-revert check executable bit.
Vadim Gelfer <vadim.gelfer@gmail.com>
parents: 2043
diff changeset
   144
12106
969176bec217 tests: unify test-revert
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 6110
diff changeset
   145
  $ hg update -C
969176bec217 tests: unify test-revert
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 6110
diff changeset
   146
  1 files updated, 0 files merged, 0 files removed, 0 files unresolved
969176bec217 tests: unify test-revert
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 6110
diff changeset
   147
  $ chmod +x c
969176bec217 tests: unify test-revert
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 6110
diff changeset
   148
  $ hg revert --all
969176bec217 tests: unify test-revert
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 6110
diff changeset
   149
  reverting c
969176bec217 tests: unify test-revert
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 6110
diff changeset
   150
969176bec217 tests: unify test-revert
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 6110
diff changeset
   151
should print non-executable
2157
1e82f2337498 make test-revert check executable bit.
Vadim Gelfer <vadim.gelfer@gmail.com>
parents: 2043
diff changeset
   152
12106
969176bec217 tests: unify test-revert
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 6110
diff changeset
   153
  $ test -x c || echo non-executable
969176bec217 tests: unify test-revert
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 6110
diff changeset
   154
  non-executable
969176bec217 tests: unify test-revert
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 6110
diff changeset
   155
969176bec217 tests: unify test-revert
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 6110
diff changeset
   156
  $ chmod +x c
12156
4c94b6d0fb1c tests: remove unneeded -d flags
Martin Geisler <mg@lazybytes.net>
parents: 12106
diff changeset
   157
  $ hg commit -m exe
2157
1e82f2337498 make test-revert check executable bit.
Vadim Gelfer <vadim.gelfer@gmail.com>
parents: 2043
diff changeset
   158
12106
969176bec217 tests: unify test-revert
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 6110
diff changeset
   159
  $ chmod -x c
969176bec217 tests: unify test-revert
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 6110
diff changeset
   160
  $ hg revert --all
969176bec217 tests: unify test-revert
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 6110
diff changeset
   161
  reverting c
969176bec217 tests: unify test-revert
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 6110
diff changeset
   162
969176bec217 tests: unify test-revert
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 6110
diff changeset
   163
should print executable
6031
7383384793fb revert: don't assume ignored files will be returned in the unknown list
Alexis S. L. Carvalho <alexis@cecm.usp.br>
parents: 5230
diff changeset
   164
12106
969176bec217 tests: unify test-revert
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 6110
diff changeset
   165
  $ test -x c && echo executable
969176bec217 tests: unify test-revert
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 6110
diff changeset
   166
  executable
969176bec217 tests: unify test-revert
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 6110
diff changeset
   167
969176bec217 tests: unify test-revert
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 6110
diff changeset
   168
  $ cd ..
969176bec217 tests: unify test-revert
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 6110
diff changeset
   169
969176bec217 tests: unify test-revert
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 6110
diff changeset
   170
969176bec217 tests: unify test-revert
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 6110
diff changeset
   171
issue 241
2982
890e285c52a1 revert: require --all to revert all files.
Vadim Gelfer <vadim.gelfer@gmail.com>
parents: 2272
diff changeset
   172
12106
969176bec217 tests: unify test-revert
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 6110
diff changeset
   173
  $ hg init a
969176bec217 tests: unify test-revert
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 6110
diff changeset
   174
  $ cd a
969176bec217 tests: unify test-revert
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 6110
diff changeset
   175
  $ echo a >> a
969176bec217 tests: unify test-revert
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 6110
diff changeset
   176
  $ hg commit -A -d '1 0' -m a
969176bec217 tests: unify test-revert
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 6110
diff changeset
   177
  adding a
969176bec217 tests: unify test-revert
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 6110
diff changeset
   178
  $ echo a >> a
969176bec217 tests: unify test-revert
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 6110
diff changeset
   179
  $ hg commit -d '2 0' -m a
969176bec217 tests: unify test-revert
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 6110
diff changeset
   180
  $ hg update 0
969176bec217 tests: unify test-revert
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 6110
diff changeset
   181
  1 files updated, 0 files merged, 0 files removed, 0 files unresolved
969176bec217 tests: unify test-revert
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 6110
diff changeset
   182
  $ mkdir b
969176bec217 tests: unify test-revert
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 6110
diff changeset
   183
  $ echo b > b/b
2272
e9a0ed9ed4d9 revert: fix corner case found by faheem mitha.
Vadim Gelfer <vadim.gelfer@gmail.com>
parents: 2157
diff changeset
   184
12106
969176bec217 tests: unify test-revert
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 6110
diff changeset
   185
should fail - no arguments
969176bec217 tests: unify test-revert
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 6110
diff changeset
   186
969176bec217 tests: unify test-revert
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 6110
diff changeset
   187
  $ hg revert -rtip
969176bec217 tests: unify test-revert
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 6110
diff changeset
   188
  abort: no files or directories specified; use --all to revert the whole repo
969176bec217 tests: unify test-revert
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 6110
diff changeset
   189
969176bec217 tests: unify test-revert
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 6110
diff changeset
   190
should succeed
969176bec217 tests: unify test-revert
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 6110
diff changeset
   191
969176bec217 tests: unify test-revert
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 6110
diff changeset
   192
  $ hg revert --all -rtip
969176bec217 tests: unify test-revert
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 6110
diff changeset
   193
  reverting a
969176bec217 tests: unify test-revert
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 6110
diff changeset
   194
969176bec217 tests: unify test-revert
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 6110
diff changeset
   195
969176bec217 tests: unify test-revert
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 6110
diff changeset
   196
issue332
2982
890e285c52a1 revert: require --all to revert all files.
Vadim Gelfer <vadim.gelfer@gmail.com>
parents: 2272
diff changeset
   197
12156
4c94b6d0fb1c tests: remove unneeded -d flags
Martin Geisler <mg@lazybytes.net>
parents: 12106
diff changeset
   198
  $ hg ci -A -m b
12106
969176bec217 tests: unify test-revert
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 6110
diff changeset
   199
  adding b/b
969176bec217 tests: unify test-revert
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 6110
diff changeset
   200
  created new head
969176bec217 tests: unify test-revert
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 6110
diff changeset
   201
  $ echo foobar > b/b
969176bec217 tests: unify test-revert
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 6110
diff changeset
   202
  $ mkdir newdir
969176bec217 tests: unify test-revert
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 6110
diff changeset
   203
  $ echo foo > newdir/newfile
969176bec217 tests: unify test-revert
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 6110
diff changeset
   204
  $ hg add newdir/newfile
969176bec217 tests: unify test-revert
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 6110
diff changeset
   205
  $ hg revert b newdir
969176bec217 tests: unify test-revert
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 6110
diff changeset
   206
  reverting b/b
969176bec217 tests: unify test-revert
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 6110
diff changeset
   207
  forgetting newdir/newfile
969176bec217 tests: unify test-revert
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 6110
diff changeset
   208
  $ echo foobar > b/b
969176bec217 tests: unify test-revert
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 6110
diff changeset
   209
  $ hg revert .
969176bec217 tests: unify test-revert
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 6110
diff changeset
   210
  reverting b/b
969176bec217 tests: unify test-revert
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 6110
diff changeset
   211
5230
bfd73b567b3d When reverting a file which was renamed, also revert the old name
Brendan Cully <brendan@kublai.com>
parents: 4237
diff changeset
   212
12106
969176bec217 tests: unify test-revert
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 6110
diff changeset
   213
reverting a rename target should revert the source
969176bec217 tests: unify test-revert
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 6110
diff changeset
   214
969176bec217 tests: unify test-revert
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 6110
diff changeset
   215
  $ hg mv a newa
969176bec217 tests: unify test-revert
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 6110
diff changeset
   216
  $ hg revert newa
969176bec217 tests: unify test-revert
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 6110
diff changeset
   217
  $ hg st a newa
969176bec217 tests: unify test-revert
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 6110
diff changeset
   218
  ? newa
5230
bfd73b567b3d When reverting a file which was renamed, also revert the old name
Brendan Cully <brendan@kublai.com>
parents: 4237
diff changeset
   219
12106
969176bec217 tests: unify test-revert
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 6110
diff changeset
   220
  $ cd ..
6031
7383384793fb revert: don't assume ignored files will be returned in the unknown list
Alexis S. L. Carvalho <alexis@cecm.usp.br>
parents: 5230
diff changeset
   221
12106
969176bec217 tests: unify test-revert
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 6110
diff changeset
   222
  $ hg init ignored
969176bec217 tests: unify test-revert
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 6110
diff changeset
   223
  $ cd ignored
969176bec217 tests: unify test-revert
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 6110
diff changeset
   224
  $ echo '^ignored$' > .hgignore
969176bec217 tests: unify test-revert
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 6110
diff changeset
   225
  $ echo '^ignoreddir$' >> .hgignore
969176bec217 tests: unify test-revert
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 6110
diff changeset
   226
  $ echo '^removed$' >> .hgignore
6031
7383384793fb revert: don't assume ignored files will be returned in the unknown list
Alexis S. L. Carvalho <alexis@cecm.usp.br>
parents: 5230
diff changeset
   227
12106
969176bec217 tests: unify test-revert
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 6110
diff changeset
   228
  $ mkdir ignoreddir
969176bec217 tests: unify test-revert
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 6110
diff changeset
   229
  $ touch ignoreddir/file
969176bec217 tests: unify test-revert
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 6110
diff changeset
   230
  $ touch ignoreddir/removed
969176bec217 tests: unify test-revert
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 6110
diff changeset
   231
  $ touch ignored
969176bec217 tests: unify test-revert
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 6110
diff changeset
   232
  $ touch removed
969176bec217 tests: unify test-revert
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 6110
diff changeset
   233
969176bec217 tests: unify test-revert
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 6110
diff changeset
   234
4 ignored files (we will add/commit everything)
969176bec217 tests: unify test-revert
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 6110
diff changeset
   235
969176bec217 tests: unify test-revert
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 6110
diff changeset
   236
  $ hg st -A -X .hgignore
969176bec217 tests: unify test-revert
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 6110
diff changeset
   237
  I ignored
969176bec217 tests: unify test-revert
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 6110
diff changeset
   238
  I ignoreddir/file
969176bec217 tests: unify test-revert
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 6110
diff changeset
   239
  I ignoreddir/removed
969176bec217 tests: unify test-revert
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 6110
diff changeset
   240
  I removed
969176bec217 tests: unify test-revert
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 6110
diff changeset
   241
  $ hg ci -qAm 'add files' ignored ignoreddir/file ignoreddir/removed removed
6031
7383384793fb revert: don't assume ignored files will be returned in the unknown list
Alexis S. L. Carvalho <alexis@cecm.usp.br>
parents: 5230
diff changeset
   242
12106
969176bec217 tests: unify test-revert
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 6110
diff changeset
   243
  $ echo >> ignored
969176bec217 tests: unify test-revert
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 6110
diff changeset
   244
  $ echo >> ignoreddir/file
969176bec217 tests: unify test-revert
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 6110
diff changeset
   245
  $ hg rm removed ignoreddir/removed
969176bec217 tests: unify test-revert
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 6110
diff changeset
   246
969176bec217 tests: unify test-revert
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 6110
diff changeset
   247
should revert ignored* and undelete *removed
6031
7383384793fb revert: don't assume ignored files will be returned in the unknown list
Alexis S. L. Carvalho <alexis@cecm.usp.br>
parents: 5230
diff changeset
   248
12106
969176bec217 tests: unify test-revert
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 6110
diff changeset
   249
  $ hg revert -a --no-backup
969176bec217 tests: unify test-revert
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 6110
diff changeset
   250
  reverting ignored
969176bec217 tests: unify test-revert
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 6110
diff changeset
   251
  reverting ignoreddir/file
969176bec217 tests: unify test-revert
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 6110
diff changeset
   252
  undeleting ignoreddir/removed
969176bec217 tests: unify test-revert
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 6110
diff changeset
   253
  undeleting removed
969176bec217 tests: unify test-revert
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 6110
diff changeset
   254
  $ hg st -mardi
969176bec217 tests: unify test-revert
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 6110
diff changeset
   255
969176bec217 tests: unify test-revert
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 6110
diff changeset
   256
  $ hg up -qC
969176bec217 tests: unify test-revert
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 6110
diff changeset
   257
  $ echo >> ignored
969176bec217 tests: unify test-revert
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 6110
diff changeset
   258
  $ hg rm removed
969176bec217 tests: unify test-revert
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 6110
diff changeset
   259
969176bec217 tests: unify test-revert
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 6110
diff changeset
   260
should silently revert the named files
969176bec217 tests: unify test-revert
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 6110
diff changeset
   261
969176bec217 tests: unify test-revert
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 6110
diff changeset
   262
  $ hg revert --no-backup ignored removed
969176bec217 tests: unify test-revert
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 6110
diff changeset
   263
  $ hg st -mardi