tests/test-commit-interactive-curses.t
author Jordi Gutiérrez Hermoso <jordigh@octave.org>
Sun, 20 Mar 2016 21:08:17 -0400
changeset 28638 44319097e7b9
parent 28543 f7874de435c5
child 29862 e7766022a61a
permissions -rw-r--r--
crecord: re-enable reviewing a patch before comitting it The "r" option for this feature was copied into Mercurial from crecord, but the actual implementation never made it into hg until now. It's a moderately useful feature that allows the user to edit the patch in a text editor before comitting it for good. This requires a test, so we must also enable a corresponding testing 'R' option that skips the confirmation dialogue. In addition, we also need a help text for the editor when reviewing the final patch. As for why this is a useful feature if we can already edit hunks in an editor, I would like to offer the following points: * editing hunks does not show the entire patch all at once ** furthermore, the hunk "tree" in the TUI has no root that could be selected for edition * it is helpful to be able to see the entire final patch for confirmation ** within this view, the unselected hunks are hidden, which is visusally cleaner ** this works as a final review of the complete result, which is a bit more difficult to do conceptually via hunk editing * this feature was already in crecord, so it was an oversight to not bring it to core * it works and is consistent with editing hunks
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
28542
71e12fc53b80 ui: add new config flag for interface selection
Simon Farnsworth <simonfar@fb.com>
parents: 27914
diff changeset
     3
  $ cp $HGRCPATH $HGRCPATH.pretest
24344
6b43baac6dfb record: add tests for the curses recording interface
Laurent Charignon <lcharignon@fb.com>
parents:
diff changeset
     4
  $ cat <<EOF >> $HGRCPATH
6b43baac6dfb record: add tests for the curses recording interface
Laurent Charignon <lcharignon@fb.com>
parents:
diff changeset
     5
  > [ui]
6b43baac6dfb record: add tests for the curses recording interface
Laurent Charignon <lcharignon@fb.com>
parents:
diff changeset
     6
  > interactive = true
28543
f7874de435c5 crecord: use ui.interface to choose curses interface
Simon Farnsworth <simonfar@fb.com>
parents: 28542
diff changeset
     7
  > interface = curses
24344
6b43baac6dfb record: add tests for the curses recording interface
Laurent Charignon <lcharignon@fb.com>
parents:
diff changeset
     8
  > [experimental]
6b43baac6dfb record: add tests for the curses recording interface
Laurent Charignon <lcharignon@fb.com>
parents:
diff changeset
     9
  > crecordtest = testModeCommands
6b43baac6dfb record: add tests for the curses recording interface
Laurent Charignon <lcharignon@fb.com>
parents:
diff changeset
    10
  > EOF
6b43baac6dfb record: add tests for the curses recording interface
Laurent Charignon <lcharignon@fb.com>
parents:
diff changeset
    11
6b43baac6dfb record: add tests for the curses recording interface
Laurent Charignon <lcharignon@fb.com>
parents:
diff changeset
    12
  $ hg init a
6b43baac6dfb record: add tests for the curses recording interface
Laurent Charignon <lcharignon@fb.com>
parents:
diff changeset
    13
  $ cd a
6b43baac6dfb record: add tests for the curses recording interface
Laurent Charignon <lcharignon@fb.com>
parents:
diff changeset
    14
6b43baac6dfb record: add tests for the curses recording interface
Laurent Charignon <lcharignon@fb.com>
parents:
diff changeset
    15
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
    16
6b43baac6dfb record: add tests for the curses recording interface
Laurent Charignon <lcharignon@fb.com>
parents:
diff changeset
    17
  $ echo "a" > a
6b43baac6dfb record: add tests for the curses recording interface
Laurent Charignon <lcharignon@fb.com>
parents:
diff changeset
    18
  $ hg add a
6b43baac6dfb record: add tests for the curses recording interface
Laurent Charignon <lcharignon@fb.com>
parents:
diff changeset
    19
  $ cat <<EOF >testModeCommands
6b43baac6dfb record: add tests for the curses recording interface
Laurent Charignon <lcharignon@fb.com>
parents:
diff changeset
    20
  > TOGGLE
6b43baac6dfb record: add tests for the curses recording interface
Laurent Charignon <lcharignon@fb.com>
parents:
diff changeset
    21
  > X
6b43baac6dfb record: add tests for the curses recording interface
Laurent Charignon <lcharignon@fb.com>
parents:
diff changeset
    22
  > EOF
6b43baac6dfb record: add tests for the curses recording interface
Laurent Charignon <lcharignon@fb.com>
parents:
diff changeset
    23
  $ 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
    24
  no changes to record
6b43baac6dfb record: add tests for the curses recording interface
Laurent Charignon <lcharignon@fb.com>
parents:
diff changeset
    25
  $ hg tip
6b43baac6dfb record: add tests for the curses recording interface
Laurent Charignon <lcharignon@fb.com>
parents:
diff changeset
    26
  changeset:   -1:000000000000
6b43baac6dfb record: add tests for the curses recording interface
Laurent Charignon <lcharignon@fb.com>
parents:
diff changeset
    27
  tag:         tip
6b43baac6dfb record: add tests for the curses recording interface
Laurent Charignon <lcharignon@fb.com>
parents:
diff changeset
    28
  user:        
6b43baac6dfb record: add tests for the curses recording interface
Laurent Charignon <lcharignon@fb.com>
parents:
diff changeset
    29
  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
    30
  
6b43baac6dfb record: add tests for the curses recording interface
Laurent Charignon <lcharignon@fb.com>
parents:
diff changeset
    31
6b43baac6dfb record: add tests for the curses recording interface
Laurent Charignon <lcharignon@fb.com>
parents:
diff changeset
    32
Committing some changes
6b43baac6dfb record: add tests for the curses recording interface
Laurent Charignon <lcharignon@fb.com>
parents:
diff changeset
    33
6b43baac6dfb record: add tests for the curses recording interface
Laurent Charignon <lcharignon@fb.com>
parents:
diff changeset
    34
  $ cat <<EOF >testModeCommands
6b43baac6dfb record: add tests for the curses recording interface
Laurent Charignon <lcharignon@fb.com>
parents:
diff changeset
    35
  > X
6b43baac6dfb record: add tests for the curses recording interface
Laurent Charignon <lcharignon@fb.com>
parents:
diff changeset
    36
  > EOF
6b43baac6dfb record: add tests for the curses recording interface
Laurent Charignon <lcharignon@fb.com>
parents:
diff changeset
    37
  $ 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
    38
  $ hg tip
6b43baac6dfb record: add tests for the curses recording interface
Laurent Charignon <lcharignon@fb.com>
parents:
diff changeset
    39
  changeset:   0:cb9a9f314b8b
6b43baac6dfb record: add tests for the curses recording interface
Laurent Charignon <lcharignon@fb.com>
parents:
diff changeset
    40
  tag:         tip
6b43baac6dfb record: add tests for the curses recording interface
Laurent Charignon <lcharignon@fb.com>
parents:
diff changeset
    41
  user:        test
6b43baac6dfb record: add tests for the curses recording interface
Laurent Charignon <lcharignon@fb.com>
parents:
diff changeset
    42
  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
    43
  summary:     a
6b43baac6dfb record: add tests for the curses recording interface
Laurent Charignon <lcharignon@fb.com>
parents:
diff changeset
    44
  
27321
dcdf0a52ad36 crecord: add dictionary to default return value of filterpatch
Laurent Charignon <lcharignon@fb.com>
parents: 27156
diff changeset
    45
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
    46
  $ hg commit -i
dcdf0a52ad36 crecord: add dictionary to default return value of filterpatch
Laurent Charignon <lcharignon@fb.com>
parents: 27156
diff changeset
    47
  no changes to record
