tests/test-commit-interactive-curses.t
author Mads Kiilerich <madski@unity3d.com>
Tue, 19 Jan 2016 06:00:59 +0100
branchstable
changeset 27919 db24d6888896
parent 27914 505a10b504ed
child 28542 71e12fc53b80
permissions -rw-r--r--
mq: check for reserved patch name with qimport -r (issue5033) Fix regression from 143b52fce68e. Catching aborts might not be pretty but it works and is a small change.
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
24344
6b43baac6dfb record: add tests for the curses recording interface
Laurent Charignon <lcharignon@fb.com>
parents:
diff changeset
     1
Set up a repo
6b43baac6dfb record: add tests for the curses recording interface
Laurent Charignon <lcharignon@fb.com>
parents:
diff changeset
     2
6b43baac6dfb record: add tests for the curses recording interface
Laurent Charignon <lcharignon@fb.com>
parents:
diff changeset
     3
  $ cat <<EOF >> $HGRCPATH
6b43baac6dfb record: add tests for the curses recording interface
Laurent Charignon <lcharignon@fb.com>
parents:
diff changeset
     4
  > [ui]
6b43baac6dfb record: add tests for the curses recording interface
Laurent Charignon <lcharignon@fb.com>
parents:
diff changeset
     5
  > interactive = true
6b43baac6dfb record: add tests for the curses recording interface
Laurent Charignon <lcharignon@fb.com>
parents:
diff changeset
     6
  > [experimental]
6b43baac6dfb record: add tests for the curses recording interface
Laurent Charignon <lcharignon@fb.com>
parents:
diff changeset
     7
  > crecord = true
6b43baac6dfb record: add tests for the curses recording interface
Laurent Charignon <lcharignon@fb.com>
parents:
diff changeset
     8
  > crecordtest = testModeCommands
6b43baac6dfb record: add tests for the curses recording interface
Laurent Charignon <lcharignon@fb.com>
parents:
diff changeset
     9
  > EOF
6b43baac6dfb record: add tests for the curses recording interface
Laurent Charignon <lcharignon@fb.com>
parents:
diff changeset
    10
6b43baac6dfb record: add tests for the curses recording interface
Laurent Charignon <lcharignon@fb.com>
parents:
diff changeset
    11
  $ hg init a
6b43baac6dfb record: add tests for the curses recording interface
Laurent Charignon <lcharignon@fb.com>
parents:
diff changeset
    12
  $ cd a
6b43baac6dfb record: add tests for the curses recording interface
Laurent Charignon <lcharignon@fb.com>
parents:
diff changeset
    13
6b43baac6dfb record: add tests for the curses recording interface
Laurent Charignon <lcharignon@fb.com>
parents:
diff changeset
    14
Committing some changes but stopping on the way
6b43baac6dfb record: add tests for the curses recording interface
Laurent Charignon <lcharignon@fb.com>
parents:
diff changeset
    15
6b43baac6dfb record: add tests for the curses recording interface
Laurent Charignon <lcharignon@fb.com>
parents:
diff changeset
    16
  $ echo "a" > a
6b43baac6dfb record: add tests for the curses recording interface
Laurent Charignon <lcharignon@fb.com>
parents:
diff changeset
    17
  $ hg add a
6b43baac6dfb record: add tests for the curses recording interface
Laurent Charignon <lcharignon@fb.com>
parents:
diff changeset
    18
  $ cat <<EOF >testModeCommands
6b43baac6dfb record: add tests for the curses recording interface
Laurent Charignon <lcharignon@fb.com>
parents:
diff changeset
    19
  > TOGGLE
6b43baac6dfb record: add tests for the curses recording interface
Laurent Charignon <lcharignon@fb.com>
parents:
diff changeset
    20
  > X
6b43baac6dfb record: add tests for the curses recording interface
Laurent Charignon <lcharignon@fb.com>
parents:
diff changeset
    21
  > EOF
6b43baac6dfb record: add tests for the curses recording interface
Laurent Charignon <lcharignon@fb.com>
parents:
diff changeset
    22
  $ hg commit -i  -m "a" -d "0 0"
6b43baac6dfb record: add tests for the curses recording interface
Laurent Charignon <lcharignon@fb.com>
parents:
diff changeset
    23
  no changes to record
6b43baac6dfb record: add tests for the curses recording interface
Laurent Charignon <lcharignon@fb.com>
parents:
diff changeset
    24
  $ hg tip
6b43baac6dfb record: add tests for the curses recording interface
Laurent Charignon <lcharignon@fb.com>
parents:
diff changeset
    25
  changeset:   -1:000000000000
6b43baac6dfb record: add tests for the curses recording interface
Laurent Charignon <lcharignon@fb.com>
parents:
diff changeset
    26
  tag:         tip
6b43baac6dfb record: add tests for the curses recording interface
Laurent Charignon <lcharignon@fb.com>
parents:
diff changeset
    27
  user:        
6b43baac6dfb record: add tests for the curses recording interface
Laurent Charignon <lcharignon@fb.com>
parents:
diff changeset
    28
  date:        Thu Jan 01 00:00:00 1970 +0000
