tests/test-revert-interactive-curses.t
author Gregory Szorc <gregory.szorc@gmail.com>
Mon, 21 Feb 2022 11:08:53 -0700
changeset 48921 c9774f5fa729
parent 46325 e5e6282fa66a
child 49033 9a5d09d7f108
permissions -rw-r--r--
debugcommands: remove pycompat.iteritems() Differential Revision: https://phab.mercurial-scm.org/D12326
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
45153
8b6a446508c2 revert: fix interactive reverting of end-of-file newline changes
Rodrigo Damazio Bovendorp <rdamazio@google.com>
parents:
diff changeset
     2
8b6a446508c2 revert: fix interactive reverting of end-of-file newline changes
Rodrigo Damazio Bovendorp <rdamazio@google.com>
parents:
diff changeset
     3
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
     4
8b6a446508c2 revert: fix interactive reverting of end-of-file newline changes
Rodrigo Damazio Bovendorp <rdamazio@google.com>
parents:
diff changeset
     5
  $ cat <<EOF >> $HGRCPATH
8b6a446508c2 revert: fix interactive reverting of end-of-file newline changes
Rodrigo Damazio Bovendorp <rdamazio@google.com>
parents:
diff changeset
     6
  > [ui]
8b6a446508c2 revert: fix interactive reverting of end-of-file newline changes
Rodrigo Damazio Bovendorp <rdamazio@google.com>
parents:
diff changeset
     7
  > interactive = true
8b6a446508c2 revert: fix interactive reverting of end-of-file newline changes
Rodrigo Damazio Bovendorp <rdamazio@google.com>
parents:
diff changeset
     8
  > interface = curses
8b6a446508c2 revert: fix interactive reverting of end-of-file newline changes
Rodrigo Damazio Bovendorp <rdamazio@google.com>
parents:
diff changeset
     9
  > [experimental]
8b6a446508c2 revert: fix interactive reverting of end-of-file newline changes
Rodrigo Damazio Bovendorp <rdamazio@google.com>
parents:
diff changeset
    10
  > crecordtest = testModeCommands
8b6a446508c2 revert: fix interactive reverting of end-of-file newline changes
Rodrigo Damazio Bovendorp <rdamazio@google.com>
parents:
diff changeset
    11
  > EOF
8b6a446508c2 revert: fix interactive reverting of end-of-file newline changes
Rodrigo Damazio Bovendorp <rdamazio@google.com>
parents:
diff changeset
    12
8b6a446508c2 revert: fix interactive reverting of end-of-file newline changes
Rodrigo Damazio Bovendorp <rdamazio@google.com>
parents:
diff changeset
    13
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
    14
8b6a446508c2 revert: fix interactive reverting of end-of-file newline changes
Rodrigo Damazio Bovendorp <rdamazio@google.com>
parents:
diff changeset
    15
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
    16
8b6a446508c2 revert: fix interactive reverting of end-of-file newline changes
Rodrigo Damazio Bovendorp <rdamazio@google.com>
parents:
diff changeset
    17
  $ 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
    18
  $ 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
    19
  $ echo 0 > a
8b6a446508c2 revert: fix interactive reverting of end-of-file newline changes
Rodrigo Damazio Bovendorp <rdamazio@google.com>
parents:
diff changeset
    20
  $ hg ci -qAm 0
8b6a446508c2 revert: fix interactive reverting of end-of-file newline changes
Rodrigo Damazio Bovendorp <rdamazio@google.com>
parents:
diff changeset
    21
  $ printf 1 >> a
8b6a446508c2 revert: fix interactive reverting of end-of-file newline changes
Rodrigo Damazio Bovendorp <rdamazio@google.com>
parents:
diff changeset
    22
  $ hg ci -qAm 1
8b6a446508c2 revert: fix interactive reverting of end-of-file newline changes
Rodrigo Damazio Bovendorp <rdamazio@google.com>
parents:
diff changeset
    23
  $ cat a
8b6a446508c2 revert: fix interactive reverting of end-of-file newline changes
Rodrigo Damazio Bovendorp <rdamazio@google.com>
parents:
diff changeset
    24
  0
8b6a446508c2 revert: fix interactive reverting of end-of-file newline changes
Rodrigo Damazio Bovendorp <rdamazio@google.com>
parents:
diff changeset
    25
  1 (no-eol)
8b6a446508c2 revert: fix interactive reverting of end-of-file newline changes
Rodrigo Damazio Bovendorp <rdamazio@google.com>
parents:
diff changeset
    26
8b6a446508c2 revert: fix interactive reverting of end-of-file newline changes
Rodrigo Damazio Bovendorp <rdamazio@google.com>
parents:
diff changeset
    27
  $ cat <<EOF >testModeCommands
8b6a446508c2 revert: fix interactive reverting of end-of-file newline changes
Rodrigo Damazio Bovendorp <rdamazio@google.com>
parents:
diff changeset
    28
  > c