dcdf0a52ad36 crecord: add dictionary to default return value of filterpatch
Laurent Charignon <lcharignon@fb.com>
parents: 27156
diff changeset
    48
24344
6b43baac6dfb record: add tests for the curses recording interface
Laurent Charignon <lcharignon@fb.com>
parents:
diff changeset
    49
Committing only one file
6b43baac6dfb record: add tests for the curses recording interface
Laurent Charignon <lcharignon@fb.com>
parents:
diff changeset
    50
6b43baac6dfb record: add tests for the curses recording interface
Laurent Charignon <lcharignon@fb.com>
parents:
diff changeset
    51
  $ 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
    52
  >>> 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
    53
  $ hg add b
6b43baac6dfb record: add tests for the curses recording interface
Laurent Charignon <lcharignon@fb.com>
parents:
diff changeset
    54
  $ cat <<EOF >testModeCommands
6b43baac6dfb record: add tests for the curses recording interface
Laurent Charignon <lcharignon@fb.com>
parents:
diff changeset
    55
  > TOGGLE
6b43baac6dfb record: add tests for the curses recording interface
Laurent Charignon <lcharignon@fb.com>
parents:
diff changeset
    56
  > KEY_DOWN
6b43baac6dfb record: add tests for the curses recording interface
Laurent Charignon <lcharignon@fb.com>
parents:
diff changeset
    57
  > X
6b43baac6dfb record: add tests for the curses recording interface
Laurent Charignon <lcharignon@fb.com>
parents:
diff changeset
    58
  > EOF
6b43baac6dfb record: add tests for the curses recording interface
Laurent Charignon <lcharignon@fb.com>
parents:
diff changeset
    59
  $ 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
    60
  $ hg tip
6b43baac6dfb record: add tests for the curses recording interface
Laurent Charignon <lcharignon@fb.com>
parents:
diff changeset
    61
  changeset:   1:fb2705a663ea
6b43baac6dfb record: add tests for the curses recording interface
Laurent Charignon <lcharignon@fb.com>
parents:
diff changeset
    62
  tag:         tip
6b43baac6dfb record: add tests for the curses recording interface
Laurent Charignon <lcharignon@fb.com>
parents:
diff changeset
    63
  user:        test
6b43baac6dfb record: add tests for the curses recording interface
Laurent Charignon <lcharignon@fb.com>
parents:
diff changeset
    64
  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
    65
  summary:     one file
6b43baac6dfb record: add tests for the curses recording interface
Laurent Charignon <lcharignon@fb.com>
parents:
diff changeset
    66
  
6b43baac6dfb record: add tests for the curses recording interface
Laurent Charignon <lcharignon@fb.com>
parents:
diff changeset
    67
  $ hg cat -r tip a
6b43baac6dfb record: add tests for the curses recording interface
Laurent Charignon <lcharignon@fb.com>
parents:
diff changeset
    68
  a
6b43baac6dfb record: add tests for the curses recording interface
Laurent Charignon <lcharignon@fb.com>
parents:
diff changeset
    69
  $ cat 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
  a
6b43baac6dfb record: add tests for the curses recording interface
Laurent Charignon <lcharignon@fb.com>
parents:
diff changeset
    72
25557
52c552a05414 crecord: exit edition of hunk with non-zero status does not interrupt session
Laurent Charignon <lcharignon@fb.com>
parents: 24837
diff changeset
    73
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
    74
6b43baac6dfb record: add tests for the curses recording interface
Laurent Charignon <lcharignon@fb.com>
parents:
diff changeset
    75
- 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
    76
- unfold it
6b43baac6dfb record: add tests for the curses recording interface
Laurent Charignon <lcharignon@fb.com>
parents:
diff changeset
    77
- 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
    78
- toggle the second hunk
27156
55fa7c3900ae commit: add amend mode for commit -i
Laurent Charignon <lcharignon@fb.com>
parents: 26781
diff changeset
    79
- 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
    80
- 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
    81
- commit
6b43baac6dfb record: add tests for the curses recording interface
Laurent Charignon <lcharignon@fb.com>
parents:
diff changeset
    82
25557
52c552a05414 crecord: exit edition of hunk with non-zero status does not interrupt session
Laurent Charignon <lcharignon@fb.com>
parents: 24837
diff changeset
    83
  $ 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
    84
  $ echo "x" > c
6b43baac6dfb record: add tests for the curses recording interface
Laurent Charignon <lcharignon@fb.com>
parents:
diff changeset
    85
  $ cat b >> c
6b43baac6dfb record: add tests for the curses recording interface
Laurent Charignon <lcharignon@fb.com>
parents:
diff changeset
    86
  $ echo "y" >> c
6b43baac6dfb record: add tests for the curses recording interface
Laurent Charignon <lcharignon@fb.com>
parents:
diff changeset
    87
  $ mv c b
6b43baac6dfb record: add tests for the curses recording interface
Laurent Charignon <lcharignon@fb.com>
parents:
diff changeset
    88
  $ cat <<EOF >testModeCommands
6b43baac6dfb record: add tests for the curses recording interface
Laurent Charignon <lcharignon@fb.com>
parents:
diff changeset
    89
  > A
6b43baac6dfb record: add tests for the curses recording interface
Laurent Charignon <lcharignon@fb.com>
parents:
diff changeset
    90
  > KEY_DOWN
6b43baac6dfb record: add tests for the curses recording interface
Laurent Charignon <lcharignon@fb.com>
parents:
diff changeset
    91
  > f
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
  > KEY_DOWN
6b43baac6dfb record: add tests for the curses recording interface
Laurent Charignon <lcharignon@fb.com>
parents:
diff changeset
    96
  > TOGGLE
27156
55fa7c3900ae commit: add amend mode for commit -i
Laurent Charignon <lcharignon@fb.com>
parents: 26781
diff changeset
    97
  > a
55fa7c3900ae commit: add amend mode for commit -i
Laurent Charignon <lcharignon@fb.com>
parents: 26781
diff changeset
    98
  > 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
    99
  > e
24344
6b43baac6dfb record: add tests for the curses recording interface
Laurent Charignon <lcharignon@fb.com>
parents:
diff changeset
   100
  > X
6b43baac6dfb record: add tests for the curses recording interface
Laurent Charignon <lcharignon@fb.com>
parents:
diff changeset
   101
  > 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
   102
  $ 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
   103
  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
   104
  $ rm editor.sh
24344
6b43baac6dfb record: add tests for the curses recording interface
Laurent Charignon <lcharignon@fb.com>
parents:
diff changeset
   105
  $ hg tip
6b43baac6dfb record: add tests for the curses recording interface
Laurent Charignon <lcharignon@fb.com>
parents:
diff changeset
   106
  changeset:   2:7d10dfe755a8
6b43baac6dfb record: add tests for the curses recording interface
Laurent Charignon <lcharignon@fb.com>
parents:
diff changeset
   107
  tag:         tip
6b43baac6dfb record: add tests for the curses recording interface
Laurent Charignon <lcharignon@fb.com>
parents:
diff changeset
   108
  user:        test
6b43baac6dfb record: add tests for the curses recording interface
Laurent Charignon <lcharignon@fb.com>
parents:
diff changeset
   109
  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
   110
  summary:     one hunk
6b43baac6dfb record: add tests for the curses recording interface
Laurent Charignon <lcharignon@fb.com>
parents:
diff changeset
   111
  
6b43baac6dfb record: add tests for the curses recording interface
Laurent Charignon <lcharignon@fb.com>
parents:
diff changeset
   112
  $ hg cat -r tip b
6b43baac6dfb record: add tests for the curses recording interface
Laurent Charignon <lcharignon@fb.com>
parents:
diff changeset
   113
  1