6b43baac6dfb record: add tests for the curses recording interface
Laurent Charignon <lcharignon@fb.com>
parents:
diff changeset
    29
  
6b43baac6dfb record: add tests for the curses recording interface
Laurent Charignon <lcharignon@fb.com>
parents:
diff changeset
    30
6b43baac6dfb record: add tests for the curses recording interface
Laurent Charignon <lcharignon@fb.com>
parents:
diff changeset
    31
Committing some changes
6b43baac6dfb record: add tests for the curses recording interface
Laurent Charignon <lcharignon@fb.com>
parents:
diff changeset
    32
6b43baac6dfb record: add tests for the curses recording interface
Laurent Charignon <lcharignon@fb.com>
parents:
diff changeset
    33
  $ cat <<EOF >testModeCommands
6b43baac6dfb record: add tests for the curses recording interface
Laurent Charignon <lcharignon@fb.com>
parents:
diff changeset
    34
  > X
6b43baac6dfb record: add tests for the curses recording interface
Laurent Charignon <lcharignon@fb.com>
parents:
diff changeset
    35
  > EOF
6b43baac6dfb record: add tests for the curses recording interface
Laurent Charignon <lcharignon@fb.com>
parents:
diff changeset
    36
  $ hg commit -i  -m "a" -d "0 0"
6b43baac6dfb record: add tests for the curses recording interface
Laurent Charignon <lcharignon@fb.com>
parents:
diff changeset
    37
  $ hg tip
6b43baac6dfb record: add tests for the curses recording interface
Laurent Charignon <lcharignon@fb.com>
parents:
diff changeset
    38
  changeset:   0:cb9a9f314b8b
6b43baac6dfb record: add tests for the curses recording interface
Laurent Charignon <lcharignon@fb.com>
parents:
diff changeset
    39
  tag:         tip
6b43baac6dfb record: add tests for the curses recording interface
Laurent Charignon <lcharignon@fb.com>
parents:
diff changeset
    40
  user:        test
6b43baac6dfb record: add tests for the curses recording interface
Laurent Charignon <lcharignon@fb.com>
parents:
diff changeset
    41
  date:        Thu Jan 01 00:00:00 1970 +0000
6b43baac6dfb record: add tests for the curses recording interface
Laurent Charignon <lcharignon@fb.com>
parents:
diff changeset
    42
  summary:     a
6b43baac6dfb record: add tests for the curses recording interface
Laurent Charignon <lcharignon@fb.com>
parents:
diff changeset
    43
  
27321
dcdf0a52ad36 crecord: add dictionary to default return value of filterpatch
Laurent Charignon <lcharignon@fb.com>
parents: 27156
diff changeset
    44
Check that commit -i works with no changes
dcdf0a52ad36 crecord: add dictionary to default return value of filterpatch
Laurent Charignon <lcharignon@fb.com>
parents: 27156
diff changeset
    45
  $ hg commit -i
dcdf0a52ad36 crecord: add dictionary to default return value of filterpatch
Laurent Charignon <lcharignon@fb.com>
parents: 27156
diff changeset
    46
  no changes to record
dcdf0a52ad36 crecord: add dictionary to default return value of filterpatch
Laurent Charignon <lcharignon@fb.com>
parents: 27156
diff changeset
    47
24344
6b43baac6dfb record: add tests for the curses recording interface
Laurent Charignon <lcharignon@fb.com>
parents:
diff changeset
    48
Committing only one file
6b43baac6dfb record: add tests for the curses recording interface
Laurent Charignon <lcharignon@fb.com>
parents:
diff changeset
    49
6b43baac6dfb record: add tests for the curses recording interface
Laurent Charignon <lcharignon@fb.com>
parents:
diff changeset
    50
  $ echo "a" >> a
24434
f169405c03ab test-interactive: use stable EOL in various file generating routines
Matt Harbison <matt_harbison@yahoo.com>
parents: 24363
diff changeset
    51
  >>> open('b', 'wb').write("1\n2\n3\n4\n5\n6\n7\n8\n9\n10\n")
24344
6b43baac6dfb record: add tests for the curses recording interface
Laurent Charignon <lcharignon@fb.com>
parents:
diff changeset
    52
  $ hg add b
6b43baac6dfb record: add tests for the curses recording interface
Laurent Charignon <lcharignon@fb.com>
parents:
diff changeset
    53
  $ cat <<EOF >testModeCommands
6b43baac6dfb record: add tests for the curses recording interface
Laurent Charignon <lcharignon@fb.com>
parents:
diff changeset
    54
  > TOGGLE
6b43baac6dfb record: add tests for the curses recording interface
Laurent Charignon <lcharignon@fb.com>
parents:
diff changeset
    55
  > KEY_DOWN
6b43baac6dfb record: add tests for the curses recording interface
Laurent Charignon <lcharignon@fb.com>
parents:
diff changeset
    56
  > X
