tests/test-revert-interactive-curses.t
author Matt Harbison <matt_harbison@yahoo.com>
Tue, 25 Apr 2023 17:49:35 -0400
branchstable
changeset 50359 f4ff55583dec
parent 49034 079197e94b24
permissions -rw-r--r--
fix: highlight the required configuration and behavior of the fixer tools The problem is that `hg help fix` didn't mention *how* to configure the tools, and while I knew that `{rootpath}` existed in the configuration, I missed that the tools require reading content from stdin. (I configured `gofmt` to use `{rootpath}`, and that had the effect of squashing all changes in a file at `.` into the first commit and emptying that content from its descendants.) Basically all this does is put a pointer in the default (command level) help to the extension level help that mentions the configuration, and moves the extension level help that documents reading from stdin and writing to stdout to the top to give it more prominence. The last sentence is adjusted a bit to reflect the new location.
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
46325
e5e6282fa66a hghave: split apart testing for the curses module and `tic` executable
Matt Harbison <matt_harbison@yahoo.com>
parents: 45153
diff changeset
     1
#require curses
49033
9a5d09d7f108 crecord: add test demonstrating issue when reverting noeol->eol change
Kyle Lippincott <spectral@google.com>
parents: 46325
diff changeset
     2
#testcases committed wdir
45153
8b6a446508c2 revert: fix interactive reverting of end-of-file newline changes
Rodrigo Damazio Bovendorp <rdamazio@google.com>
parents:
diff changeset
     3
8b6a446508c2 revert: fix interactive reverting of end-of-file newline changes
Rodrigo Damazio Bovendorp <rdamazio@google.com>
parents:
diff changeset
     4
Revert interactive tests with the Curses interface
8b6a446508c2 revert: fix interactive reverting of end-of-file newline changes
Rodrigo Damazio Bovendorp <rdamazio@google.com>
parents:
diff changeset
     5
8b6a446508c2 revert: fix interactive reverting of end-of-file newline changes
Rodrigo Damazio Bovendorp <rdamazio@google.com>
parents:
diff changeset
     6
  $ cat <<EOF >> $HGRCPATH
8b6a446508c2 revert: fix interactive reverting of end-of-file newline changes
Rodrigo Damazio Bovendorp <rdamazio@google.com>
parents:
diff changeset
     7
  > [ui]
8b6a446508c2 revert: fix interactive reverting of end-of-file newline changes
Rodrigo Damazio Bovendorp <rdamazio@google.com>
parents:
diff changeset
     8
  > interactive = true
8b6a446508c2 revert: fix interactive reverting of end-of-file newline changes
Rodrigo Damazio Bovendorp <rdamazio@google.com>
parents:
diff changeset
     9
  > interface = curses
8b6a446508c2 revert: fix interactive reverting of end-of-file newline changes
Rodrigo Damazio Bovendorp <rdamazio@google.com>
parents:
diff changeset
    10
  > [experimental]
8b6a446508c2 revert: fix interactive reverting of end-of-file newline changes
Rodrigo Damazio Bovendorp <rdamazio@google.com>
parents:
diff changeset
    11
  > crecordtest = testModeCommands
8b6a446508c2 revert: fix interactive reverting of end-of-file newline changes
Rodrigo Damazio Bovendorp <rdamazio@google.com>
parents:
diff changeset
    12
  > EOF
8b6a446508c2 revert: fix interactive reverting of end-of-file newline changes
Rodrigo Damazio Bovendorp <rdamazio@google.com>
parents:
diff changeset
    13
8b6a446508c2 revert: fix interactive reverting of end-of-file newline changes
Rodrigo Damazio Bovendorp <rdamazio@google.com>
parents:
diff changeset
    14
TODO: Make a curses version of the other tests from test-revert-interactive.t.
8b6a446508c2 revert: fix interactive reverting of end-of-file newline changes
Rodrigo Damazio Bovendorp <rdamazio@google.com>
parents:
diff changeset
    15