6b43baac6dfb record: add tests for the curses recording interface
Laurent Charignon <lcharignon@fb.com>
parents:
diff changeset
   114
  2
6b43baac6dfb record: add tests for the curses recording interface
Laurent Charignon <lcharignon@fb.com>
parents:
diff changeset
   115
  3
6b43baac6dfb record: add tests for the curses recording interface
Laurent Charignon <lcharignon@fb.com>
parents:
diff changeset
   116
  4
6b43baac6dfb record: add tests for the curses recording interface
Laurent Charignon <lcharignon@fb.com>
parents:
diff changeset
   117
  5
6b43baac6dfb record: add tests for the curses recording interface
Laurent Charignon <lcharignon@fb.com>
parents:
diff changeset
   118
  6
6b43baac6dfb record: add tests for the curses recording interface
Laurent Charignon <lcharignon@fb.com>
parents:
diff changeset
   119
  7
6b43baac6dfb record: add tests for the curses recording interface
Laurent Charignon <lcharignon@fb.com>
parents:
diff changeset
   120
  8
6b43baac6dfb record: add tests for the curses recording interface
Laurent Charignon <lcharignon@fb.com>
parents:
diff changeset
   121
  9
6b43baac6dfb record: add tests for the curses recording interface
Laurent Charignon <lcharignon@fb.com>
parents:
diff changeset
   122
  10
6b43baac6dfb record: add tests for the curses recording interface
Laurent Charignon <lcharignon@fb.com>
parents:
diff changeset
   123
  y
6b43baac6dfb record: add tests for the curses recording interface
Laurent Charignon <lcharignon@fb.com>
parents:
diff changeset
   124
  $ cat b
6b43baac6dfb record: add tests for the curses recording interface
Laurent Charignon <lcharignon@fb.com>
parents:
diff changeset
   125
  x
6b43baac6dfb record: add tests for the curses recording interface
Laurent Charignon <lcharignon@fb.com>
parents:
diff changeset
   126
  1
6b43baac6dfb record: add tests for the curses recording interface
Laurent Charignon <lcharignon@fb.com>
parents:
diff changeset
   127
  2
6b43baac6dfb record: add tests for the curses recording interface
Laurent Charignon <lcharignon@fb.com>
parents:
diff changeset
   128
  3
6b43baac6dfb record: add tests for the curses recording interface
Laurent Charignon <lcharignon@fb.com>
parents:
diff changeset
   129
  4
6b43baac6dfb record: add tests for the curses recording interface
Laurent Charignon <lcharignon@fb.com>
parents:
diff changeset
   130
  5
6b43baac6dfb record: add tests for the curses recording interface
Laurent Charignon <lcharignon@fb.com>
parents:
diff changeset
   131
  6
6b43baac6dfb record: add tests for the curses recording interface
Laurent Charignon <lcharignon@fb.com>
parents:
diff changeset
   132
  7
6b43baac6dfb record: add tests for the curses recording interface
Laurent Charignon <lcharignon@fb.com>
parents:
diff changeset
   133
  8
6b43baac6dfb record: add tests for the curses recording interface
Laurent Charignon <lcharignon@fb.com>
parents:
diff changeset
   134
  9
6b43baac6dfb record: add tests for the curses recording interface
Laurent Charignon <lcharignon@fb.com>
parents:
diff changeset
   135
  10
6b43baac6dfb record: add tests for the curses recording interface
Laurent Charignon <lcharignon@fb.com>
parents:
diff changeset
   136
  y
6b43baac6dfb record: add tests for the curses recording interface
Laurent Charignon <lcharignon@fb.com>
parents:
diff changeset
   137
  $ hg commit -m "other hunks"
6b43baac6dfb record: add tests for the curses recording interface
Laurent Charignon <lcharignon@fb.com>
parents:
diff changeset
   138
  $ hg tip
6b43baac6dfb record: add tests for the curses recording interface
Laurent Charignon <lcharignon@fb.com>
parents:
diff changeset
   139
  changeset:   3:a6735021574d
6b43baac6dfb record: add tests for the curses recording interface
Laurent Charignon <lcharignon@fb.com>
parents:
diff changeset
   140
  tag:         tip
6b43baac6dfb record: add tests for the curses recording interface
Laurent Charignon <lcharignon@fb.com>
parents:
diff changeset
   141
  user:        test
6b43baac6dfb record: add tests for the curses recording interface
Laurent Charignon <lcharignon@fb.com>
parents:
diff changeset
   142
  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
   143
  summary:     other hunks
6b43baac6dfb record: add tests for the curses recording interface
Laurent Charignon <lcharignon@fb.com>
parents:
diff changeset
   144
  
6b43baac6dfb record: add tests for the curses recording interface
Laurent Charignon <lcharignon@fb.com>
parents:
diff changeset
   145
  $ hg cat -r tip b
6b43baac6dfb record: add tests for the curses recording interface
Laurent Charignon <lcharignon@fb.com>
parents:
diff changeset
   146
  x
6b43baac6dfb record: add tests for the curses recording interface
Laurent Charignon <lcharignon@fb.com>
parents:
diff changeset
   147
  1
6b43baac6dfb record: add tests for the curses recording interface
Laurent Charignon <lcharignon@fb.com>
parents:
diff changeset
   148
  2
6b43baac6dfb record: add tests for the curses recording interface
Laurent Charignon <lcharignon@fb.com>
parents:
diff changeset
   149
  3
6b43baac6dfb record: add tests for the curses recording interface
Laurent Charignon <lcharignon@fb.com>
parents:
diff changeset
   150
  4
6b43baac6dfb record: add tests for the curses recording interface
Laurent Charignon <lcharignon@fb.com>
parents:
diff changeset
   151
  5
6b43baac6dfb record: add tests for the curses recording interface
Laurent Charignon <lcharignon@fb.com>
parents:
diff changeset
   152
  6
6b43baac6dfb record: add tests for the curses recording interface
Laurent Charignon <lcharignon@fb.com>
parents:
diff changeset
   153
  7
6b43baac6dfb record: add tests for the curses recording interface
Laurent Charignon <lcharignon@fb.com>
parents:
diff changeset
   154
  8
6b43baac6dfb record: add tests for the curses recording interface
Laurent Charignon <lcharignon@fb.com>
parents:
diff changeset
   155
  9
6b43baac6dfb record: add tests for the curses recording interface
Laurent Charignon <lcharignon@fb.com>
parents:
diff changeset
   156
  10
6b43baac6dfb record: add tests for the curses recording interface
Laurent Charignon <lcharignon@fb.com>
parents:
diff changeset
   157
  y
6b43baac6dfb record: add tests for the curses recording interface
Laurent Charignon <lcharignon@fb.com>
parents:
diff changeset
   158
24469
e71053ef0c46 record_curses: add test for newly added files
Laurent Charignon <lcharignon@fb.com>
parents: 24435
diff changeset
   159
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
   160
24469
e71053ef0c46 record_curses: add test for newly added files
Laurent Charignon <lcharignon@fb.com>
parents: 24435
diff changeset
   161
  $ hg update -C .
24837
edf907bd8144 record: fix record with change on moved file crashes (issue4619)
Laurent Charignon <lcharignon@fb.com>
parents: 24469
diff changeset
   162
  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
   163
  $ echo "hello" > x
e71053ef0c46 record_curses: add test for newly added files
Laurent Charignon <lcharignon@fb.com>
parents: 24435
diff changeset
   164
  $ hg add x
e71053ef0c46 record_curses: add test for newly added files
Laurent Charignon <lcharignon@fb.com>
parents: 24435
diff changeset
   165
  $ cat <<EOF >testModeCommands
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
  > TOGGLE
e71053ef0c46 record_curses: add test for newly added files
Laurent Charignon <lcharignon@fb.com>
parents: 24435
diff changeset
   168
  > X