6b43baac6dfb record: add tests for the curses recording interface
Laurent Charignon <lcharignon@fb.com>
parents:
diff changeset
    57
  > EOF
6b43baac6dfb record: add tests for the curses recording interface
Laurent Charignon <lcharignon@fb.com>
parents:
diff changeset
    58
  $ hg commit -i  -m "one file" -d "0 0"
6b43baac6dfb record: add tests for the curses recording interface
Laurent Charignon <lcharignon@fb.com>
parents:
diff changeset
    59
  $ hg tip
6b43baac6dfb record: add tests for the curses recording interface
Laurent Charignon <lcharignon@fb.com>
parents:
diff changeset
    60
  changeset:   1:fb2705a663ea
6b43baac6dfb record: add tests for the curses recording interface
Laurent Charignon <lcharignon@fb.com>
parents:
diff changeset
    61
  tag:         tip
6b43baac6dfb record: add tests for the curses recording interface
Laurent Charignon <lcharignon@fb.com>
parents:
diff changeset
    62
  user:        test
6b43baac6dfb record: add tests for the curses recording interface
Laurent Charignon <lcharignon@fb.com>
parents:
diff changeset
    63
  date:        Thu Jan 01 00:00:00 1970 +0000
6b43baac6dfb record: add tests for the curses recording interface
Laurent Charignon <lcharignon@fb.com>
parents:
diff changeset
    64
  summary:     one file
6b43baac6dfb record: add tests for the curses recording interface
Laurent Charignon <lcharignon@fb.com>
parents:
diff changeset
    65
  
6b43baac6dfb record: add tests for the curses recording interface
Laurent Charignon <lcharignon@fb.com>
parents:
diff changeset
    66
  $ hg cat -r tip a
6b43baac6dfb record: add tests for the curses recording interface
Laurent Charignon <lcharignon@fb.com>
parents:
diff changeset
    67
  a
6b43baac6dfb record: add tests for the curses recording interface
Laurent Charignon <lcharignon@fb.com>
parents:
diff changeset
    68
  $ cat a
6b43baac6dfb record: add tests for the curses recording interface
Laurent Charignon <lcharignon@fb.com>
parents:
diff changeset
    69
  a
6b43baac6dfb record: add tests for the curses recording interface
Laurent Charignon <lcharignon@fb.com>
parents:
diff changeset
    70
  a
6b43baac6dfb record: add tests for the curses recording interface
Laurent Charignon <lcharignon@fb.com>
parents:
diff changeset
    71
25557
52c552a05414 crecord: exit edition of hunk with non-zero status does not interrupt session
Laurent Charignon <lcharignon@fb.com>
parents: 24837
diff changeset
    72
Committing only one hunk while aborting edition of hunk
24344
6b43baac6dfb record: add tests for the curses recording interface
Laurent Charignon <lcharignon@fb.com>
parents:
diff changeset
    73
6b43baac6dfb record: add tests for the curses recording interface
Laurent Charignon <lcharignon@fb.com>
parents:
diff changeset
    74
- Untoggle all the hunks, go down to the second file
6b43baac6dfb record: add tests for the curses recording interface
Laurent Charignon <lcharignon@fb.com>
parents:
diff changeset
    75
- unfold it
6b43baac6dfb record: add tests for the curses recording interface
Laurent Charignon <lcharignon@fb.com>
parents:
diff changeset
    76
- go down to second hunk (1 for the first hunk, 1 for the first hunkline, 1 for the second hunk, 1 for the second hunklike)
6b43baac6dfb record: add tests for the curses recording interface
Laurent Charignon <lcharignon@fb.com>
parents:
diff changeset
    77
- toggle the second hunk
27156
55fa7c3900ae commit: add amend mode for commit -i
Laurent Charignon <lcharignon@fb.com>
parents: 26781
diff changeset
    78
- toggle on and off the amend mode (to check that it toggles off)
26781
1aee2ab0f902 spelling: trivial spell checking
Mads Kiilerich <madski@unity3d.com>
parents: 25557
diff changeset
    79
- edit the hunk and quit the editor immediately with non-zero status
24344
6b43baac6dfb record: add tests for the curses recording interface
Laurent Charignon <lcharignon@fb.com>
parents:
diff changeset
    80
- commit
6b43baac6dfb record: add tests for the curses recording interface
Laurent Charignon <lcharignon@fb.com>
parents:
diff changeset
    81
25557
52c552a05414 crecord: exit edition of hunk with non-zero status does not interrupt session
Laurent Charignon <lcharignon@fb.com>
parents: 24837
diff changeset
    82
  $ printf "printf 'editor ran\n'; exit 1" > editor.sh
24344
6b43baac6dfb record: add tests for the curses recording interface
Laurent Charignon <lcharignon@fb.com>
parents:
diff changeset
    83
  $ echo "x" > c
6b43baac6dfb record: add tests for the curses recording interface
Laurent Charignon <lcharignon@fb.com>
parents:
diff changeset
    84
  $ cat b >> c
6b43baac6dfb record: add tests for the curses recording interface
Laurent Charignon <lcharignon@fb.com>
parents:
diff changeset
    85
  $ echo "y" >> c
