tests/test-confused-revert.t
author Raphaël Gomès <rgomes@octobus.net>
Wed, 25 Jan 2023 15:34:27 +0100
changeset 50989 752c5a5b73c6
parent 49621 55c6ebd11cb9
permissions -rw-r--r--
admin-command: add verify command Start using the 'admin' namespace by adding a 'verify' command. Invocation is 'admin::verify'. The idea is to progressively add more focused checks than the existing verify command. To do so we need an advanced way to express what we want to check. The first check for admin::verify is 'working-copy.dirstate' which has no options, because it was an easy first check to implement, which verifies the integrity of the dirstate. This changeset was created with the help of Franck Bret.
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
49621
55c6ebd11cb9 tests: run many tests in $TESTTMP/repo instead of $TESTTMP
Arseniy Alekseyev <aalekseyev@janestreet.com>
parents: 45827
diff changeset
     1
  $ hg init repo
55c6ebd11cb9 tests: run many tests in $TESTTMP/repo instead of $TESTTMP
Arseniy Alekseyev <aalekseyev@janestreet.com>
parents: 45827
diff changeset
     2
  $ cd repo
12284
f7eb190310ef tests: unify test-confused-revert
Adrian Buehlmann <adrian@cadifra.com>
parents: 12156
diff changeset
     3
  $ echo foo > a
f7eb190310ef tests: unify test-confused-revert
Adrian Buehlmann <adrian@cadifra.com>
parents: 12156
diff changeset
     4
  $ hg add a
f7eb190310ef tests: unify test-confused-revert
Adrian Buehlmann <adrian@cadifra.com>
parents: 12156
diff changeset
     5
  $ hg commit -m "1"
1449
30146be3437c Add test-confused-revert, fix permissions on test-revert
Matt Mackall <mpm@selenic.com>
parents:
diff changeset
     6
12284
f7eb190310ef tests: unify test-confused-revert
Adrian Buehlmann <adrian@cadifra.com>
parents: 12156
diff changeset
     7
  $ echo bar > b
f7eb190310ef tests: unify test-confused-revert
Adrian Buehlmann <adrian@cadifra.com>
parents: 12156
diff changeset
     8
  $ hg add b
f7eb190310ef tests: unify test-confused-revert
Adrian Buehlmann <adrian@cadifra.com>
parents: 12156
diff changeset
     9
  $ hg remove a
1449
30146be3437c Add test-confused-revert, fix permissions on test-revert
Matt Mackall <mpm@selenic.com>
parents:
diff changeset
    10
12284
f7eb190310ef tests: unify test-confused-revert
Adrian Buehlmann <adrian@cadifra.com>
parents: 12156
diff changeset
    11
Should show a removed and b added:
f7eb190310ef tests: unify test-confused-revert
Adrian Buehlmann <adrian@cadifra.com>
parents: 12156
diff changeset
    12
f7eb190310ef tests: unify test-confused-revert
Adrian Buehlmann <adrian@cadifra.com>
parents: 12156
diff changeset
    13
  $ hg status
f7eb190310ef tests: unify test-confused-revert
Adrian Buehlmann <adrian@cadifra.com>
parents: 12156
diff changeset
    14
  A b
f7eb190310ef tests: unify test-confused-revert
Adrian Buehlmann <adrian@cadifra.com>
parents: 12156
diff changeset
    15
  R a
1449
30146be3437c Add test-confused-revert, fix permissions on test-revert
Matt Mackall <mpm@selenic.com>
parents:
diff changeset
    16
12284
f7eb190310ef tests: unify test-confused-revert
Adrian Buehlmann <adrian@cadifra.com>
parents: 12156
diff changeset
    17
  $ hg revert --all
39405
cb70501d8b71 revert: fix the inconsistency of status msgs in --interactive mode
Sushil khanchi <sushilkhanchi97@gmail.com>
parents: 28963
diff changeset
    18
  forgetting b
12284
f7eb190310ef tests: unify test-confused-revert
Adrian Buehlmann <adrian@cadifra.com>
parents: 12156
diff changeset
    19
  undeleting a
1449
30146be3437c Add test-confused-revert, fix permissions on test-revert
Matt Mackall <mpm@selenic.com>
parents:
diff changeset
    20
12284
f7eb190310ef tests: unify test-confused-revert
Adrian Buehlmann <adrian@cadifra.com>
parents: 12156
diff changeset
    21
Should show b unknown and a back to normal:
f7eb190310ef tests: unify test-confused-revert
Adrian Buehlmann <adrian@cadifra.com>
parents: 12156
diff changeset
    22
f7eb190310ef tests: unify test-confused-revert
Adrian Buehlmann <adrian@cadifra.com>
parents: 12156
diff changeset
    23
  $ hg status
f7eb190310ef tests: unify test-confused-revert
Adrian Buehlmann <adrian@cadifra.com>
parents: 12156
diff changeset
    24
  ? b
f7eb190310ef tests: unify test-confused-revert
Adrian Buehlmann <adrian@cadifra.com>
parents: 12156
diff changeset
    25