e71053ef0c46 record_curses: add test for newly added files
Laurent Charignon <lcharignon@fb.com>
parents: 24435
diff changeset
   169
  > EOF
e71053ef0c46 record_curses: add test for newly added files
Laurent Charignon <lcharignon@fb.com>
parents: 24435
diff changeset
   170
  $ hg st
e71053ef0c46 record_curses: add test for newly added files
Laurent Charignon <lcharignon@fb.com>
parents: 24435
diff changeset
   171
  A x
e71053ef0c46 record_curses: add test for newly added files
Laurent Charignon <lcharignon@fb.com>
parents: 24435
diff changeset
   172
  ? testModeCommands
e71053ef0c46 record_curses: add test for newly added files
Laurent Charignon <lcharignon@fb.com>
parents: 24435
diff changeset
   173
  $ 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
   174
  $ hg st
e71053ef0c46 record_curses: add test for newly added files
Laurent Charignon <lcharignon@fb.com>
parents: 24435
diff changeset
   175
  ? testModeCommands
e71053ef0c46 record_curses: add test for newly added files
Laurent Charignon <lcharignon@fb.com>
parents: 24435
diff changeset
   176
27156
55fa7c3900ae commit: add amend mode for commit -i
Laurent Charignon <lcharignon@fb.com>
parents: 26781
diff changeset
   177
Amend option works
55fa7c3900ae commit: add amend mode for commit -i
Laurent Charignon <lcharignon@fb.com>
parents: 26781
diff changeset
   178
  $ echo "hello world" > x
55fa7c3900ae commit: add amend mode for commit -i
Laurent Charignon <lcharignon@fb.com>
parents: 26781
diff changeset
   179
  $ hg diff -c .
55fa7c3900ae commit: add amend mode for commit -i
Laurent Charignon <lcharignon@fb.com>
parents: 26781
diff changeset
   180
  diff -r a6735021574d -r 2b0e9be4d336 x
55fa7c3900ae commit: add amend mode for commit -i
Laurent Charignon <lcharignon@fb.com>
parents: 26781
diff changeset
   181
  --- /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
   182
  +++ 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
   183
  @@ -0,0 +1,1 @@
55fa7c3900ae commit: add amend mode for commit -i
Laurent Charignon <lcharignon@fb.com>
parents: 26781
diff changeset
   184
  +hello
55fa7c3900ae commit: add amend mode for commit -i
Laurent Charignon <lcharignon@fb.com>
parents: 26781
diff changeset
   185
  $ cat <<EOF >testModeCommands
55fa7c3900ae commit: add amend mode for commit -i
Laurent Charignon <lcharignon@fb.com>
parents: 26781
diff changeset
   186
  > a
55fa7c3900ae commit: add amend mode for commit -i
Laurent Charignon <lcharignon@fb.com>
parents: 26781
diff changeset
   187
  > X
55fa7c3900ae commit: add amend mode for commit -i
Laurent Charignon <lcharignon@fb.com>
parents: 26781
diff changeset
   188
  > EOF
55fa7c3900ae commit: add amend mode for commit -i
Laurent Charignon <lcharignon@fb.com>
parents: 26781
diff changeset
   189
  $ 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
   190
  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
   191
  $ hg diff -c .
55fa7c3900ae commit: add amend mode for commit -i
Laurent Charignon <lcharignon@fb.com>
parents: 26781
diff changeset
   192
  diff -r a6735021574d -r c1d239d165ae x
55fa7c3900ae commit: add amend mode for commit -i
Laurent Charignon <lcharignon@fb.com>
parents: 26781
diff changeset
   193
  --- /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
   194
  +++ 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
   195
  @@ -0,0 +1,1 @@
55fa7c3900ae commit: add amend mode for commit -i
Laurent Charignon <lcharignon@fb.com>
parents: 26781
diff changeset
   196
  +hello world
27914
505a10b504ed crecord: edit during hg crecord should preserve cursor position (issue5041)
Laurent Charignon <lcharignon@fb.com>
parents: 27321
diff changeset
   197
505a10b504ed crecord: edit during hg crecord should preserve cursor position (issue5041)
Laurent Charignon <lcharignon@fb.com>
parents: 27321
diff changeset
   198
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
   199
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
   200
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
   201
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
   202
of the edit.
505a10b504ed crecord: edit during hg crecord should preserve cursor position (issue5041)
Laurent Charignon <lcharignon@fb.com>
parents: 27321
diff changeset
   203
505a10b504ed crecord: edit during hg crecord should preserve cursor position (issue5041)
Laurent Charignon <lcharignon@fb.com>
parents: 27321
diff changeset
   204
  $ hg update -C .
505a10b504ed crecord: edit during hg crecord should preserve cursor position (issue5041)
Laurent Charignon <lcharignon@fb.com>
parents: 27321
diff changeset
   205
  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
   206
  $ echo "foo" > x
505a10b504ed crecord: edit during hg crecord should preserve cursor position (issue5041)
Laurent Charignon <lcharignon@fb.com>
parents: 27321
diff changeset
   207
  $ echo "hello world" >> x
505a10b504ed crecord: edit during hg crecord should preserve cursor position (issue5041)
Laurent Charignon <lcharignon@fb.com>
parents: 27321
diff changeset
   208
  $ echo "bar" >> x
505a10b504ed crecord: edit during hg crecord should preserve cursor position (issue5041)
Laurent Charignon <lcharignon@fb.com>
parents: 27321
diff changeset
   209
  $ cat <<EOF >testModeCommands
505a10b504ed crecord: edit during hg crecord should preserve cursor position (issue5041)
Laurent Charignon <lcharignon@fb.com>
parents: 27321
diff changeset
   210
  > f
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
  > KEY_DOWN
505a10b504ed crecord: edit during hg crecord should preserve cursor position (issue5041)
Laurent Charignon <lcharignon@fb.com>
parents: 27321
diff changeset
   215
  > e
505a10b504ed crecord: edit during hg crecord should preserve cursor position (issue5041)
Laurent Charignon <lcharignon@fb.com>
parents: 27321
diff changeset
   216
  > TOGGLE
505a10b504ed crecord: edit during hg crecord should preserve cursor position (issue5041)
Laurent Charignon <lcharignon@fb.com>
parents: 27321
diff changeset
   217
  > X
505a10b504ed crecord: edit during hg crecord should preserve cursor position (issue5041)
Laurent Charignon <lcharignon@fb.com>
parents: 27321
diff changeset
   218
  > EOF
505a10b504ed crecord: edit during hg crecord should preserve cursor position (issue5041)
Laurent Charignon <lcharignon@fb.com>
parents: 27321
diff changeset
   219
  $ 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
   220
  $ 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
   221
  editor ran
505a10b504ed crecord: edit during hg crecord should preserve cursor position (issue5041)
Laurent Charignon <lcharignon@fb.com>
parents: 27321
diff changeset
   222
  $ hg cat -r . x
505a10b504ed crecord: edit during hg crecord should preserve cursor position (issue5041)
Laurent Charignon <lcharignon@fb.com>
parents: 27321
diff changeset
   223
  foo
505a10b504ed crecord: edit during hg crecord should preserve cursor position (issue5041)
Laurent Charignon <lcharignon@fb.com>
parents: 27321
diff changeset
   224
  hello world
505a10b504ed crecord: edit during hg crecord should preserve cursor position (issue5041)
Laurent Charignon <lcharignon@fb.com>
parents: 27321
diff changeset
   225
28638
44319097e7b9 crecord: re-enable reviewing a patch before comitting it
Jordi Gutiérrez Hermoso <jordigh@octave.org>
parents: 28543
diff changeset
   226