6b43baac6dfb record: add tests for the curses recording interface
Laurent Charignon <lcharignon@fb.com>
parents:
diff changeset
    86
  $ mv c b
6b43baac6dfb record: add tests for the curses recording interface
Laurent Charignon <lcharignon@fb.com>
parents:
diff changeset
    87
  $ cat <<EOF >testModeCommands
6b43baac6dfb record: add tests for the curses recording interface
Laurent Charignon <lcharignon@fb.com>
parents:
diff changeset
    88
  > A
6b43baac6dfb record: add tests for the curses recording interface
Laurent Charignon <lcharignon@fb.com>
parents:
diff changeset
    89
  > KEY_DOWN
6b43baac6dfb record: add tests for the curses recording interface
Laurent Charignon <lcharignon@fb.com>
parents:
diff changeset
    90
  > f
6b43baac6dfb record: add tests for the curses recording interface
Laurent Charignon <lcharignon@fb.com>
parents:
diff changeset
    91
  > KEY_DOWN
6b43baac6dfb record: add tests for the curses recording interface
Laurent Charignon <lcharignon@fb.com>
parents:
diff changeset
    92
  > KEY_DOWN
6b43baac6dfb record: add tests for the curses recording interface
Laurent Charignon <lcharignon@fb.com>
parents:
diff changeset
    93
  > KEY_DOWN
6b43baac6dfb record: add tests for the curses recording interface
Laurent Charignon <lcharignon@fb.com>
parents:
diff changeset
    94
  > KEY_DOWN
6b43baac6dfb record: add tests for the curses recording interface
Laurent Charignon <lcharignon@fb.com>
parents:
diff changeset
    95
  > TOGGLE
27156
55fa7c3900ae commit: add amend mode for commit -i
Laurent Charignon <lcharignon@fb.com>
parents: 26781
diff changeset
    96
  > a
55fa7c3900ae commit: add amend mode for commit -i
Laurent Charignon <lcharignon@fb.com>
parents: 26781
diff changeset
    97
  > a
25557
52c552a05414 crecord: exit edition of hunk with non-zero status does not interrupt session
Laurent Charignon <lcharignon@fb.com>
parents: 24837
diff changeset
    98
  > e
24344
6b43baac6dfb record: add tests for the curses recording interface
Laurent Charignon <lcharignon@fb.com>
parents:
diff changeset
    99
  > X
6b43baac6dfb record: add tests for the curses recording interface
Laurent Charignon <lcharignon@fb.com>
parents:
diff changeset
   100
  > EOF
25557
52c552a05414 crecord: exit edition of hunk with non-zero status does not interrupt session
Laurent Charignon <lcharignon@fb.com>
parents: 24837
diff changeset
   101
  $ HGEDITOR="\"sh\" \"`pwd`/editor.sh\"" hg commit -i  -m "one hunk" -d "0 0"
52c552a05414 crecord: exit edition of hunk with non-zero status does not interrupt session
Laurent Charignon <lcharignon@fb.com>
parents: 24837
diff changeset
   102
  editor ran
52c552a05414 crecord: exit edition of hunk with non-zero status does not interrupt session
Laurent Charignon <lcharignon@fb.com>
parents: 24837
diff changeset
   103
  $ rm editor.sh
24344
6b43baac6dfb record: add tests for the curses recording interface
Laurent Charignon <lcharignon@fb.com>
parents:
diff changeset
   104
  $ hg tip
6b43baac6dfb record: add tests for the curses recording interface
Laurent Charignon <lcharignon@fb.com>
parents:
diff changeset
   105
  changeset:   2:7d10dfe755a8
6b43baac6dfb record: add tests for the curses recording interface
Laurent Charignon <lcharignon@fb.com>
parents:
diff changeset
   106
  tag:         tip
6b43baac6dfb record: add tests for the curses recording interface
Laurent Charignon <lcharignon@fb.com>
parents:
diff changeset
   107
  user:        test
6b43baac6dfb record: add tests for the curses recording interface
Laurent Charignon <lcharignon@fb.com>
parents:
diff changeset
   108
  date:        Thu Jan 01 00:00:00 1970 +0000
6b43baac6dfb record: add tests for the curses recording interface
Laurent Charignon <lcharignon@fb.com>
parents:
diff changeset
   109
  summary:     one hunk
6b43baac6dfb record: add tests for the curses recording interface
Laurent Charignon <lcharignon@fb.com>
parents:
diff changeset
   110
  
6b43baac6dfb record: add tests for the curses recording interface
Laurent Charignon <lcharignon@fb.com>
parents:
diff changeset
   111
  $ hg cat -r tip b
6b43baac6dfb record: add tests for the curses recording interface
Laurent Charignon <lcharignon@fb.com>
parents:
diff changeset
   112
  1
6b43baac6dfb record: add tests for the curses recording interface
Laurent Charignon <lcharignon@fb.com>
parents:
diff changeset
   113
  2
