tests/test-revert-interactive-curses.t
author Pierre-Yves David <pierre-yves.david@octobus.net>
Thu, 23 Feb 2023 03:25:44 +0100
changeset 50187 f18e4608bb61
parent 49034 079197e94b24
permissions -rw-r--r--
narrow: delegate the dirstate's narrow spec writing to the transaction This make it more transactional and will help us to simplify their backup. The implementation is not great, but it keep the patch simple as this is not the time for a larger refactoring yet.
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