f7eb190310ef tests: unify test-confused-revert
Adrian Buehlmann <adrian@cadifra.com>
parents: 12156
diff changeset
    26
  $ rm b
1449
30146be3437c Add test-confused-revert, fix permissions on test-revert
Matt Mackall <mpm@selenic.com>
parents:
diff changeset
    27
12284
f7eb190310ef tests: unify test-confused-revert
Adrian Buehlmann <adrian@cadifra.com>
parents: 12156
diff changeset
    28
  $ hg co -C 0
f7eb190310ef tests: unify test-confused-revert
Adrian Buehlmann <adrian@cadifra.com>
parents: 12156
diff changeset
    29
  0 files updated, 0 files merged, 0 files removed, 0 files unresolved
f7eb190310ef tests: unify test-confused-revert
Adrian Buehlmann <adrian@cadifra.com>
parents: 12156
diff changeset
    30
  $ echo foo-a > a
f7eb190310ef tests: unify test-confused-revert
Adrian Buehlmann <adrian@cadifra.com>
parents: 12156
diff changeset
    31
  $ hg commit -m "2a"
1449
30146be3437c Add test-confused-revert, fix permissions on test-revert
Matt Mackall <mpm@selenic.com>
parents:
diff changeset
    32
12284
f7eb190310ef tests: unify test-confused-revert
Adrian Buehlmann <adrian@cadifra.com>
parents: 12156
diff changeset
    33
  $ hg co -C 0
f7eb190310ef tests: unify test-confused-revert
Adrian Buehlmann <adrian@cadifra.com>
parents: 12156
diff changeset
    34
  1 files updated, 0 files merged, 0 files removed, 0 files unresolved
f7eb190310ef tests: unify test-confused-revert
Adrian Buehlmann <adrian@cadifra.com>
parents: 12156
diff changeset
    35
  $ echo foo-b > a
f7eb190310ef tests: unify test-confused-revert
Adrian Buehlmann <adrian@cadifra.com>
parents: 12156
diff changeset
    36
  $ hg commit -m "2b"
f7eb190310ef tests: unify test-confused-revert
Adrian Buehlmann <adrian@cadifra.com>
parents: 12156
diff changeset
    37
  created new head
1449
30146be3437c Add test-confused-revert, fix permissions on test-revert
Matt Mackall <mpm@selenic.com>
parents:
diff changeset
    38
12284
f7eb190310ef tests: unify test-confused-revert
Adrian Buehlmann <adrian@cadifra.com>
parents: 12156
diff changeset
    39
  $ HGMERGE=true hg merge 1
f7eb190310ef tests: unify test-confused-revert
Adrian Buehlmann <adrian@cadifra.com>
parents: 12156
diff changeset
    40
  merging a
f7eb190310ef tests: unify test-confused-revert
Adrian Buehlmann <adrian@cadifra.com>
parents: 12156
diff changeset
    41
  0 files updated, 1 files merged, 0 files removed, 0 files unresolved