6b43baac6dfb record: add tests for the curses recording interface
Laurent Charignon <lcharignon@fb.com>
parents:
diff changeset
   114
  3
6b43baac6dfb record: add tests for the curses recording interface
Laurent Charignon <lcharignon@fb.com>
parents:
diff changeset
   115
  4
6b43baac6dfb record: add tests for the curses recording interface
Laurent Charignon <lcharignon@fb.com>
parents:
diff changeset
   116
  5
6b43baac6dfb record: add tests for the curses recording interface
Laurent Charignon <lcharignon@fb.com>
parents:
diff changeset
   117
  6
6b43baac6dfb record: add tests for the curses recording interface
Laurent Charignon <lcharignon@fb.com>
parents:
diff changeset
   118
  7
6b43baac6dfb record: add tests for the curses recording interface
Laurent Charignon <lcharignon@fb.com>
parents:
diff changeset
   119
  8
6b43baac6dfb record: add tests for the curses recording interface
Laurent Charignon <lcharignon@fb.com>
parents:
diff changeset
   120
  9
6b43baac6dfb record: add tests for the curses recording interface
Laurent Charignon <lcharignon@fb.com>
parents:
diff changeset
   121
  10
6b43baac6dfb record: add tests for the curses recording interface
Laurent Charignon <lcharignon@fb.com>
parents:
diff changeset
   122
  y
6b43baac6dfb record: add tests for the curses recording interface
Laurent Charignon <lcharignon@fb.com>
parents:
diff changeset
   123
  $ cat b
6b43baac6dfb record: add tests for the curses recording interface
Laurent Charignon <lcharignon@fb.com>
parents:
diff changeset
   124
  x
6b43baac6dfb record: add tests for the curses recording interface
Laurent Charignon <lcharignon@fb.com>
parents:
diff changeset
   125
  1
6b43baac6dfb record: add tests for the curses recording interface
Laurent Charignon <lcharignon@fb.com>
parents:
diff changeset
   126
  2
6b43baac6dfb record: add tests for the curses recording interface
Laurent Charignon <lcharignon@fb.com>
parents:
diff changeset
   127
  3
6b43baac6dfb record: add tests for the curses recording interface
Laurent Charignon <lcharignon@fb.com>
parents:
diff changeset
   128
  4
6b43baac6dfb record: add tests for the curses recording interface
Laurent Charignon <lcharignon@fb.com>
parents:
diff changeset
   129
  5
6b43baac6dfb record: add tests for the curses recording interface
Laurent Charignon <lcharignon@fb.com>
parents:
diff changeset
   130
  6
6b43baac6dfb record: add tests for the curses recording interface
Laurent Charignon <lcharignon@fb.com>
parents:
diff changeset
   131
  7
6b43baac6dfb record: add tests for the curses recording interface
Laurent Charignon <lcharignon@fb.com>
parents:
diff changeset
   132
  8
6b43baac6dfb record: add tests for the curses recording interface
Laurent Charignon <lcharignon@fb.com>
parents:
diff changeset
   133
  9
6b43baac6dfb record: add tests for the curses recording interface
Laurent Charignon <lcharignon@fb.com>
parents:
diff changeset
   134
  10
6b43baac6dfb record: add tests for the curses recording interface
Laurent Charignon <lcharignon@fb.com>
parents:
diff changeset
   135
  y
6b43baac6dfb record: add tests for the curses recording interface
Laurent Charignon <lcharignon@fb.com>
parents:
diff changeset
   136
  $ hg commit -m "other hunks"
6b43baac6dfb record: add tests for the curses recording interface
Laurent Charignon <lcharignon@fb.com>
parents:
diff changeset
   137
  $ hg tip
6b43baac6dfb record: add tests for the curses recording interface
Laurent Charignon <lcharignon@fb.com>
parents:
diff changeset
   138
  changeset:   3:a6735021574d
6b43baac6dfb record: add tests for the curses recording interface
Laurent Charignon <lcharignon@fb.com>
parents:
diff changeset
   139
  tag:         tip
6b43baac6dfb record: add tests for the curses recording interface
Laurent Charignon <lcharignon@fb.com>
parents:
diff changeset
   140
  user:        test
6b43baac6dfb record: add tests for the curses recording interface
Laurent Charignon <lcharignon@fb.com>
parents:
diff changeset
   141
  date:        Thu Jan 01 00:00:00 1970 +0000
6b43baac6dfb record: add tests for the curses recording interface
Laurent Charignon <lcharignon@fb.com>
parents:
diff changeset
   142
  summary:     other hunks
6b43baac6dfb record: add tests for the curses recording interface
Laurent Charignon <lcharignon@fb.com>
parents:
diff changeset
   143
  
6b43baac6dfb record: add tests for the curses recording interface
Laurent Charignon <lcharignon@fb.com>
parents:
diff changeset
   144
  $ hg cat -r tip b
6b43baac6dfb record: add tests for the curses recording interface
Laurent Charignon <lcharignon@fb.com>
parents:
diff changeset
   145
  x