Testing the review option. The entire final filtered patch should show
44319097e7b9 crecord: re-enable reviewing a patch before comitting it
Jordi Gutiérrez Hermoso <jordigh@octave.org>
parents: 28543
diff changeset
   227
up in the editor and be editable. We will unselect the second file and
44319097e7b9 crecord: re-enable reviewing a patch before comitting it
Jordi Gutiérrez Hermoso <jordigh@octave.org>
parents: 28543
diff changeset
   228
the first hunk of the third file. During review, we will decide that
44319097e7b9 crecord: re-enable reviewing a patch before comitting it
Jordi Gutiérrez Hermoso <jordigh@octave.org>
parents: 28543
diff changeset
   229
"lower" sounds better than "bottom", and the final commit should
44319097e7b9 crecord: re-enable reviewing a patch before comitting it
Jordi Gutiérrez Hermoso <jordigh@octave.org>
parents: 28543
diff changeset
   230
reflect this edition.
27914
505a10b504ed crecord: edit during hg crecord should preserve cursor position (issue5041)
Laurent Charignon <lcharignon@fb.com>
parents: 27321
diff changeset
   231
28638
44319097e7b9 crecord: re-enable reviewing a patch before comitting it
Jordi Gutiérrez Hermoso <jordigh@octave.org>
parents: 28543
diff changeset
   232
  $ hg update -C .
44319097e7b9 crecord: re-enable reviewing a patch before comitting it
Jordi Gutiérrez Hermoso <jordigh@octave.org>
parents: 28543
diff changeset
   233
  1 files updated, 0 files merged, 0 files removed, 0 files unresolved
44319097e7b9 crecord: re-enable reviewing a patch before comitting it
Jordi Gutiérrez Hermoso <jordigh@octave.org>
parents: 28543
diff changeset
   234
  $ echo "top" > c
44319097e7b9 crecord: re-enable reviewing a patch before comitting it
Jordi Gutiérrez Hermoso <jordigh@octave.org>
parents: 28543
diff changeset
   235
  $ cat x >> c
44319097e7b9 crecord: re-enable reviewing a patch before comitting it
Jordi Gutiérrez Hermoso <jordigh@octave.org>
parents: 28543
diff changeset
   236
  $ echo "bottom" >> c
44319097e7b9 crecord: re-enable reviewing a patch before comitting it
Jordi Gutiérrez Hermoso <jordigh@octave.org>
parents: 28543
diff changeset
   237
  $ mv c x
44319097e7b9 crecord: re-enable reviewing a patch before comitting it
Jordi Gutiérrez Hermoso <jordigh@octave.org>
parents: 28543
diff changeset
   238
  $ echo "third a" >> a
44319097e7b9 crecord: re-enable reviewing a patch before comitting it
Jordi Gutiérrez Hermoso <jordigh@octave.org>
parents: 28543
diff changeset
   239
  $ echo "we will unselect this" >> b
44319097e7b9 crecord: re-enable reviewing a patch before comitting it
Jordi Gutiérrez Hermoso <jordigh@octave.org>
parents: 28543
diff changeset
   240
44319097e7b9 crecord: re-enable reviewing a patch before comitting it
Jordi Gutiérrez Hermoso <jordigh@octave.org>
parents: 28543
diff changeset
   241
  $ cat > editor.sh <<EOF
44319097e7b9 crecord: re-enable reviewing a patch before comitting it
Jordi Gutiérrez Hermoso <jordigh@octave.org>
parents: 28543
diff changeset
   242
  > cat "\$1"
44319097e7b9 crecord: re-enable reviewing a patch before comitting it
Jordi Gutiérrez Hermoso <jordigh@octave.org>
parents: 28543
diff changeset
   243
  > cat "\$1" | sed s/bottom/lower/ > tmp
44319097e7b9 crecord: re-enable reviewing a patch before comitting it
Jordi Gutiérrez Hermoso <jordigh@octave.org>
parents: 28543
diff changeset
   244
  > mv tmp "\$1"
44319097e7b9 crecord: re-enable reviewing a patch before comitting it
Jordi Gutiérrez Hermoso <jordigh@octave.org>
parents: 28543
diff changeset
   245
  > EOF
44319097e7b9 crecord: re-enable reviewing a patch before comitting it
Jordi Gutiérrez Hermoso <jordigh@octave.org>
parents: 28543
diff changeset
   246
  $ cat > testModeCommands <<EOF
44319097e7b9 crecord: re-enable reviewing a patch before comitting it
Jordi Gutiérrez Hermoso <jordigh@octave.org>
parents: 28543
diff changeset
   247
  > KEY_DOWN
44319097e7b9 crecord: re-enable reviewing a patch before comitting it
Jordi Gutiérrez Hermoso <jordigh@octave.org>
parents: 28543
diff changeset
   248
  > TOGGLE
44319097e7b9 crecord: re-enable reviewing a patch before comitting it
Jordi Gutiérrez Hermoso <jordigh@octave.org>
parents: 28543
diff changeset
   249
  > KEY_DOWN
44319097e7b9 crecord: re-enable reviewing a patch before comitting it
Jordi Gutiérrez Hermoso <jordigh@octave.org>
parents: 28543
diff changeset
   250
  > f
44319097e7b9 crecord: re-enable reviewing a patch before comitting it
Jordi Gutiérrez Hermoso <jordigh@octave.org>
parents: 28543
diff changeset
   251
  > KEY_DOWN
44319097e7b9 crecord: re-enable reviewing a patch before comitting it
Jordi Gutiérrez Hermoso <jordigh@octave.org>
parents: 28543
diff changeset
   252
  > TOGGLE
44319097e7b9 crecord: re-enable reviewing a patch before comitting it
Jordi Gutiérrez Hermoso <jordigh@octave.org>
parents: 28543
diff changeset
   253
  > R
44319097e7b9 crecord: re-enable reviewing a patch before comitting it
Jordi Gutiérrez Hermoso <jordigh@octave.org>
parents: 28543
diff changeset
   254
  > EOF
44319097e7b9 crecord: re-enable reviewing a patch before comitting it
Jordi Gutiérrez Hermoso <jordigh@octave.org>
parents: 28543
diff changeset
   255
44319097e7b9 crecord: re-enable reviewing a patch before comitting it
Jordi Gutiérrez Hermoso <jordigh@octave.org>
parents: 28543
diff changeset
   256
  $ HGEDITOR="\"sh\" \"`pwd`/editor.sh\"" hg commit  -i -m "review hunks" -d "0 0"
44319097e7b9 crecord: re-enable reviewing a patch before comitting it
Jordi Gutiérrez Hermoso <jordigh@octave.org>
parents: 28543
diff changeset
   257
  # To remove '-' lines, make them ' ' lines (context).
44319097e7b9 crecord: re-enable reviewing a patch before comitting it
Jordi Gutiérrez Hermoso <jordigh@octave.org>
parents: 28543
diff changeset
   258
  # To remove '+' lines, delete them.
44319097e7b9 crecord: re-enable reviewing a patch before comitting it
Jordi Gutiérrez Hermoso <jordigh@octave.org>
parents: 28543
diff changeset
   259
  # Lines starting with # will be removed from the patch.
44319097e7b9 crecord: re-enable reviewing a patch before comitting it
Jordi Gutiérrez Hermoso <jordigh@octave.org>
parents: 28543
diff changeset
   260
  #
44319097e7b9 crecord: re-enable reviewing a patch before comitting it
Jordi Gutiérrez Hermoso <jordigh@octave.org>
parents: 28543
diff changeset
   261
  # If the patch applies cleanly, the edited patch will immediately
44319097e7b9 crecord: re-enable reviewing a patch before comitting it
Jordi Gutiérrez Hermoso <jordigh@octave.org>
parents: 28543
diff changeset
   262
  # be finalised. If it does not apply cleanly, rejects files will be
