tests/test-confused-revert.t
author Matt Harbison <matt_harbison@yahoo.com>
Wed, 18 Sep 2024 17:50:57 -0400
changeset 51870 9d4ad05bc91c
parent 49621 55c6ebd11cb9
permissions -rw-r--r--
typing: make `bundlerepository` subclass `localrepository` while type checking Currently, `mercurial/bundlerepo.py` is excluded from pytype, mostly because it complains that various `ui` and `vfs` fields in `localrepository` are missing. (`bundlerepository` dynamically subclasses `localrepository` when it is instantiated, so it works at runtime.) This makes that class hierarchy known to pytype. Having a protocol for `Repository` is probably the right thing to do, but that will be a lot of work and this still reflects the class at runtime. Subclassing also has the benefit of making sure any method overrides have a matching signature, so maybe this is a situation where we do both of these things. (I'm not sure how clear the diagnostics are if a class *almost* implements a protocol, but is missing a method argument or similar.) The subclassing is not done outside of type checking runs to avoid any side effects on already complex code.
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