tests/test-revert-interactive-curses.t
author Pulkit Goyal <7895pulkit@gmail.com>
Mon, 10 Aug 2020 15:34:27 +0530
changeset 45383 f970cca30989
parent 45153 8b6a446508c2
child 46325 e5e6282fa66a
permissions -rw-r--r--
merge: use collections.defaultdict() for mergeresult.commitinfo We will be storing info from mergeresult.commitinfo to mergestate._stateextras in upcoming patches, let's make them use same structure so that we don't have to make much efforts in transferring info from one to other. Differential Revision: https://phab.mercurial-scm.org/D8921
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
45153
8b6a446508c2 revert: fix interactive reverting of end-of-file newline changes
Rodrigo Damazio Bovendorp <rdamazio@google.com>
parents:
diff changeset
     1
#require tic
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