44319097e7b9 crecord: re-enable reviewing a patch before comitting it
Jordi Gutiérrez Hermoso <jordigh@octave.org>
parents: 28543
diff changeset
   263
  # generated. You can use those when you try again.
44319097e7b9 crecord: re-enable reviewing a patch before comitting it
Jordi Gutiérrez Hermoso <jordigh@octave.org>
parents: 28543
diff changeset
   264
  diff --git a/a b/a
44319097e7b9 crecord: re-enable reviewing a patch before comitting it
Jordi Gutiérrez Hermoso <jordigh@octave.org>
parents: 28543
diff changeset
   265
  --- a/a
44319097e7b9 crecord: re-enable reviewing a patch before comitting it
Jordi Gutiérrez Hermoso <jordigh@octave.org>
parents: 28543
diff changeset
   266
  +++ b/a
44319097e7b9 crecord: re-enable reviewing a patch before comitting it
Jordi Gutiérrez Hermoso <jordigh@octave.org>
parents: 28543
diff changeset
   267
  @@ -1,2 +1,3 @@
44319097e7b9 crecord: re-enable reviewing a patch before comitting it
Jordi Gutiérrez Hermoso <jordigh@octave.org>
parents: 28543
diff changeset
   268
   a
44319097e7b9 crecord: re-enable reviewing a patch before comitting it
Jordi Gutiérrez Hermoso <jordigh@octave.org>
parents: 28543
diff changeset
   269
   a
44319097e7b9 crecord: re-enable reviewing a patch before comitting it
Jordi Gutiérrez Hermoso <jordigh@octave.org>
parents: 28543
diff changeset
   270
  +third a
44319097e7b9 crecord: re-enable reviewing a patch before comitting it
Jordi Gutiérrez Hermoso <jordigh@octave.org>
parents: 28543
diff changeset
   271
  diff --git a/x b/x
44319097e7b9 crecord: re-enable reviewing a patch before comitting it
Jordi Gutiérrez Hermoso <jordigh@octave.org>
parents: 28543
diff changeset
   272
  --- a/x
44319097e7b9 crecord: re-enable reviewing a patch before comitting it
Jordi Gutiérrez Hermoso <jordigh@octave.org>
parents: 28543
diff changeset
   273
  +++ b/x
44319097e7b9 crecord: re-enable reviewing a patch before comitting it
Jordi Gutiérrez Hermoso <jordigh@octave.org>
parents: 28543
diff changeset
   274
  @@ -1,2 +1,3 @@
44319097e7b9 crecord: re-enable reviewing a patch before comitting it
Jordi Gutiérrez Hermoso <jordigh@octave.org>
parents: 28543
diff changeset
   275
   foo
44319097e7b9 crecord: re-enable reviewing a patch before comitting it
Jordi Gutiérrez Hermoso <jordigh@octave.org>
parents: 28543
diff changeset
   276
   hello world
44319097e7b9 crecord: re-enable reviewing a patch before comitting it
Jordi Gutiérrez Hermoso <jordigh@octave.org>
parents: 28543
diff changeset
   277
  +bottom
44319097e7b9 crecord: re-enable reviewing a patch before comitting it
Jordi Gutiérrez Hermoso <jordigh@octave.org>
parents: 28543
diff changeset
   278
44319097e7b9 crecord: re-enable reviewing a patch before comitting it
Jordi Gutiérrez Hermoso <jordigh@octave.org>
parents: 28543
diff changeset
   279
  $ hg cat -r . a
44319097e7b9 crecord: re-enable reviewing a patch before comitting it
Jordi Gutiérrez Hermoso <jordigh@octave.org>
parents: 28543
diff changeset
   280
  a
44319097e7b9 crecord: re-enable reviewing a patch before comitting it
Jordi Gutiérrez Hermoso <jordigh@octave.org>
parents: 28543
diff changeset
   281
  a
44319097e7b9 crecord: re-enable reviewing a patch before comitting it
Jordi Gutiérrez Hermoso <jordigh@octave.org>
parents: 28543
diff changeset
   282
  third a
44319097e7b9 crecord: re-enable reviewing a patch before comitting it
Jordi Gutiérrez Hermoso <jordigh@octave.org>
parents: 28543
diff changeset
   283
44319097e7b9 crecord: re-enable reviewing a patch before comitting it
Jordi Gutiérrez Hermoso <jordigh@octave.org>
parents: 28543
diff changeset
   284
  $ hg cat -r . b
44319097e7b9 crecord: re-enable reviewing a patch before comitting it
Jordi Gutiérrez Hermoso <jordigh@octave.org>
parents: 28543
diff changeset
   285
  x
44319097e7b9 crecord: re-enable reviewing a patch before comitting it
Jordi Gutiérrez Hermoso <jordigh@octave.org>
parents: 28543
diff changeset
   286
  1
44319097e7b9 crecord: re-enable reviewing a patch before comitting it
Jordi Gutiérrez Hermoso <jordigh@octave.org>
parents: 28543
diff changeset
   287
  2
44319097e7b9 crecord: re-enable reviewing a patch before comitting it
Jordi Gutiérrez Hermoso <jordigh@octave.org>
parents: 28543
diff changeset
   288
  3
44319097e7b9 crecord: re-enable reviewing a patch before comitting it
Jordi Gutiérrez Hermoso <jordigh@octave.org>
parents: 28543
diff changeset
   289
  4
44319097e7b9 crecord: re-enable reviewing a patch before comitting it
Jordi Gutiérrez Hermoso <jordigh@octave.org>
parents: 28543
diff changeset
   290
  5
44319097e7b9 crecord: re-enable reviewing a patch before comitting it
Jordi Gutiérrez Hermoso <jordigh@octave.org>
parents: 28543
diff changeset
   291
  6
44319097e7b9 crecord: re-enable reviewing a patch before comitting it
Jordi Gutiérrez Hermoso <jordigh@octave.org>
parents: 28543
diff changeset
   292
  7
44319097e7b9 crecord: re-enable reviewing a patch before comitting it
Jordi Gutiérrez Hermoso <jordigh@octave.org>
parents: 28543
diff changeset
   293
  8
44319097e7b9 crecord: re-enable reviewing a patch before comitting it
Jordi Gutiérrez Hermoso <jordigh@octave.org>
parents: 28543
diff changeset
   294
  9
44319097e7b9 crecord: re-enable reviewing a patch before comitting it
Jordi Gutiérrez Hermoso <jordigh@octave.org>
parents: 28543
diff changeset
   295
  10
44319097e7b9 crecord: re-enable reviewing a patch before comitting it
Jordi Gutiérrez Hermoso <jordigh@octave.org>
parents: 28543
diff changeset
   296
  y
44319097e7b9 crecord: re-enable reviewing a patch before comitting it
Jordi Gutiérrez Hermoso <jordigh@octave.org>
parents: 28543
diff changeset
   297
44319097e7b9 crecord: re-enable reviewing a patch before comitting it
Jordi Gutiérrez Hermoso <jordigh@octave.org>
parents: 28543
diff changeset
   298
  $ hg cat -r . x
44319097e7b9 crecord: re-enable reviewing a patch before comitting it
Jordi Gutiérrez Hermoso <jordigh@octave.org>
parents: 28543
diff changeset
   299
  foo
44319097e7b9 crecord: re-enable reviewing a patch before comitting it
Jordi Gutiérrez Hermoso <jordigh@octave.org>
parents: 28543
diff changeset
   300
  hello world
44319097e7b9 crecord: re-enable reviewing a patch before comitting it
Jordi Gutiérrez Hermoso <jordigh@octave.org>
parents: 28543
diff changeset
   301
  lower