f7eb190310ef tests: unify test-confused-revert
Adrian Buehlmann <adrian@cadifra.com>
parents: 12156
diff changeset
    42
  (branch merge, don't forget to commit)
1449
30146be3437c Add test-confused-revert, fix permissions on test-revert
Matt Mackall <mpm@selenic.com>
parents:
diff changeset
    43
12284
f7eb190310ef tests: unify test-confused-revert
Adrian Buehlmann <adrian@cadifra.com>
parents: 12156
diff changeset
    44
Should show foo-b:
f7eb190310ef tests: unify test-confused-revert
Adrian Buehlmann <adrian@cadifra.com>
parents: 12156
diff changeset
    45
f7eb190310ef tests: unify test-confused-revert
Adrian Buehlmann <adrian@cadifra.com>
parents: 12156
diff changeset
    46
  $ cat a
f7eb190310ef tests: unify test-confused-revert
Adrian Buehlmann <adrian@cadifra.com>
parents: 12156
diff changeset
    47
  foo-b
1449
30146be3437c Add test-confused-revert, fix permissions on test-revert
Matt Mackall <mpm@selenic.com>
parents:
diff changeset
    48
12284
f7eb190310ef tests: unify test-confused-revert
Adrian Buehlmann <adrian@cadifra.com>
parents: 12156
diff changeset
    49
  $ echo bar > b
f7eb190310ef tests: unify test-confused-revert
Adrian Buehlmann <adrian@cadifra.com>
parents: 12156
diff changeset
    50
  $ hg add b
f7eb190310ef tests: unify test-confused-revert
Adrian Buehlmann <adrian@cadifra.com>
parents: 12156
diff changeset
    51
  $ rm a
f7eb190310ef tests: unify test-confused-revert
Adrian Buehlmann <adrian@cadifra.com>
parents: 12156
diff changeset
    52
  $ hg remove a
1449
30146be3437c Add test-confused-revert, fix permissions on test-revert
Matt Mackall <mpm@selenic.com>
parents:
diff changeset
    53
12284
f7eb190310ef tests: unify test-confused-revert
Adrian Buehlmann <adrian@cadifra.com>
parents: 12156
diff changeset
    54
Should show a removed and b added:
f7eb190310ef tests: unify test-confused-revert
Adrian Buehlmann <adrian@cadifra.com>
parents: 12156
diff changeset
    55
f7eb190310ef tests: unify test-confused-revert
Adrian Buehlmann <adrian@cadifra.com>
parents: 12156
diff changeset
    56
  $ hg status
f7eb190310ef tests: unify test-confused-revert
Adrian Buehlmann <adrian@cadifra.com>
parents: 12156
diff changeset
    57
  A b
f7eb190310ef tests: unify test-confused-revert
Adrian Buehlmann <adrian@cadifra.com>
parents: 12156
diff changeset
    58
  R a
1449
30146be3437c Add test-confused-revert, fix permissions on test-revert
Matt Mackall <mpm@selenic.com>
parents:
diff changeset
    59
12284
f7eb190310ef tests: unify test-confused-revert
Adrian Buehlmann <adrian@cadifra.com>
parents: 12156
diff changeset
    60
Revert should fail:
f7eb190310ef tests: unify test-confused-revert
Adrian Buehlmann <adrian@cadifra.com>
parents: 12156
diff changeset
    61
13022
3fd4e4e81382 revert: improve merge advice and favor its error over all
timeless <timeless@gmail.com>
parents: 12316
diff changeset
    62
  $ hg revert
14903
a934b9249574 revert: restore check for uncommitted merge (issue2915) (BC)
Matt Mackall <mpm@selenic.com>
parents: 14721
diff changeset
    63
  abort: uncommitted merge with no revision specified
28963
fc1d75e7a98d graft: use single quotes around command hint
timeless <timeless@mozdev.org>
parents: 14903
diff changeset
    64
  (use 'hg update' or see 'hg help revert')
45827
8d72e29ad1e0 errors: introduce InputError and use it from commands and cmdutil
Martin von Zweigbergk <martinvonz@google.com>
parents: 39405
diff changeset
    65
  [10]
1449
30146be3437c Add test-confused-revert, fix permissions on test-revert
Matt Mackall <mpm@selenic.com>
parents:
diff changeset
    66
12284
f7eb190310ef tests: unify test-confused-revert
Adrian Buehlmann <adrian@cadifra.com>
parents: 12156
diff changeset
    67
Revert should be ok now:
f7eb190310ef tests: unify test-confused-revert
Adrian Buehlmann <adrian@cadifra.com>
parents: 12156
diff changeset
    68
f7eb190310ef tests: unify test-confused-revert
Adrian Buehlmann <adrian@cadifra.com>
parents: 12156
diff changeset
    69
  $ hg revert -r2 --all
39405
cb70501d8b71 revert: fix the inconsistency of status msgs in --interactive mode
Sushil khanchi <sushilkhanchi97@gmail.com>
parents: 28963
diff changeset
    70
  forgetting b
12284
f7eb190310ef tests: unify test-confused-revert
Adrian Buehlmann <adrian@cadifra.com>
parents: 12156
diff changeset
    71
  undeleting a
1449
30146be3437c Add test-confused-revert, fix permissions on test-revert
Matt Mackall <mpm@selenic.com>
parents:
diff changeset
    72
12284
f7eb190310ef tests: unify test-confused-revert
Adrian Buehlmann <adrian@cadifra.com>
parents: 12156
diff changeset
    73
Should show b unknown and a marked modified (merged):
f7eb190310ef tests: unify test-confused-revert
Adrian Buehlmann <adrian@cadifra.com>
parents: 12156
diff changeset
    74
f7eb190310ef tests: unify test-confused-revert
Adrian Buehlmann <adrian@cadifra.com>
parents: 12156
diff changeset
    75
  $ hg status
f7eb190310ef tests: unify test-confused-revert
Adrian Buehlmann <adrian@cadifra.com>
parents: 12156
diff changeset
    76
  M a
f7eb190310ef tests: unify test-confused-revert
Adrian Buehlmann <adrian@cadifra.com>
parents: 12156
diff changeset
    77
  ? b
2214
6c6c0e5595a2 make test-confused-revert check working dir with two parents.
Vadim Gelfer <vadim.gelfer@gmail.com>
parents: 1933
diff changeset
    78
12284
f7eb190310ef tests: unify test-confused-revert
Adrian Buehlmann <adrian@cadifra.com>
parents: 12156
diff changeset
    79
Should show foo-b:
1449
30146be3437c Add test-confused-revert, fix permissions on test-revert
Matt Mackall <mpm@selenic.com>
parents:
diff changeset
    80
12284
f7eb190310ef tests: unify test-confused-revert
Adrian Buehlmann <adrian@cadifra.com>
parents: 12156
diff changeset
    81
  $ cat a
f7eb190310ef tests: unify test-confused-revert
Adrian Buehlmann <adrian@cadifra.com>
parents: 12156
diff changeset
    82
  foo-b
1449
30146be3437c Add test-confused-revert, fix permissions on test-revert
Matt Mackall <mpm@selenic.com>
parents:
diff changeset
    83