49033
9a5d09d7f108 crecord: add test demonstrating issue when reverting noeol->eol change
Kyle Lippincott <spectral@google.com>
parents: 46325
diff changeset
    16
#if committed
9a5d09d7f108 crecord: add test demonstrating issue when reverting noeol->eol change
Kyle Lippincott <spectral@google.com>
parents: 46325
diff changeset
    17
  $ maybe_commit() {
9a5d09d7f108 crecord: add test demonstrating issue when reverting noeol->eol change
Kyle Lippincott <spectral@google.com>
parents: 46325
diff changeset
    18
  >   hg ci "$@"
9a5d09d7f108 crecord: add test demonstrating issue when reverting noeol->eol change
Kyle Lippincott <spectral@google.com>
parents: 46325
diff changeset
    19
  > }
9a5d09d7f108 crecord: add test demonstrating issue when reverting noeol->eol change
Kyle Lippincott <spectral@google.com>
parents: 46325
diff changeset
    20
  $ do_revert() {
9a5d09d7f108 crecord: add test demonstrating issue when reverting noeol->eol change
Kyle Lippincott <spectral@google.com>
parents: 46325
diff changeset
    21
  >   hg revert -ir'.^'
9a5d09d7f108 crecord: add test demonstrating issue when reverting noeol->eol change
Kyle Lippincott <spectral@google.com>
parents: 46325
diff changeset
    22
  > }
9a5d09d7f108 crecord: add test demonstrating issue when reverting noeol->eol change
Kyle Lippincott <spectral@google.com>
parents: 46325
diff changeset
    23
#else
9a5d09d7f108 crecord: add test demonstrating issue when reverting noeol->eol change
Kyle Lippincott <spectral@google.com>
parents: 46325
diff changeset
    24
  $ maybe_commit() {
9a5d09d7f108 crecord: add test demonstrating issue when reverting noeol->eol change
Kyle Lippincott <spectral@google.com>
parents: 46325
diff changeset
    25
  >   true
9a5d09d7f108 crecord: add test demonstrating issue when reverting noeol->eol change
Kyle Lippincott <spectral@google.com>
parents: 46325
diff changeset
    26
  > }
9a5d09d7f108 crecord: add test demonstrating issue when reverting noeol->eol change
Kyle Lippincott <spectral@google.com>
parents: 46325
diff changeset
    27
  $ do_revert() {
9a5d09d7f108 crecord: add test demonstrating issue when reverting noeol->eol change
Kyle Lippincott <spectral@google.com>
parents: 46325
diff changeset
    28
  >   hg revert -i
9a5d09d7f108 crecord: add test demonstrating issue when reverting noeol->eol change
Kyle Lippincott <spectral@google.com>
parents: 46325
diff changeset
    29
  > }
9a5d09d7f108 crecord: add test demonstrating issue when reverting noeol->eol change
Kyle Lippincott <spectral@google.com>
parents: 46325
diff changeset
    30
#endif
9a5d09d7f108 crecord: add test demonstrating issue when reverting noeol->eol change
Kyle Lippincott <spectral@google.com>
parents: 46325
diff changeset
    31
45153
8b6a446508c2 revert: fix interactive reverting of end-of-file newline changes
Rodrigo Damazio Bovendorp <rdamazio@google.com>
parents:
diff changeset
    32
When a line without EOL is selected during "revert -i"
8b6a446508c2 revert: fix interactive reverting of end-of-file newline changes
Rodrigo Damazio Bovendorp <rdamazio@google.com>
parents:
diff changeset
    33
8b6a446508c2 revert: fix interactive reverting of end-of-file newline changes
Rodrigo Damazio Bovendorp <rdamazio@google.com>
parents:
diff changeset
    34
  $ hg init $TESTTMP/revert-i-curses-eol