28542
71e12fc53b80 ui: add new config flag for interface selection
Simon Farnsworth <simonfar@fb.com>
parents: 27914
diff changeset
   302
Check ui.interface logic for the chunkselector
71e12fc53b80 ui: add new config flag for interface selection
Simon Farnsworth <simonfar@fb.com>
parents: 27914
diff changeset
   303
71e12fc53b80 ui: add new config flag for interface selection
Simon Farnsworth <simonfar@fb.com>
parents: 27914
diff changeset
   304
The default interface is text
71e12fc53b80 ui: add new config flag for interface selection
Simon Farnsworth <simonfar@fb.com>
parents: 27914
diff changeset
   305
  $ cp $HGRCPATH.pretest $HGRCPATH
71e12fc53b80 ui: add new config flag for interface selection
Simon Farnsworth <simonfar@fb.com>
parents: 27914
diff changeset
   306
  $ chunkselectorinterface() {
71e12fc53b80 ui: add new config flag for interface selection
Simon Farnsworth <simonfar@fb.com>
parents: 27914
diff changeset
   307
  > python <<EOF
71e12fc53b80 ui: add new config flag for interface selection
Simon Farnsworth <simonfar@fb.com>
parents: 27914
diff changeset
   308
  > from mercurial import hg, ui, parsers;\
71e12fc53b80 ui: add new config flag for interface selection
Simon Farnsworth <simonfar@fb.com>
parents: 27914
diff changeset
   309
  > repo = hg.repository(ui.ui(), ".");\
71e12fc53b80 ui: add new config flag for interface selection
Simon Farnsworth <simonfar@fb.com>
parents: 27914
diff changeset
   310
  > print repo.ui.interface("chunkselector")
71e12fc53b80 ui: add new config flag for interface selection
Simon Farnsworth <simonfar@fb.com>
parents: 27914
diff changeset
   311
  > EOF
71e12fc53b80 ui: add new config flag for interface selection
Simon Farnsworth <simonfar@fb.com>
parents: 27914
diff changeset
   312
  > }
71e12fc53b80 ui: add new config flag for interface selection
Simon Farnsworth <simonfar@fb.com>
parents: 27914
diff changeset
   313
  $ chunkselectorinterface
71e12fc53b80 ui: add new config flag for interface selection
Simon Farnsworth <simonfar@fb.com>
parents: 27914
diff changeset
   314
  text
71e12fc53b80 ui: add new config flag for interface selection
Simon Farnsworth <simonfar@fb.com>
parents: 27914
diff changeset
   315
71e12fc53b80 ui: add new config flag for interface selection
Simon Farnsworth <simonfar@fb.com>
parents: 27914
diff changeset
   316
If only the default is set, we'll use that for the feature, too
71e12fc53b80 ui: add new config flag for interface selection
Simon Farnsworth <simonfar@fb.com>
parents: 27914
diff changeset
   317
  $ cp $HGRCPATH.pretest $HGRCPATH
71e12fc53b80 ui: add new config flag for interface selection
Simon Farnsworth <simonfar@fb.com>
parents: 27914
diff changeset
   318
  $ cat <<EOF >> $HGRCPATH
71e12fc53b80 ui: add new config flag for interface selection
Simon Farnsworth <simonfar@fb.com>
parents: 27914
diff changeset
   319
  > [ui]
71e12fc53b80 ui: add new config flag for interface selection
Simon Farnsworth <simonfar@fb.com>
parents: 27914
diff changeset
   320
  > interface = curses
71e12fc53b80 ui: add new config flag for interface selection
Simon Farnsworth <simonfar@fb.com>
parents: 27914
diff changeset
   321
  > EOF
71e12fc53b80 ui: add new config flag for interface selection
Simon Farnsworth <simonfar@fb.com>
parents: 27914
diff changeset
   322
  $ chunkselectorinterface
71e12fc53b80 ui: add new config flag for interface selection
Simon Farnsworth <simonfar@fb.com>
parents: 27914
diff changeset
   323
  curses
71e12fc53b80 ui: add new config flag for interface selection
Simon Farnsworth <simonfar@fb.com>
parents: 27914
diff changeset
   324
71e12fc53b80 ui: add new config flag for interface selection
Simon Farnsworth <simonfar@fb.com>
parents: 27914
diff changeset
   325
It is possible to override the default interface with a feature specific
71e12fc53b80 ui: add new config flag for interface selection
Simon Farnsworth <simonfar@fb.com>
parents: 27914
diff changeset
   326
interface
71e12fc53b80 ui: add new config flag for interface selection
Simon Farnsworth <simonfar@fb.com>
parents: 27914
diff changeset
   327
  $ cp $HGRCPATH.pretest $HGRCPATH
71e12fc53b80 ui: add new config flag for interface selection
Simon Farnsworth <simonfar@fb.com>
parents: 27914
diff changeset
   328
  $ cat <<EOF >> $HGRCPATH
71e12fc53b80 ui: add new config flag for interface selection
Simon Farnsworth <simonfar@fb.com>
parents: 27914
diff changeset
   329
  > [ui]
71e12fc53b80 ui: add new config flag for interface selection
Simon Farnsworth <simonfar@fb.com>
parents: 27914
diff changeset
   330
  > interface = text
71e12fc53b80 ui: add new config flag for interface selection
Simon Farnsworth <simonfar@fb.com>
parents: 27914
diff changeset
   331
  > interface.chunkselector = curses
71e12fc53b80 ui: add new config flag for interface selection
Simon Farnsworth <simonfar@fb.com>
parents: 27914
diff changeset
   332
  > EOF
71e12fc53b80 ui: add new config flag for interface selection
Simon Farnsworth <simonfar@fb.com>
parents: 27914
diff changeset
   333
71e12fc53b80 ui: add new config flag for interface selection
Simon Farnsworth <simonfar@fb.com>
parents: 27914
diff changeset
   334
  $ chunkselectorinterface
71e12fc53b80 ui: add new config flag for interface selection
Simon Farnsworth <simonfar@fb.com>
parents: 27914
diff changeset
   335
  curses
71e12fc53b80 ui: add new config flag for interface selection
Simon Farnsworth <simonfar@fb.com>
parents: 27914
diff changeset
   336
71e12fc53b80 ui: add new config flag for interface selection
Simon Farnsworth <simonfar@fb.com>
parents: 27914
diff changeset
   337
  $ cp $HGRCPATH.pretest $HGRCPATH
71e12fc53b80 ui: add new config flag for interface selection
Simon Farnsworth <simonfar@fb.com>
parents: 27914
diff changeset
   338
  $ cat <<EOF >> $HGRCPATH
71e12fc53b80 ui: add new config flag for interface selection
Simon Farnsworth <simonfar@fb.com>
parents: 27914
diff changeset
   339
  > [ui]
71e12fc53b80 ui: add new config flag for interface selection
Simon Farnsworth <simonfar@fb.com>
parents: 27914
diff changeset
   340
  > interface = curses
71e12fc53b80 ui: add new config flag for interface selection
Simon Farnsworth <simonfar@fb.com>
parents: 27914
diff changeset
   341
  > interface.chunkselector = text
71e12fc53b80 ui: add new config flag for interface selection
Simon Farnsworth <simonfar@fb.com>
parents: 27914
diff changeset
   342
  > EOF
71e12fc53b80 ui: add new config flag for interface selection
Simon Farnsworth <simonfar@fb.com>
parents: 27914
diff changeset
   343
71e12fc53b80 ui: add new config flag for interface selection
Simon Farnsworth <simonfar@fb.com>
parents: 27914
diff changeset
   344
  $ chunkselectorinterface
71e12fc53b80 ui: add new config flag for interface selection
Simon Farnsworth <simonfar@fb.com>
parents: 27914
diff changeset
   345
  text