8b6a446508c2 revert: fix interactive reverting of end-of-file newline changes
Rodrigo Damazio Bovendorp <rdamazio@google.com>
parents:
diff changeset
    29
  > EOF
8b6a446508c2 revert: fix interactive reverting of end-of-file newline changes
Rodrigo Damazio Bovendorp <rdamazio@google.com>
parents:
diff changeset
    30
8b6a446508c2 revert: fix interactive reverting of end-of-file newline changes
Rodrigo Damazio Bovendorp <rdamazio@google.com>
parents:
diff changeset
    31
  $ hg revert -ir'.^'
8b6a446508c2 revert: fix interactive reverting of end-of-file newline changes
Rodrigo Damazio Bovendorp <rdamazio@google.com>
parents:
diff changeset
    32
  reverting a
8b6a446508c2 revert: fix interactive reverting of end-of-file newline changes
Rodrigo Damazio Bovendorp <rdamazio@google.com>
parents:
diff changeset
    33
  $ cat a
8b6a446508c2 revert: fix interactive reverting of end-of-file newline changes
Rodrigo Damazio Bovendorp <rdamazio@google.com>
parents:
diff changeset
    34
  0
8b6a446508c2 revert: fix interactive reverting of end-of-file newline changes
Rodrigo Damazio Bovendorp <rdamazio@google.com>
parents:
diff changeset
    35
8b6a446508c2 revert: fix interactive reverting of end-of-file newline changes
Rodrigo Damazio Bovendorp <rdamazio@google.com>
parents:
diff changeset
    36
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
    37
8b6a446508c2 revert: fix interactive reverting of end-of-file newline changes
Rodrigo Damazio Bovendorp <rdamazio@google.com>
parents:
diff changeset
    38
  $ 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
    39
  $ 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
    40
  $ printf 0 > a
8b6a446508c2 revert: fix interactive reverting of end-of-file newline changes
Rodrigo Damazio Bovendorp <rdamazio@google.com>
parents:
diff changeset
    41
  $ hg ci -qAm 0
8b6a446508c2 revert: fix interactive reverting of end-of-file newline changes
Rodrigo Damazio Bovendorp <rdamazio@google.com>
parents:
diff changeset
    42
  $ echo 0 > a
8b6a446508c2 revert: fix interactive reverting of end-of-file newline changes
Rodrigo Damazio Bovendorp <rdamazio@google.com>
parents:
diff changeset
    43
  $ hg ci -qAm 1
8b6a446508c2 revert: fix interactive reverting of end-of-file newline changes
Rodrigo Damazio Bovendorp <rdamazio@google.com>
parents:
diff changeset
    44
  $ cat a
8b6a446508c2 revert: fix interactive reverting of end-of-file newline changes
Rodrigo Damazio Bovendorp <rdamazio@google.com>
parents:
diff changeset
    45
  0
8b6a446508c2 revert: fix interactive reverting of end-of-file newline changes
Rodrigo Damazio Bovendorp <rdamazio@google.com>
parents:
diff changeset
    46
8b6a446508c2 revert: fix interactive reverting of end-of-file newline changes
Rodrigo Damazio Bovendorp <rdamazio@google.com>
parents:
diff changeset
    47
  $ cat <<EOF >testModeCommands
8b6a446508c2 revert: fix interactive reverting of end-of-file newline changes
Rodrigo Damazio Bovendorp <rdamazio@google.com>
parents:
diff changeset
    48
  > c
8b6a446508c2 revert: fix interactive reverting of end-of-file newline changes
Rodrigo Damazio Bovendorp <rdamazio@google.com>
parents:
diff changeset
    49
  > EOF
8b6a446508c2 revert: fix interactive reverting of end-of-file newline changes
Rodrigo Damazio Bovendorp <rdamazio@google.com>
parents:
diff changeset
    50
8b6a446508c2 revert: fix interactive reverting of end-of-file newline changes
Rodrigo Damazio Bovendorp <rdamazio@google.com>
parents:
diff changeset
    51
  $ hg revert -ir'.^'
8b6a446508c2 revert: fix interactive reverting of end-of-file newline changes
Rodrigo Damazio Bovendorp <rdamazio@google.com>
parents:
diff changeset
    52
  reverting a
8b6a446508c2 revert: fix interactive reverting of end-of-file newline changes
Rodrigo Damazio Bovendorp <rdamazio@google.com>
parents:
diff changeset
    53
  $ cat a
8b6a446508c2 revert: fix interactive reverting of end-of-file newline changes
Rodrigo Damazio Bovendorp <rdamazio@google.com>
parents:
diff changeset
    54
  0 (no-eol)
8b6a446508c2 revert: fix interactive reverting of end-of-file newline changes
Rodrigo Damazio Bovendorp <rdamazio@google.com>
parents:
diff changeset
    55