8b6a446508c2 revert: fix interactive reverting of end-of-file newline changes
Rodrigo Damazio Bovendorp <rdamazio@google.com>
parents:
diff changeset
    35
  $ cd $TESTTMP/revert-i-curses-eol
8b6a446508c2 revert: fix interactive reverting of end-of-file newline changes
Rodrigo Damazio Bovendorp <rdamazio@google.com>
parents:
diff changeset
    36
  $ echo 0 > a
8b6a446508c2 revert: fix interactive reverting of end-of-file newline changes
Rodrigo Damazio Bovendorp <rdamazio@google.com>
parents:
diff changeset
    37
  $ hg ci -qAm 0
8b6a446508c2 revert: fix interactive reverting of end-of-file newline changes
Rodrigo Damazio Bovendorp <rdamazio@google.com>
parents:
diff changeset
    38
  $ printf 1 >> a
49033
9a5d09d7f108 crecord: add test demonstrating issue when reverting noeol->eol change
Kyle Lippincott <spectral@google.com>
parents: 46325
diff changeset
    39
  $ maybe_commit -qAm 1
45153
8b6a446508c2 revert: fix interactive reverting of end-of-file newline changes
Rodrigo Damazio Bovendorp <rdamazio@google.com>
parents:
diff changeset
    40
  $ cat a
8b6a446508c2 revert: fix interactive reverting of end-of-file newline changes
Rodrigo Damazio Bovendorp <rdamazio@google.com>
parents:
diff changeset
    41
  0
8b6a446508c2 revert: fix interactive reverting of end-of-file newline changes
Rodrigo Damazio Bovendorp <rdamazio@google.com>
parents:
diff changeset
    42
  1 (no-eol)
8b6a446508c2 revert: fix interactive reverting of end-of-file newline changes
Rodrigo Damazio Bovendorp <rdamazio@google.com>
parents:
diff changeset
    43
8b6a446508c2 revert: fix interactive reverting of end-of-file newline changes
Rodrigo Damazio Bovendorp <rdamazio@google.com>
parents:
diff changeset
    44
  $ cat <<EOF >testModeCommands
8b6a446508c2 revert: fix interactive reverting of end-of-file newline changes
Rodrigo Damazio Bovendorp <rdamazio@google.com>
parents:
diff changeset
    45
  > c
8b6a446508c2 revert: fix interactive reverting of end-of-file newline changes
Rodrigo Damazio Bovendorp <rdamazio@google.com>
parents:
diff changeset
    46
  > EOF
8b6a446508c2 revert: fix interactive reverting of end-of-file newline changes
Rodrigo Damazio Bovendorp <rdamazio@google.com>
parents:
diff changeset
    47
49033
9a5d09d7f108 crecord: add test demonstrating issue when reverting noeol->eol change
Kyle Lippincott <spectral@google.com>
parents: 46325
diff changeset
    48
  $ do_revert
45153
8b6a446508c2 revert: fix interactive reverting of end-of-file newline changes
Rodrigo Damazio Bovendorp <rdamazio@google.com>
parents:
diff changeset
    49
  reverting a
8b6a446508c2 revert: fix interactive reverting of end-of-file newline changes
Rodrigo Damazio Bovendorp <rdamazio@google.com>
parents:
diff changeset
    50
  $ cat a
8b6a446508c2 revert: fix interactive reverting of end-of-file newline changes
Rodrigo Damazio Bovendorp <rdamazio@google.com>
parents:
diff changeset
    51
  0
8b6a446508c2 revert: fix interactive reverting of end-of-file newline changes
Rodrigo Damazio Bovendorp <rdamazio@google.com>
parents:
diff changeset
    52
8b6a446508c2 revert: fix interactive reverting of end-of-file newline changes
Rodrigo Damazio Bovendorp <rdamazio@google.com>
parents:
diff changeset
    53