6b43baac6dfb record: add tests for the curses recording interface
Laurent Charignon <lcharignon@fb.com>
parents:
diff changeset
   146
  1
6b43baac6dfb record: add tests for the curses recording interface
Laurent Charignon <lcharignon@fb.com>
parents:
diff changeset
   147
  2
6b43baac6dfb record: add tests for the curses recording interface
Laurent Charignon <lcharignon@fb.com>
parents:
diff changeset
   148
  3
6b43baac6dfb record: add tests for the curses recording interface
Laurent Charignon <lcharignon@fb.com>
parents:
diff changeset
   149
  4
6b43baac6dfb record: add tests for the curses recording interface
Laurent Charignon <lcharignon@fb.com>
parents:
diff changeset
   150
  5
6b43baac6dfb record: add tests for the curses recording interface
Laurent Charignon <lcharignon@fb.com>
parents:
diff changeset
   151
  6
6b43baac6dfb record: add tests for the curses recording interface
Laurent Charignon <lcharignon@fb.com>
parents:
diff changeset
   152
  7
6b43baac6dfb record: add tests for the curses recording interface
Laurent Charignon <lcharignon@fb.com>
parents:
diff changeset
   153
  8
6b43baac6dfb record: add tests for the curses recording interface
Laurent Charignon <lcharignon@fb.com>
parents:
diff changeset
   154
  9
6b43baac6dfb record: add tests for the curses recording interface
Laurent Charignon <lcharignon@fb.com>
parents:
diff changeset
   155
  10
6b43baac6dfb record: add tests for the curses recording interface
Laurent Charignon <lcharignon@fb.com>
parents:
diff changeset
   156
  y
6b43baac6dfb record: add tests for the curses recording interface
Laurent Charignon <lcharignon@fb.com>
parents:
diff changeset
   157
24469
e71053ef0c46 record_curses: add test for newly added files
Laurent Charignon <lcharignon@fb.com>
parents: 24435
diff changeset
   158
Newly added files can be selected with the curses interface
24344
6b43baac6dfb record: add tests for the curses recording interface
Laurent Charignon <lcharignon@fb.com>
parents:
diff changeset
   159
24469
e71053ef0c46 record_curses: add test for newly added files
Laurent Charignon <lcharignon@fb.com>
parents: 24435
diff changeset
   160
  $ hg update -C .
24837
edf907bd8144 record: fix record with change on moved file crashes (issue4619)
Laurent Charignon <lcharignon@fb.com>
parents: 24469
diff changeset
   161
  0 files updated, 0 files merged, 0 files removed, 0 files unresolved
24469
e71053ef0c46 record_curses: add test for newly added files
Laurent Charignon <lcharignon@fb.com>
parents: 24435
diff changeset
   162
  $ echo "hello" > x
e71053ef0c46 record_curses: add test for newly added files
Laurent Charignon <lcharignon@fb.com>
parents: 24435
diff changeset
   163
  $ hg add x
e71053ef0c46 record_curses: add test for newly added files
Laurent Charignon <lcharignon@fb.com>
parents: 24435
diff changeset
   164
  $ cat <<EOF >testModeCommands
e71053ef0c46 record_curses: add test for newly added files
Laurent Charignon <lcharignon@fb.com>
parents: 24435
diff changeset
   165
  > TOGGLE
e71053ef0c46 record_curses: add test for newly added files
Laurent Charignon <lcharignon@fb.com>
parents: 24435
diff changeset
   166
  > TOGGLE
e71053ef0c46 record_curses: add test for newly added files
Laurent Charignon <lcharignon@fb.com>
parents: 24435
diff changeset
   167
  > X
e71053ef0c46 record_curses: add test for newly added files
Laurent Charignon <lcharignon@fb.com>
parents: 24435
diff changeset
   168
  > EOF
e71053ef0c46 record_curses: add test for newly added files
Laurent Charignon <lcharignon@fb.com>
parents: 24435
diff changeset
   169
  $ hg st
e71053ef0c46 record_curses: add test for newly added files
Laurent Charignon <lcharignon@fb.com>
parents: 24435
diff changeset
   170
  A x
e71053ef0c46 record_curses: add test for newly added files
Laurent Charignon <lcharignon@fb.com>
parents: 24435
diff changeset
   171
  ? testModeCommands
e71053ef0c46 record_curses: add test for newly added files
Laurent Charignon <lcharignon@fb.com>
parents: 24435
diff changeset
   172
  $ hg commit -i  -m "newly added file" -d "0 0"
e71053ef0c46 record_curses: add test for newly added files
Laurent Charignon <lcharignon@fb.com>
parents: 24435
diff changeset
   173
  $ hg st
e71053ef0c46 record_curses: add test for newly added files
Laurent Charignon <lcharignon@fb.com>
parents: 24435
diff changeset
   174
  ? testModeCommands
e71053ef0c46 record_curses: add test for newly added files
Laurent Charignon <lcharignon@fb.com>
parents: 24435
diff changeset
   175
27156
55fa7c3900ae commit: add amend mode for commit -i
Laurent Charignon <lcharignon@fb.com>
parents: 26781
diff changeset
   176