71e12fc53b80 ui: add new config flag for interface selection
Simon Farnsworth <simonfar@fb.com>
parents: 27914
diff changeset
   346
71e12fc53b80 ui: add new config flag for interface selection
Simon Farnsworth <simonfar@fb.com>
parents: 27914
diff changeset
   347
If a bad interface name is given, we use the default value (with a nice
71e12fc53b80 ui: add new config flag for interface selection
Simon Farnsworth <simonfar@fb.com>
parents: 27914
diff changeset
   348
error message to suggest that the configuration needs to be fixed)
71e12fc53b80 ui: add new config flag for interface selection
Simon Farnsworth <simonfar@fb.com>
parents: 27914
diff changeset
   349
71e12fc53b80 ui: add new config flag for interface selection
Simon Farnsworth <simonfar@fb.com>
parents: 27914
diff changeset
   350
  $ cp $HGRCPATH.pretest $HGRCPATH
71e12fc53b80 ui: add new config flag for interface selection
Simon Farnsworth <simonfar@fb.com>
parents: 27914
diff changeset
   351
  $ cat <<EOF >> $HGRCPATH
71e12fc53b80 ui: add new config flag for interface selection
Simon Farnsworth <simonfar@fb.com>
parents: 27914
diff changeset
   352
  > [ui]
71e12fc53b80 ui: add new config flag for interface selection
Simon Farnsworth <simonfar@fb.com>
parents: 27914
diff changeset
   353
  > interface = blah
71e12fc53b80 ui: add new config flag for interface selection
Simon Farnsworth <simonfar@fb.com>
parents: 27914
diff changeset
   354
  > EOF
71e12fc53b80 ui: add new config flag for interface selection
Simon Farnsworth <simonfar@fb.com>
parents: 27914
diff changeset
   355
  $ chunkselectorinterface
71e12fc53b80 ui: add new config flag for interface selection
Simon Farnsworth <simonfar@fb.com>
parents: 27914
diff changeset
   356
  invalid value for ui.interface: blah (using text)
71e12fc53b80 ui: add new config flag for interface selection
Simon Farnsworth <simonfar@fb.com>
parents: 27914
diff changeset
   357
  text
71e12fc53b80 ui: add new config flag for interface selection
Simon Farnsworth <simonfar@fb.com>
parents: 27914
diff changeset
   358
71e12fc53b80 ui: add new config flag for interface selection
Simon Farnsworth <simonfar@fb.com>
parents: 27914
diff changeset
   359
  $ cp $HGRCPATH.pretest $HGRCPATH
71e12fc53b80 ui: add new config flag for interface selection
Simon Farnsworth <simonfar@fb.com>
parents: 27914
diff changeset
   360
  $ cat <<EOF >> $HGRCPATH
71e12fc53b80 ui: add new config flag for interface selection
Simon Farnsworth <simonfar@fb.com>
parents: 27914
diff changeset
   361
  > [ui]
71e12fc53b80 ui: add new config flag for interface selection
Simon Farnsworth <simonfar@fb.com>
parents: 27914
diff changeset
   362
  > interface = curses
71e12fc53b80 ui: add new config flag for interface selection
Simon Farnsworth <simonfar@fb.com>
parents: 27914
diff changeset
   363
  > interface.chunkselector = blah
71e12fc53b80 ui: add new config flag for interface selection
Simon Farnsworth <simonfar@fb.com>
parents: 27914
diff changeset
   364
  > EOF
71e12fc53b80 ui: add new config flag for interface selection
Simon Farnsworth <simonfar@fb.com>
parents: 27914
diff changeset
   365
  $ chunkselectorinterface
71e12fc53b80 ui: add new config flag for interface selection
Simon Farnsworth <simonfar@fb.com>
parents: 27914
diff changeset
   366
  invalid value for ui.interface.chunkselector: blah (using curses)
71e12fc53b80 ui: add new config flag for interface selection
Simon Farnsworth <simonfar@fb.com>
parents: 27914
diff changeset
   367
  curses
71e12fc53b80 ui: add new config flag for interface selection
Simon Farnsworth <simonfar@fb.com>
parents: 27914
diff changeset
   368
71e12fc53b80 ui: add new config flag for interface selection
Simon Farnsworth <simonfar@fb.com>
parents: 27914
diff changeset
   369
  $ cp $HGRCPATH.pretest $HGRCPATH
71e12fc53b80 ui: add new config flag for interface selection
Simon Farnsworth <simonfar@fb.com>
parents: 27914
diff changeset
   370
  $ cat <<EOF >> $HGRCPATH
71e12fc53b80 ui: add new config flag for interface selection
Simon Farnsworth <simonfar@fb.com>
parents: 27914
diff changeset
   371
  > [ui]
71e12fc53b80 ui: add new config flag for interface selection
Simon Farnsworth <simonfar@fb.com>
parents: 27914
diff changeset
   372
  > interface = blah
71e12fc53b80 ui: add new config flag for interface selection
Simon Farnsworth <simonfar@fb.com>
parents: 27914
diff changeset
   373
  > interface.chunkselector = curses
71e12fc53b80 ui: add new config flag for interface selection
Simon Farnsworth <simonfar@fb.com>
parents: 27914
diff changeset
   374
  > EOF
71e12fc53b80 ui: add new config flag for interface selection
Simon Farnsworth <simonfar@fb.com>
parents: 27914
diff changeset
   375
  $ chunkselectorinterface
71e12fc53b80 ui: add new config flag for interface selection
Simon Farnsworth <simonfar@fb.com>
parents: 27914
diff changeset
   376
  invalid value for ui.interface: blah
71e12fc53b80 ui: add new config flag for interface selection
Simon Farnsworth <simonfar@fb.com>
parents: 27914
diff changeset
   377
  curses
71e12fc53b80 ui: add new config flag for interface selection
Simon Farnsworth <simonfar@fb.com>
parents: 27914
diff changeset
   378
71e12fc53b80 ui: add new config flag for interface selection
Simon Farnsworth <simonfar@fb.com>
parents: 27914
diff changeset
   379
  $ cp $HGRCPATH.pretest $HGRCPATH
71e12fc53b80 ui: add new config flag for interface selection
Simon Farnsworth <simonfar@fb.com>
parents: 27914
diff changeset
   380
  $ cat <<EOF >> $HGRCPATH
71e12fc53b80 ui: add new config flag for interface selection
Simon Farnsworth <simonfar@fb.com>
parents: 27914
diff changeset
   381
  > [ui]
71e12fc53b80 ui: add new config flag for interface selection
Simon Farnsworth <simonfar@fb.com>
parents: 27914
diff changeset
   382
  > interface = blah
71e12fc53b80 ui: add new config flag for interface selection
Simon Farnsworth <simonfar@fb.com>
parents: 27914
diff changeset
   383
  > interface.chunkselector = blah
71e12fc53b80 ui: add new config flag for interface selection
Simon Farnsworth <simonfar@fb.com>
parents: 27914
diff changeset
   384
  > EOF
71e12fc53b80 ui: add new config flag for interface selection
Simon Farnsworth <simonfar@fb.com>
parents: 27914
diff changeset
   385
  $ chunkselectorinterface
71e12fc53b80 ui: add new config flag for interface selection
Simon Farnsworth <simonfar@fb.com>
parents: 27914
diff changeset
   386
  invalid value for ui.interface: blah
71e12fc53b80 ui: add new config flag for interface selection
Simon Farnsworth <simonfar@fb.com>
parents: 27914
diff changeset
   387
  invalid value for ui.interface.chunkselector: blah (using text)
71e12fc53b80 ui: add new config flag for interface selection
Simon Farnsworth <simonfar@fb.com>
parents: 27914
diff changeset
   388
  text