When a selected line is reverted to have no EOL
8b6a446508c2 revert: fix interactive reverting of end-of-file newline changes
Rodrigo Damazio Bovendorp <rdamazio@google.com>
parents:
diff changeset
    54
8b6a446508c2 revert: fix interactive reverting of end-of-file newline changes
Rodrigo Damazio Bovendorp <rdamazio@google.com>
parents:
diff changeset
    55
  $ hg init $TESTTMP/revert-i-curses-eol2
8b6a446508c2 revert: fix interactive reverting of end-of-file newline changes
Rodrigo Damazio Bovendorp <rdamazio@google.com>
parents:
diff changeset
    56
  $ cd $TESTTMP/revert-i-curses-eol2
8b6a446508c2 revert: fix interactive reverting of end-of-file newline changes
Rodrigo Damazio Bovendorp <rdamazio@google.com>
parents:
diff changeset
    57
  $ printf 0 > a
8b6a446508c2 revert: fix interactive reverting of end-of-file newline changes
Rodrigo Damazio Bovendorp <rdamazio@google.com>
parents:
diff changeset
    58
  $ hg ci -qAm 0
8b6a446508c2 revert: fix interactive reverting of end-of-file newline changes
Rodrigo Damazio Bovendorp <rdamazio@google.com>
parents:
diff changeset
    59
  $ echo 0 > a
49033
9a5d09d7f108 crecord: add test demonstrating issue when reverting noeol->eol change
Kyle Lippincott <spectral@google.com>
parents: 46325
diff changeset
    60
  $ maybe_commit -qAm 1
45153
8b6a446508c2 revert: fix interactive reverting of end-of-file newline changes
Rodrigo Damazio Bovendorp <rdamazio@google.com>
parents:
diff changeset
    61
  $ cat a
8b6a446508c2 revert: fix interactive reverting of end-of-file newline changes
Rodrigo Damazio Bovendorp <rdamazio@google.com>
parents:
diff changeset
    62
  0
8b6a446508c2 revert: fix interactive reverting of end-of-file newline changes
Rodrigo Damazio Bovendorp <rdamazio@google.com>
parents:
diff changeset
    63
8b6a446508c2 revert: fix interactive reverting of end-of-file newline changes
Rodrigo Damazio Bovendorp <rdamazio@google.com>
parents:
diff changeset
    64
  $ cat <<EOF >testModeCommands
8b6a446508c2 revert: fix interactive reverting of end-of-file newline changes
Rodrigo Damazio Bovendorp <rdamazio@google.com>
parents:
diff changeset
    65
  > c
8b6a446508c2 revert: fix interactive reverting of end-of-file newline changes
Rodrigo Damazio Bovendorp <rdamazio@google.com>
parents:
diff changeset
    66
  > EOF
8b6a446508c2 revert: fix interactive reverting of end-of-file newline changes
Rodrigo Damazio Bovendorp <rdamazio@google.com>
parents:
diff changeset
    67
49033
9a5d09d7f108 crecord: add test demonstrating issue when reverting noeol->eol change
Kyle Lippincott <spectral@google.com>
parents: 46325
diff changeset
    68
  $ do_revert
45153
8b6a446508c2 revert: fix interactive reverting of end-of-file newline changes
Rodrigo Damazio Bovendorp <rdamazio@google.com>
parents:
diff changeset
    69
  reverting a
8b6a446508c2 revert: fix interactive reverting of end-of-file newline changes
Rodrigo Damazio Bovendorp <rdamazio@google.com>
parents:
diff changeset
    70
  $ cat a
8b6a446508c2 revert: fix interactive reverting of end-of-file newline changes
Rodrigo Damazio Bovendorp <rdamazio@google.com>
parents:
diff changeset
    71
  0 (no-eol)
8b6a446508c2 revert: fix interactive reverting of end-of-file newline changes
Rodrigo Damazio Bovendorp <rdamazio@google.com>
parents:
diff changeset
    72