Amend option works
55fa7c3900ae commit: add amend mode for commit -i
Laurent Charignon <lcharignon@fb.com>
parents: 26781
diff changeset
   177
  $ echo "hello world" > x
55fa7c3900ae commit: add amend mode for commit -i
Laurent Charignon <lcharignon@fb.com>
parents: 26781
diff changeset
   178
  $ hg diff -c .
55fa7c3900ae commit: add amend mode for commit -i
Laurent Charignon <lcharignon@fb.com>
parents: 26781
diff changeset
   179
  diff -r a6735021574d -r 2b0e9be4d336 x
55fa7c3900ae commit: add amend mode for commit -i
Laurent Charignon <lcharignon@fb.com>
parents: 26781
diff changeset
   180
  --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
55fa7c3900ae commit: add amend mode for commit -i
Laurent Charignon <lcharignon@fb.com>
parents: 26781
diff changeset
   181
  +++ b/x	Thu Jan 01 00:00:00 1970 +0000
55fa7c3900ae commit: add amend mode for commit -i
Laurent Charignon <lcharignon@fb.com>
parents: 26781
diff changeset
   182
  @@ -0,0 +1,1 @@
55fa7c3900ae commit: add amend mode for commit -i
Laurent Charignon <lcharignon@fb.com>
parents: 26781
diff changeset
   183
  +hello
55fa7c3900ae commit: add amend mode for commit -i
Laurent Charignon <lcharignon@fb.com>
parents: 26781
diff changeset
   184
  $ cat <<EOF >testModeCommands
55fa7c3900ae commit: add amend mode for commit -i
Laurent Charignon <lcharignon@fb.com>
parents: 26781
diff changeset
   185
  > a
55fa7c3900ae commit: add amend mode for commit -i
Laurent Charignon <lcharignon@fb.com>
parents: 26781
diff changeset
   186
  > X
55fa7c3900ae commit: add amend mode for commit -i
Laurent Charignon <lcharignon@fb.com>
parents: 26781
diff changeset
   187
  > EOF
55fa7c3900ae commit: add amend mode for commit -i
Laurent Charignon <lcharignon@fb.com>
parents: 26781
diff changeset
   188
  $ hg commit -i  -m "newly added file" -d "0 0"
55fa7c3900ae commit: add amend mode for commit -i
Laurent Charignon <lcharignon@fb.com>
parents: 26781
diff changeset
   189
  saved backup bundle to $TESTTMP/a/.hg/strip-backup/2b0e9be4d336-28bbe4e2-amend-backup.hg (glob)
55fa7c3900ae commit: add amend mode for commit -i
Laurent Charignon <lcharignon@fb.com>
parents: 26781
diff changeset
   190
  $ hg diff -c .
55fa7c3900ae commit: add amend mode for commit -i
Laurent Charignon <lcharignon@fb.com>
parents: 26781
diff changeset
   191
  diff -r a6735021574d -r c1d239d165ae x
55fa7c3900ae commit: add amend mode for commit -i
Laurent Charignon <lcharignon@fb.com>
parents: 26781
diff changeset
   192
  --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
55fa7c3900ae commit: add amend mode for commit -i
Laurent Charignon <lcharignon@fb.com>
parents: 26781
diff changeset
   193
  +++ b/x	Thu Jan 01 00:00:00 1970 +0000
55fa7c3900ae commit: add amend mode for commit -i
Laurent Charignon <lcharignon@fb.com>
parents: 26781
diff changeset
   194
  @@ -0,0 +1,1 @@
55fa7c3900ae commit: add amend mode for commit -i
Laurent Charignon <lcharignon@fb.com>
parents: 26781
diff changeset
   195
  +hello world
27914
505a10b504ed crecord: edit during hg crecord should preserve cursor position (issue5041)
Laurent Charignon <lcharignon@fb.com>
parents: 27321
diff changeset
   196
505a10b504ed crecord: edit during hg crecord should preserve cursor position (issue5041)
Laurent Charignon <lcharignon@fb.com>
parents: 27321
diff changeset
   197
Editing a hunk puts you back on that hunk when done editing (issue5041)
505a10b504ed crecord: edit during hg crecord should preserve cursor position (issue5041)
Laurent Charignon <lcharignon@fb.com>
parents: 27321
diff changeset
   198
To do that, we change two lines in a file, pretend to edit the second line,
505a10b504ed crecord: edit during hg crecord should preserve cursor position (issue5041)
Laurent Charignon <lcharignon@fb.com>
parents: 27321
diff changeset
   199
exit, toggle the line selected at the end of the edit and commit.
505a10b504ed crecord: edit during hg crecord should preserve cursor position (issue5041)
Laurent Charignon <lcharignon@fb.com>
parents: 27321
diff changeset
   200
The first line should be recorded if we were put on the second line at the end
505a10b504ed crecord: edit during hg crecord should preserve cursor position (issue5041)
Laurent Charignon <lcharignon@fb.com>
parents: 27321
diff changeset
   201
of the edit.
505a10b504ed crecord: edit during hg crecord should preserve cursor position (issue5041)
Laurent Charignon <lcharignon@fb.com>
parents: 27321
diff changeset
   202
505a10b504ed crecord: edit during hg crecord should preserve cursor position (issue5041)
Laurent Charignon <lcharignon@fb.com>
parents: 27321
diff changeset
   203
  $ hg update -C .
505a10b504ed crecord: edit during hg crecord should preserve cursor position (issue5041)
Laurent Charignon <lcharignon@fb.com>
parents: 27321
diff changeset
   204
  0 files updated, 0 files merged, 0 files removed, 0 files unresolved
505a10b504ed crecord: edit during hg crecord should preserve cursor position (issue5041)
Laurent Charignon <lcharignon@fb.com>
parents: 27321
diff changeset
   205
  $ echo "foo" > x
505a10b504ed crecord: edit during hg crecord should preserve cursor position (issue5041)
Laurent Charignon <lcharignon@fb.com>
parents: 27321
diff changeset
   206
  $ echo "hello world" >> x
505a10b504ed crecord: edit during hg crecord should preserve cursor position (issue5041)
Laurent Charignon <lcharignon@fb.com>
parents: 27321
diff changeset
   207
  $ echo "bar" >> x
505a10b504ed crecord: edit during hg crecord should preserve cursor position (issue5041)
Laurent Charignon <lcharignon@fb.com>
parents: 27321
diff changeset
   208
  $ cat <<EOF >testModeCommands
505a10b504ed crecord: edit during hg crecord should preserve cursor position (issue5041)
Laurent Charignon <lcharignon@fb.com>
parents: 27321
diff changeset
   209
  > f
505a10b504ed crecord: edit during hg crecord should preserve cursor position (issue5041)
Laurent Charignon <lcharignon@fb.com>
parents: 27321
diff changeset
   210
  > KEY_DOWN
505a10b504ed crecord: edit during hg crecord should preserve cursor position (issue5041)
Laurent Charignon <lcharignon@fb.com>
parents: 27321
diff changeset
   211
  > KEY_DOWN
505a10b504ed crecord: edit during hg crecord should preserve cursor position (issue5041)
Laurent Charignon <lcharignon@fb.com>
parents: 27321
diff changeset
   212
  > KEY_DOWN
505a10b504ed crecord: edit during hg crecord should preserve cursor position (issue5041)
Laurent Charignon <lcharignon@fb.com>
parents: 27321
diff changeset
   213
  > KEY_DOWN
505a10b504ed crecord: edit during hg crecord should preserve cursor position (issue5041)
Laurent Charignon <lcharignon@fb.com>
parents: 27321
diff changeset
   214
  > e
505a10b504ed crecord: edit during hg crecord should preserve cursor position (issue5041)
Laurent Charignon <lcharignon@fb.com>
parents: 27321
diff changeset
   215
  > TOGGLE
505a10b504ed crecord: edit during hg crecord should preserve cursor position (issue5041)
Laurent Charignon <lcharignon@fb.com>
parents: 27321
diff changeset
   216
  > X
505a10b504ed crecord: edit during hg crecord should preserve cursor position (issue5041)
Laurent Charignon <lcharignon@fb.com>
parents: 27321
diff changeset
   217
  > EOF
505a10b504ed crecord: edit during hg crecord should preserve cursor position (issue5041)
Laurent Charignon <lcharignon@fb.com>
parents: 27321
diff changeset
   218
  $ printf "printf 'editor ran\n'; exit 0" > editor.sh
505a10b504ed crecord: edit during hg crecord should preserve cursor position (issue5041)
Laurent Charignon <lcharignon@fb.com>
parents: 27321
diff changeset
   219
  $ HGEDITOR="\"sh\" \"`pwd`/editor.sh\"" hg commit  -i -m "edit hunk" -d "0 0"
505a10b504ed crecord: edit during hg crecord should preserve cursor position (issue5041)
Laurent Charignon <lcharignon@fb.com>
parents: 27321
diff changeset
   220
  editor ran
505a10b504ed crecord: edit during hg crecord should preserve cursor position (issue5041)
Laurent Charignon <lcharignon@fb.com>
parents: 27321
diff changeset
   221
  $ hg cat -r . x
505a10b504ed crecord: edit during hg crecord should preserve cursor position (issue5041)
Laurent Charignon <lcharignon@fb.com>
parents: 27321
diff changeset
   222
  foo
505a10b504ed crecord: edit during hg crecord should preserve cursor position (issue5041)
Laurent Charignon <lcharignon@fb.com>
parents: 27321
diff changeset
   223
  hello world
505a10b504ed crecord: edit during hg crecord should preserve cursor position (issue5041)
Laurent Charignon <lcharignon@fb.com>
parents: 27321
diff changeset
   224
505a10b504ed crecord: edit during hg crecord should preserve cursor position (issue5041)
Laurent Charignon <lcharignon@fb.com>
parents: 27321
diff changeset
   225