tests/test-commit-interactive-curses.t
author Manuel Jacob <me@manueljacob.de>
Thu, 02 Jun 2022 04:39:49 +0200
branchstable
changeset 48886 b5fe10b3c9f5
parent 46325 e5e6282fa66a
permissions -rw-r--r--
py3: don’t subscript socket.error On Python 2, socket.error was subscriptable. On Python 3, socket.error is an alias to OSError and is not subscriptable. The except block passes the exception to self.send_error(). This fails on both Python 2 (if it was executed) and Python 3, as it expects a string. Getting the attribute .strerror works on Python 2 and Python 3, and has the same effect as the previous code on Python 2.
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
46325
e5e6282fa66a hghave: split apart testing for the curses module and `tic` executable
Matt Harbison <matt_harbison@yahoo.com>
parents: 43893
diff changeset
     1
#require curses
30236
141cb12c0175 tests: add test-commit-interactive-curses.t "require tic" for test portability
FUJIWARA Katsunori <foozy@lares.dti.ne.jp>
parents: 30157
diff changeset
     2
24344
6b43baac6dfb record: add tests for the curses recording interface
Laurent Charignon <lcharignon@fb.com>
parents:
diff changeset
     3
Set up a repo
6b43baac6dfb record: add tests for the curses recording interface
Laurent Charignon <lcharignon@fb.com>
parents:
diff changeset
     4
28542
71e12fc53b80 ui: add new config flag for interface selection
Simon Farnsworth <simonfar@fb.com>
parents: 27914
diff changeset
     5
  $ cp $HGRCPATH $HGRCPATH.pretest
24344
6b43baac6dfb record: add tests for the curses recording interface
Laurent Charignon <lcharignon@fb.com>
parents:
diff changeset
     6
  $ cat <<EOF >> $HGRCPATH
6b43baac6dfb record: add tests for the curses recording interface
Laurent Charignon <lcharignon@fb.com>
parents:
diff changeset
     7
  > [ui]
6b43baac6dfb record: add tests for the curses recording interface
Laurent Charignon <lcharignon@fb.com>
parents:
diff changeset
     8
  > interactive = true
28543
f7874de435c5 crecord: use ui.interface to choose curses interface
Simon Farnsworth <simonfar@fb.com>
parents: 28542
diff changeset
     9
  > interface = curses
24344
6b43baac6dfb record: add tests for the curses recording interface
Laurent Charignon <lcharignon@fb.com>
parents:
diff changeset
    10
  > [experimental]
6b43baac6dfb record: add tests for the curses recording interface
Laurent Charignon <lcharignon@fb.com>
parents:
diff changeset
    11
  > crecordtest = testModeCommands
6b43baac6dfb record: add tests for the curses recording interface
Laurent Charignon <lcharignon@fb.com>
parents:
diff changeset
    12
  > EOF
6b43baac6dfb record: add tests for the curses recording interface
Laurent Charignon <lcharignon@fb.com>
parents:
diff changeset
    13
29668
e7766022a61a crecord: properly handle files with No newline at eof (issue5268)
timeless <timeless@mozdev.org>
parents: 28638
diff changeset
    14
Record with noeol at eof (issue5268)
e7766022a61a crecord: properly handle files with No newline at eof (issue5268)
timeless <timeless@mozdev.org>
parents: 28638
diff changeset
    15
  $ hg init noeol
e7766022a61a crecord: properly handle files with No newline at eof (issue5268)
timeless <timeless@mozdev.org>
parents: 28638
diff changeset
    16
  $ cd noeol
e7766022a61a crecord: properly handle files with No newline at eof (issue5268)
timeless <timeless@mozdev.org>
parents: 28638
diff changeset
    17
  $ printf '0' > a
e7766022a61a crecord: properly handle files with No newline at eof (issue5268)
timeless <timeless@mozdev.org>
parents: 28638
diff changeset
    18
  $ printf '0\n' > b
e7766022a61a crecord: properly handle files with No newline at eof (issue5268)
timeless <timeless@mozdev.org>
parents: 28638
diff changeset
    19
  $ hg ci -Aqm initial
e7766022a61a crecord: properly handle files with No newline at eof (issue5268)
timeless <timeless@mozdev.org>
parents: 28638
diff changeset
    20
  $ printf '1\n0' > a
e7766022a61a crecord: properly handle files with No newline at eof (issue5268)
timeless <timeless@mozdev.org>
parents: 28638
diff changeset
    21
  $ printf '1\n0\n' > b
e7766022a61a crecord: properly handle files with No newline at eof (issue5268)
timeless <timeless@mozdev.org>
parents: 28638
diff changeset
    22
  $ cat <<EOF >testModeCommands
e7766022a61a crecord: properly handle files with No newline at eof (issue5268)
timeless <timeless@mozdev.org>
parents: 28638
diff changeset
    23
  > c
e7766022a61a crecord: properly handle files with No newline at eof (issue5268)
timeless <timeless@mozdev.org>
parents: 28638
diff changeset
    24
  > EOF
e7766022a61a crecord: properly handle files with No newline at eof (issue5268)
timeless <timeless@mozdev.org>
parents: 28638
diff changeset
    25
  $ HGEDITOR="\"sh\" \"`pwd`/editor.sh\"" hg commit  -i -m "add hunks" -d "0 0"
e7766022a61a crecord: properly handle files with No newline at eof (issue5268)
timeless <timeless@mozdev.org>
parents: 28638
diff changeset
    26
  $ cd ..
e7766022a61a crecord: properly handle files with No newline at eof (issue5268)
timeless <timeless@mozdev.org>
parents: 28638
diff changeset
    27
e7766022a61a crecord: properly handle files with No newline at eof (issue5268)
timeless <timeless@mozdev.org>
parents: 28638
diff changeset
    28
Normal repo
24344
6b43baac6dfb record: add tests for the curses recording interface
Laurent Charignon <lcharignon@fb.com>
parents:
diff changeset
    29
  $ hg init a
6b43baac6dfb record: add tests for the curses recording interface
Laurent Charignon <lcharignon@fb.com>
parents:
diff changeset
    30
  $ cd a
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 but stopping on the way
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
  $ echo "a" > a
6b43baac6dfb record: add tests for the curses recording interface
Laurent Charignon <lcharignon@fb.com>
parents:
diff changeset
    35
  $ hg add a
6b43baac6dfb record: add tests for the curses recording interface
Laurent Charignon <lcharignon@fb.com>
parents:
diff changeset
    36
  $ cat <<EOF >testModeCommands
42570
75fd9421440b crecord: add "x" alias for space, remove test-only "TOGGLE" alias
Kyle Lippincott <spectral@google.com>
parents: 42569
diff changeset
    37
  > x
42569
756326d54761 crecord: stop using test-only "X" as alternative for "c"
Kyle Lippincott <spectral@google.com>
parents: 41438
diff changeset
    38
  > c
24344
6b43baac6dfb record: add tests for the curses recording interface
Laurent Charignon <lcharignon@fb.com>
parents:
diff changeset
    39
  > EOF
6b43baac6dfb record: add tests for the curses recording interface
Laurent Charignon <lcharignon@fb.com>
parents:
diff changeset
    40
  $ 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
    41
  no changes to record
30157
df224038c516 commit: return 1 for interactive commit with no changes (issue5397)
Philippe Pepiot <philippe.pepiot@logilab.fr>
parents: 29668
diff changeset
    42
  [1]
24344
6b43baac6dfb record: add tests for the curses recording interface
Laurent Charignon <lcharignon@fb.com>
parents:
diff changeset
    43
  $ hg tip
6b43baac6dfb record: add tests for the curses recording interface
Laurent Charignon <lcharignon@fb.com>
parents:
diff changeset
    44
  changeset:   -1:000000000000
6b43baac6dfb record: add tests for the curses recording interface
Laurent Charignon <lcharignon@fb.com>
parents:
diff changeset
    45
  tag:         tip
6b43baac6dfb record: add tests for the curses recording interface
Laurent Charignon <lcharignon@fb.com>
parents:
diff changeset
    46
  user:        
6b43baac6dfb record: add tests for the curses recording interface
Laurent Charignon <lcharignon@fb.com>
parents:
diff changeset
    47
  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
    48
  
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
Committing some changes
6b43baac6dfb record: add tests for the curses recording interface
Laurent Charignon <lcharignon@fb.com>
parents:
diff changeset
    51
6b43baac6dfb record: add tests for the curses recording interface
Laurent Charignon <lcharignon@fb.com>
parents:
diff changeset
    52
  $ cat <<EOF >testModeCommands
42569
756326d54761 crecord: stop using test-only "X" as alternative for "c"
Kyle Lippincott <spectral@google.com>
parents: 41438
diff changeset
    53
  > c
24344
6b43baac6dfb record: add tests for the curses recording interface
Laurent Charignon <lcharignon@fb.com>
parents:
diff changeset
    54
  > EOF
6b43baac6dfb record: add tests for the curses recording interface
Laurent Charignon <lcharignon@fb.com>
parents:
diff changeset
    55
  $ 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
    56
  $ hg tip
6b43baac6dfb record: add tests for the curses recording interface
Laurent Charignon <lcharignon@fb.com>
parents:
diff changeset
    57
  changeset:   0:cb9a9f314b8b
6b43baac6dfb record: add tests for the curses recording interface
Laurent Charignon <lcharignon@fb.com>
parents:
diff changeset
    58
  tag:         tip
6b43baac6dfb record: add tests for the curses recording interface
Laurent Charignon <lcharignon@fb.com>
parents:
diff changeset
    59
  user:        test
6b43baac6dfb record: add tests for the curses recording interface
Laurent Charignon <lcharignon@fb.com>
parents:
diff changeset
    60
  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
    61
  summary:     a
6b43baac6dfb record: add tests for the curses recording interface
Laurent Charignon <lcharignon@fb.com>
parents:
diff changeset
    62
  
27321
dcdf0a52ad36 crecord: add dictionary to default return value of filterpatch
Laurent Charignon <lcharignon@fb.com>
parents: 27156
diff changeset
    63
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
    64
  $ hg commit -i
dcdf0a52ad36 crecord: add dictionary to default return value of filterpatch
Laurent Charignon <lcharignon@fb.com>
parents: 27156
diff changeset
    65
  no changes to record
30157
df224038c516 commit: return 1 for interactive commit with no changes (issue5397)
Philippe Pepiot <philippe.pepiot@logilab.fr>
parents: 29668
diff changeset
    66
  [1]
27321
dcdf0a52ad36 crecord: add dictionary to default return value of filterpatch
Laurent Charignon <lcharignon@fb.com>
parents: 27156
diff changeset
    67
24344
6b43baac6dfb record: add tests for the curses recording interface
Laurent Charignon <lcharignon@fb.com>
parents:
diff changeset
    68
Committing only one file
6b43baac6dfb record: add tests for the curses recording interface
Laurent Charignon <lcharignon@fb.com>
parents:
diff changeset
    69
6b43baac6dfb record: add tests for the curses recording interface
Laurent Charignon <lcharignon@fb.com>
parents:
diff changeset
    70
  $ echo "a" >> a
38119
b95a6fb7ae66 py3: fix .write() calls in few tests
Pulkit Goyal <7895pulkit@gmail.com>
parents: 35400
diff changeset
    71
  >>> open('b', 'wb').write(b"1\n2\n3\n4\n5\n6\n7\n8\n9\n10\n") and None
24344
6b43baac6dfb record: add tests for the curses recording interface
Laurent Charignon <lcharignon@fb.com>
parents:
diff changeset
    72
  $ hg add b
6b43baac6dfb record: add tests for the curses recording interface
Laurent Charignon <lcharignon@fb.com>
parents:
diff changeset
    73
  $ cat <<EOF >testModeCommands
42570
75fd9421440b crecord: add "x" alias for space, remove test-only "TOGGLE" alias
Kyle Lippincott <spectral@google.com>
parents: 42569
diff changeset
    74
  > x
24344
6b43baac6dfb record: add tests for the curses recording interface
Laurent Charignon <lcharignon@fb.com>
parents:
diff changeset
    75
  > KEY_DOWN
42569
756326d54761 crecord: stop using test-only "X" as alternative for "c"
Kyle Lippincott <spectral@google.com>
parents: 41438
diff changeset
    76
  > c
24344
6b43baac6dfb record: add tests for the curses recording interface
Laurent Charignon <lcharignon@fb.com>
parents:
diff changeset
    77
  > EOF
6b43baac6dfb record: add tests for the curses recording interface
Laurent Charignon <lcharignon@fb.com>
parents:
diff changeset
    78
  $ 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
    79
  $ hg tip
6b43baac6dfb record: add tests for the curses recording interface
Laurent Charignon <lcharignon@fb.com>
parents:
diff changeset
    80
  changeset:   1:fb2705a663ea
6b43baac6dfb record: add tests for the curses recording interface
Laurent Charignon <lcharignon@fb.com>
parents:
diff changeset
    81
  tag:         tip
6b43baac6dfb record: add tests for the curses recording interface
Laurent Charignon <lcharignon@fb.com>
parents:
diff changeset
    82
  user:        test
6b43baac6dfb record: add tests for the curses recording interface
Laurent Charignon <lcharignon@fb.com>
parents:
diff changeset
    83
  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
    84
  summary:     one file
6b43baac6dfb record: add tests for the curses recording interface
Laurent Charignon <lcharignon@fb.com>
parents:
diff changeset
    85
  
6b43baac6dfb record: add tests for the curses recording interface
Laurent Charignon <lcharignon@fb.com>
parents:
diff changeset
    86
  $ hg cat -r tip a
6b43baac6dfb record: add tests for the curses recording interface
Laurent Charignon <lcharignon@fb.com>
parents:
diff changeset
    87
  a
6b43baac6dfb record: add tests for the curses recording interface
Laurent Charignon <lcharignon@fb.com>
parents:
diff changeset
    88
  $ cat a
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
  a
6b43baac6dfb record: add tests for the curses recording interface
Laurent Charignon <lcharignon@fb.com>
parents:
diff changeset
    91
25557
52c552a05414 crecord: exit edition of hunk with non-zero status does not interrupt session
Laurent Charignon <lcharignon@fb.com>
parents: 24837
diff changeset
    92
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
    93
6b43baac6dfb record: add tests for the curses recording interface
Laurent Charignon <lcharignon@fb.com>
parents:
diff changeset
    94
- 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
    95
- unfold it
6b43baac6dfb record: add tests for the curses recording interface
Laurent Charignon <lcharignon@fb.com>
parents:
diff changeset
    96
- 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
    97
- toggle the second hunk
43893
c06eba91c380 crecord: repurpose "a" key to toggle all selections (BC)
Jordi Gutiérrez Hermoso <jordigh@octave.org>
parents: 42573
diff changeset
    98
- toggle all lines twice (to check that it does nothing)
26781
1aee2ab0f902 spelling: trivial spell checking
Mads Kiilerich <madski@unity3d.com>
parents: 25557
diff changeset
    99
- 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
   100
- commit
6b43baac6dfb record: add tests for the curses recording interface
Laurent Charignon <lcharignon@fb.com>
parents:
diff changeset
   101
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
  $ 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
   103
  $ echo "x" > c
6b43baac6dfb record: add tests for the curses recording interface
Laurent Charignon <lcharignon@fb.com>
parents:
diff changeset
   104
  $ cat b >> c
6b43baac6dfb record: add tests for the curses recording interface
Laurent Charignon <lcharignon@fb.com>
parents:
diff changeset
   105
  $ echo "y" >> c
6b43baac6dfb record: add tests for the curses recording interface
Laurent Charignon <lcharignon@fb.com>
parents:
diff changeset
   106
  $ mv c b
6b43baac6dfb record: add tests for the curses recording interface
Laurent Charignon <lcharignon@fb.com>
parents:
diff changeset
   107
  $ cat <<EOF >testModeCommands
6b43baac6dfb record: add tests for the curses recording interface
Laurent Charignon <lcharignon@fb.com>
parents:
diff changeset
   108
  > A
6b43baac6dfb record: add tests for the curses recording interface
Laurent Charignon <lcharignon@fb.com>
parents:
diff changeset
   109
  > KEY_DOWN
6b43baac6dfb record: add tests for the curses recording interface
Laurent Charignon <lcharignon@fb.com>
parents:
diff changeset
   110
  > f
6b43baac6dfb record: add tests for the curses recording interface
Laurent Charignon <lcharignon@fb.com>
parents:
diff changeset
   111
  > KEY_DOWN
6b43baac6dfb record: add tests for the curses recording interface
Laurent Charignon <lcharignon@fb.com>
parents:
diff changeset
   112
  > KEY_DOWN
6b43baac6dfb record: add tests for the curses recording interface
Laurent Charignon <lcharignon@fb.com>
parents:
diff changeset
   113
  > KEY_DOWN
6b43baac6dfb record: add tests for the curses recording interface
Laurent Charignon <lcharignon@fb.com>
parents:
diff changeset
   114
  > KEY_DOWN
42570
75fd9421440b crecord: add "x" alias for space, remove test-only "TOGGLE" alias
Kyle Lippincott <spectral@google.com>
parents: 42569
diff changeset
   115
  > x
27156
55fa7c3900ae commit: add amend mode for commit -i
Laurent Charignon <lcharignon@fb.com>
parents: 26781
diff changeset
   116
  > a
55fa7c3900ae commit: add amend mode for commit -i
Laurent Charignon <lcharignon@fb.com>
parents: 26781
diff changeset
   117
  > 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
   118
  > e
42569
756326d54761 crecord: stop using test-only "X" as alternative for "c"
Kyle Lippincott <spectral@google.com>
parents: 41438
diff changeset
   119
  > c
24344
6b43baac6dfb record: add tests for the curses recording interface
Laurent Charignon <lcharignon@fb.com>
parents:
diff changeset
   120
  > 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
   121
  $ 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
   122
  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
   123
  $ rm editor.sh
24344
6b43baac6dfb record: add tests for the curses recording interface
Laurent Charignon <lcharignon@fb.com>
parents:
diff changeset
   124
  $ hg tip
6b43baac6dfb record: add tests for the curses recording interface
Laurent Charignon <lcharignon@fb.com>
parents:
diff changeset
   125
  changeset:   2:7d10dfe755a8
6b43baac6dfb record: add tests for the curses recording interface
Laurent Charignon <lcharignon@fb.com>
parents:
diff changeset
   126
  tag:         tip
6b43baac6dfb record: add tests for the curses recording interface
Laurent Charignon <lcharignon@fb.com>
parents:
diff changeset
   127
  user:        test
6b43baac6dfb record: add tests for the curses recording interface
Laurent Charignon <lcharignon@fb.com>
parents:
diff changeset
   128
  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
   129
  summary:     one hunk
6b43baac6dfb record: add tests for the curses recording interface
Laurent Charignon <lcharignon@fb.com>
parents:
diff changeset
   130
  
6b43baac6dfb record: add tests for the curses recording interface
Laurent Charignon <lcharignon@fb.com>
parents:
diff changeset
   131
  $ hg cat -r tip b
6b43baac6dfb record: add tests for the curses recording interface
Laurent Charignon <lcharignon@fb.com>
parents:
diff changeset
   132
  1
6b43baac6dfb record: add tests for the curses recording interface
Laurent Charignon <lcharignon@fb.com>
parents:
diff changeset
   133
  2
6b43baac6dfb record: add tests for the curses recording interface
Laurent Charignon <lcharignon@fb.com>
parents:
diff changeset
   134
  3
6b43baac6dfb record: add tests for the curses recording interface
Laurent Charignon <lcharignon@fb.com>
parents:
diff changeset
   135
  4
6b43baac6dfb record: add tests for the curses recording interface
Laurent Charignon <lcharignon@fb.com>
parents:
diff changeset
   136
  5
6b43baac6dfb record: add tests for the curses recording interface
Laurent Charignon <lcharignon@fb.com>
parents:
diff changeset
   137
  6
6b43baac6dfb record: add tests for the curses recording interface
Laurent Charignon <lcharignon@fb.com>
parents:
diff changeset
   138
  7
6b43baac6dfb record: add tests for the curses recording interface
Laurent Charignon <lcharignon@fb.com>
parents:
diff changeset
   139
  8
6b43baac6dfb record: add tests for the curses recording interface
Laurent Charignon <lcharignon@fb.com>
parents:
diff changeset
   140
  9
6b43baac6dfb record: add tests for the curses recording interface
Laurent Charignon <lcharignon@fb.com>
parents:
diff changeset
   141
  10
6b43baac6dfb record: add tests for the curses recording interface
Laurent Charignon <lcharignon@fb.com>
parents:
diff changeset
   142
  y
6b43baac6dfb record: add tests for the curses recording interface
Laurent Charignon <lcharignon@fb.com>
parents:
diff changeset
   143
  $ cat b
6b43baac6dfb record: add tests for the curses recording interface
Laurent Charignon <lcharignon@fb.com>
parents:
diff changeset
   144
  x
6b43baac6dfb record: add tests for the curses recording interface
Laurent Charignon <lcharignon@fb.com>
parents:
diff changeset
   145
  1
6b43baac6dfb record: add tests for the curses recording interface
Laurent Charignon <lcharignon@fb.com>
parents:
diff changeset
   146
  2
6b43baac6dfb record: add tests for the curses recording interface
Laurent Charignon <lcharignon@fb.com>
parents:
diff changeset
   147
  3
6b43baac6dfb record: add tests for the curses recording interface
Laurent Charignon <lcharignon@fb.com>
parents:
diff changeset
   148
  4
6b43baac6dfb record: add tests for the curses recording interface
Laurent Charignon <lcharignon@fb.com>
parents:
diff changeset
   149
  5
6b43baac6dfb record: add tests for the curses recording interface
Laurent Charignon <lcharignon@fb.com>
parents:
diff changeset
   150
  6
6b43baac6dfb record: add tests for the curses recording interface
Laurent Charignon <lcharignon@fb.com>
parents:
diff changeset
   151
  7
6b43baac6dfb record: add tests for the curses recording interface
Laurent Charignon <lcharignon@fb.com>
parents:
diff changeset
   152
  8
6b43baac6dfb record: add tests for the curses recording interface
Laurent Charignon <lcharignon@fb.com>
parents:
diff changeset
   153
  9
6b43baac6dfb record: add tests for the curses recording interface
Laurent Charignon <lcharignon@fb.com>
parents:
diff changeset
   154
  10
6b43baac6dfb record: add tests for the curses recording interface
Laurent Charignon <lcharignon@fb.com>
parents:
diff changeset
   155
  y
6b43baac6dfb record: add tests for the curses recording interface
Laurent Charignon <lcharignon@fb.com>
parents:
diff changeset
   156
  $ hg commit -m "other hunks"
6b43baac6dfb record: add tests for the curses recording interface
Laurent Charignon <lcharignon@fb.com>
parents:
diff changeset
   157
  $ hg tip
6b43baac6dfb record: add tests for the curses recording interface
Laurent Charignon <lcharignon@fb.com>
parents:
diff changeset
   158
  changeset:   3:a6735021574d
6b43baac6dfb record: add tests for the curses recording interface
Laurent Charignon <lcharignon@fb.com>
parents:
diff changeset
   159
  tag:         tip
6b43baac6dfb record: add tests for the curses recording interface
Laurent Charignon <lcharignon@fb.com>
parents:
diff changeset
   160
  user:        test
6b43baac6dfb record: add tests for the curses recording interface
Laurent Charignon <lcharignon@fb.com>
parents:
diff changeset
   161
  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
   162
  summary:     other hunks
6b43baac6dfb record: add tests for the curses recording interface
Laurent Charignon <lcharignon@fb.com>
parents:
diff changeset
   163
  
6b43baac6dfb record: add tests for the curses recording interface
Laurent Charignon <lcharignon@fb.com>
parents:
diff changeset
   164
  $ hg cat -r tip b
6b43baac6dfb record: add tests for the curses recording interface
Laurent Charignon <lcharignon@fb.com>
parents:
diff changeset
   165
  x
6b43baac6dfb record: add tests for the curses recording interface
Laurent Charignon <lcharignon@fb.com>
parents:
diff changeset
   166
  1
6b43baac6dfb record: add tests for the curses recording interface
Laurent Charignon <lcharignon@fb.com>
parents:
diff changeset
   167
  2
6b43baac6dfb record: add tests for the curses recording interface
Laurent Charignon <lcharignon@fb.com>
parents:
diff changeset
   168
  3
6b43baac6dfb record: add tests for the curses recording interface
Laurent Charignon <lcharignon@fb.com>
parents:
diff changeset
   169
  4
6b43baac6dfb record: add tests for the curses recording interface
Laurent Charignon <lcharignon@fb.com>
parents:
diff changeset
   170
  5
6b43baac6dfb record: add tests for the curses recording interface
Laurent Charignon <lcharignon@fb.com>
parents:
diff changeset
   171
  6
6b43baac6dfb record: add tests for the curses recording interface
Laurent Charignon <lcharignon@fb.com>
parents:
diff changeset
   172
  7
6b43baac6dfb record: add tests for the curses recording interface
Laurent Charignon <lcharignon@fb.com>
parents:
diff changeset
   173
  8
6b43baac6dfb record: add tests for the curses recording interface
Laurent Charignon <lcharignon@fb.com>
parents:
diff changeset
   174
  9
6b43baac6dfb record: add tests for the curses recording interface
Laurent Charignon <lcharignon@fb.com>
parents:
diff changeset
   175
  10
6b43baac6dfb record: add tests for the curses recording interface
Laurent Charignon <lcharignon@fb.com>
parents:
diff changeset
   176
  y
6b43baac6dfb record: add tests for the curses recording interface
Laurent Charignon <lcharignon@fb.com>
parents:
diff changeset
   177
24469
e71053ef0c46 record_curses: add test for newly added files
Laurent Charignon <lcharignon@fb.com>
parents: 24435
diff changeset
   178
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
   179
24469
e71053ef0c46 record_curses: add test for newly added files
Laurent Charignon <lcharignon@fb.com>
parents: 24435
diff changeset
   180
  $ hg update -C .
24837
edf907bd8144 record: fix record with change on moved file crashes (issue4619)
Laurent Charignon <lcharignon@fb.com>
parents: 24469
diff changeset
   181
  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
   182
  $ echo "hello" > x
e71053ef0c46 record_curses: add test for newly added files
Laurent Charignon <lcharignon@fb.com>
parents: 24435
diff changeset
   183
  $ hg add x
e71053ef0c46 record_curses: add test for newly added files
Laurent Charignon <lcharignon@fb.com>
parents: 24435
diff changeset
   184
  $ cat <<EOF >testModeCommands
42570
75fd9421440b crecord: add "x" alias for space, remove test-only "TOGGLE" alias
Kyle Lippincott <spectral@google.com>
parents: 42569
diff changeset
   185
  > x
75fd9421440b crecord: add "x" alias for space, remove test-only "TOGGLE" alias
Kyle Lippincott <spectral@google.com>
parents: 42569
diff changeset
   186
  > x
42569
756326d54761 crecord: stop using test-only "X" as alternative for "c"
Kyle Lippincott <spectral@google.com>
parents: 41438
diff changeset
   187
  > c
24469
e71053ef0c46 record_curses: add test for newly added files
Laurent Charignon <lcharignon@fb.com>
parents: 24435
diff changeset
   188
  > EOF
e71053ef0c46 record_curses: add test for newly added files
Laurent Charignon <lcharignon@fb.com>
parents: 24435
diff changeset
   189
  $ hg st
e71053ef0c46 record_curses: add test for newly added files
Laurent Charignon <lcharignon@fb.com>
parents: 24435
diff changeset
   190
  A x
e71053ef0c46 record_curses: add test for newly added files
Laurent Charignon <lcharignon@fb.com>
parents: 24435
diff changeset
   191
  ? testModeCommands
e71053ef0c46 record_curses: add test for newly added files
Laurent Charignon <lcharignon@fb.com>
parents: 24435
diff changeset
   192
  $ 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
   193
  $ hg st
e71053ef0c46 record_curses: add test for newly added files
Laurent Charignon <lcharignon@fb.com>
parents: 24435
diff changeset
   194
  ? testModeCommands
e71053ef0c46 record_curses: add test for newly added files
Laurent Charignon <lcharignon@fb.com>
parents: 24435
diff changeset
   195
43893
c06eba91c380 crecord: repurpose "a" key to toggle all selections (BC)
Jordi Gutiérrez Hermoso <jordigh@octave.org>
parents: 42573
diff changeset
   196
Test toggling all selections works
c06eba91c380 crecord: repurpose "a" key to toggle all selections (BC)
Jordi Gutiérrez Hermoso <jordigh@octave.org>
parents: 42573
diff changeset
   197
c06eba91c380 crecord: repurpose "a" key to toggle all selections (BC)
Jordi Gutiérrez Hermoso <jordigh@octave.org>
parents: 42573
diff changeset
   198
- Change one line
c06eba91c380 crecord: repurpose "a" key to toggle all selections (BC)
Jordi Gutiérrez Hermoso <jordigh@octave.org>
parents: 42573
diff changeset
   199
- Add an extra line at the end
c06eba91c380 crecord: repurpose "a" key to toggle all selections (BC)
Jordi Gutiérrez Hermoso <jordigh@octave.org>
parents: 42573
diff changeset
   200
- Unselect all
c06eba91c380 crecord: repurpose "a" key to toggle all selections (BC)
Jordi Gutiérrez Hermoso <jordigh@octave.org>
parents: 42573
diff changeset
   201
- Select the extra line at the end
c06eba91c380 crecord: repurpose "a" key to toggle all selections (BC)
Jordi Gutiérrez Hermoso <jordigh@octave.org>
parents: 42573
diff changeset
   202
- Toggle all selections (so the extra line at the is unselected and the modified line is selected)
c06eba91c380 crecord: repurpose "a" key to toggle all selections (BC)
Jordi Gutiérrez Hermoso <jordigh@octave.org>
parents: 42573
diff changeset
   203
- Commit
c06eba91c380 crecord: repurpose "a" key to toggle all selections (BC)
Jordi Gutiérrez Hermoso <jordigh@octave.org>
parents: 42573
diff changeset
   204
27156
55fa7c3900ae commit: add amend mode for commit -i
Laurent Charignon <lcharignon@fb.com>
parents: 26781
diff changeset
   205
  $ echo "hello world" > x
43893
c06eba91c380 crecord: repurpose "a" key to toggle all selections (BC)
Jordi Gutiérrez Hermoso <jordigh@octave.org>
parents: 42573
diff changeset
   206
  $ echo "goodbye world" >> x
c06eba91c380 crecord: repurpose "a" key to toggle all selections (BC)
Jordi Gutiérrez Hermoso <jordigh@octave.org>
parents: 42573
diff changeset
   207
  $ hg diff
c06eba91c380 crecord: repurpose "a" key to toggle all selections (BC)
Jordi Gutiérrez Hermoso <jordigh@octave.org>
parents: 42573
diff changeset
   208
  diff -r 2b0e9be4d336 x
c06eba91c380 crecord: repurpose "a" key to toggle all selections (BC)
Jordi Gutiérrez Hermoso <jordigh@octave.org>
parents: 42573
diff changeset
   209
  --- a/x	Thu Jan 01 00:00:00 1970 +0000
27156
55fa7c3900ae commit: add amend mode for commit -i
Laurent Charignon <lcharignon@fb.com>
parents: 26781
diff changeset
   210
  +++ b/x	Thu Jan 01 00:00:00 1970 +0000
43893
c06eba91c380 crecord: repurpose "a" key to toggle all selections (BC)
Jordi Gutiérrez Hermoso <jordigh@octave.org>
parents: 42573
diff changeset
   211
  @@ -1,1 +1,2 @@
c06eba91c380 crecord: repurpose "a" key to toggle all selections (BC)
Jordi Gutiérrez Hermoso <jordigh@octave.org>
parents: 42573
diff changeset
   212
  -hello
c06eba91c380 crecord: repurpose "a" key to toggle all selections (BC)
Jordi Gutiérrez Hermoso <jordigh@octave.org>
parents: 42573
diff changeset
   213
  +hello world
c06eba91c380 crecord: repurpose "a" key to toggle all selections (BC)
Jordi Gutiérrez Hermoso <jordigh@octave.org>
parents: 42573
diff changeset
   214
  +goodbye world
27156
55fa7c3900ae commit: add amend mode for commit -i
Laurent Charignon <lcharignon@fb.com>
parents: 26781
diff changeset
   215
  $ cat <<EOF >testModeCommands
43893
c06eba91c380 crecord: repurpose "a" key to toggle all selections (BC)
Jordi Gutiérrez Hermoso <jordigh@octave.org>
parents: 42573
diff changeset
   216
  > f
c06eba91c380 crecord: repurpose "a" key to toggle all selections (BC)
Jordi Gutiérrez Hermoso <jordigh@octave.org>
parents: 42573
diff changeset
   217
  > j
c06eba91c380 crecord: repurpose "a" key to toggle all selections (BC)
Jordi Gutiérrez Hermoso <jordigh@octave.org>
parents: 42573
diff changeset
   218
  > x
c06eba91c380 crecord: repurpose "a" key to toggle all selections (BC)
Jordi Gutiérrez Hermoso <jordigh@octave.org>
parents: 42573
diff changeset
   219
  > j
c06eba91c380 crecord: repurpose "a" key to toggle all selections (BC)
Jordi Gutiérrez Hermoso <jordigh@octave.org>
parents: 42573
diff changeset
   220
  > j
c06eba91c380 crecord: repurpose "a" key to toggle all selections (BC)
Jordi Gutiérrez Hermoso <jordigh@octave.org>
parents: 42573
diff changeset
   221
  > j
c06eba91c380 crecord: repurpose "a" key to toggle all selections (BC)
Jordi Gutiérrez Hermoso <jordigh@octave.org>
parents: 42573
diff changeset
   222
  > x
27156
55fa7c3900ae commit: add amend mode for commit -i
Laurent Charignon <lcharignon@fb.com>
parents: 26781
diff changeset
   223
  > a
42569
756326d54761 crecord: stop using test-only "X" as alternative for "c"
Kyle Lippincott <spectral@google.com>
parents: 41438
diff changeset
   224
  > c
27156
55fa7c3900ae commit: add amend mode for commit -i
Laurent Charignon <lcharignon@fb.com>
parents: 26781
diff changeset
   225
  > EOF
43893
c06eba91c380 crecord: repurpose "a" key to toggle all selections (BC)
Jordi Gutiérrez Hermoso <jordigh@octave.org>
parents: 42573
diff changeset
   226
  $ hg commit -i --amend  -m "newly added file" -d "0 0" x
35400
4441705b7111 tests: remove (glob) annotations that were only for '\' matches
Matt Harbison <matt_harbison@yahoo.com>
parents: 34102
diff changeset
   227
  saved backup bundle to $TESTTMP/a/.hg/strip-backup/2b0e9be4d336-3cf0bc8c-amend.hg
43893
c06eba91c380 crecord: repurpose "a" key to toggle all selections (BC)
Jordi Gutiérrez Hermoso <jordigh@octave.org>
parents: 42573
diff changeset
   228
  $ hg rev x --no-backup
27156
55fa7c3900ae commit: add amend mode for commit -i
Laurent Charignon <lcharignon@fb.com>
parents: 26781
diff changeset
   229
  $ hg diff -c .
55fa7c3900ae commit: add amend mode for commit -i
Laurent Charignon <lcharignon@fb.com>
parents: 26781
diff changeset
   230
  diff -r a6735021574d -r c1d239d165ae x
55fa7c3900ae commit: add amend mode for commit -i
Laurent Charignon <lcharignon@fb.com>
parents: 26781
diff changeset
   231
  --- /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
   232
  +++ 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
   233
  @@ -0,0 +1,1 @@
55fa7c3900ae commit: add amend mode for commit -i
Laurent Charignon <lcharignon@fb.com>
parents: 26781
diff changeset
   234
  +hello world
27914
505a10b504ed crecord: edit during hg crecord should preserve cursor position (issue5041)
Laurent Charignon <lcharignon@fb.com>
parents: 27321
diff changeset
   235
37875
03350f5234a4 crecord: fix line number in hunk header (issue5917)
Jun Wu <quark@fb.com>
parents: 35400
diff changeset
   236
Make file empty
37876
2baf79933b45 tests: replace `echo -n` with `printf` per check-code
Augie Fackler <augie@google.com>
parents: 37875
diff changeset
   237
  $ printf "" > x
37875
03350f5234a4 crecord: fix line number in hunk header (issue5917)
Jun Wu <quark@fb.com>
parents: 35400
diff changeset
   238
  $ cat <<EOF >testModeCommands
42569
756326d54761 crecord: stop using test-only "X" as alternative for "c"
Kyle Lippincott <spectral@google.com>
parents: 41438
diff changeset
   239
  > c
37875
03350f5234a4 crecord: fix line number in hunk header (issue5917)
Jun Wu <quark@fb.com>
parents: 35400
diff changeset
   240
  > EOF
03350f5234a4 crecord: fix line number in hunk header (issue5917)
Jun Wu <quark@fb.com>
parents: 35400
diff changeset
   241
  $ hg ci -i -m emptify -d "0 0"
03350f5234a4 crecord: fix line number in hunk header (issue5917)
Jun Wu <quark@fb.com>
parents: 35400
diff changeset
   242
  $ hg update -C '.^' -q
03350f5234a4 crecord: fix line number in hunk header (issue5917)
Jun Wu <quark@fb.com>
parents: 35400
diff changeset
   243
27914
505a10b504ed crecord: edit during hg crecord should preserve cursor position (issue5041)
Laurent Charignon <lcharignon@fb.com>
parents: 27321
diff changeset
   244
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
   245
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
   246
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
   247
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
   248
of the edit.
505a10b504ed crecord: edit during hg crecord should preserve cursor position (issue5041)
Laurent Charignon <lcharignon@fb.com>
parents: 27321
diff changeset
   249
505a10b504ed crecord: edit during hg crecord should preserve cursor position (issue5041)
Laurent Charignon <lcharignon@fb.com>
parents: 27321
diff changeset
   250
  $ hg update -C .
505a10b504ed crecord: edit during hg crecord should preserve cursor position (issue5041)
Laurent Charignon <lcharignon@fb.com>
parents: 27321
diff changeset
   251
  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
   252
  $ echo "foo" > x
505a10b504ed crecord: edit during hg crecord should preserve cursor position (issue5041)
Laurent Charignon <lcharignon@fb.com>
parents: 27321
diff changeset
   253
  $ echo "hello world" >> x
505a10b504ed crecord: edit during hg crecord should preserve cursor position (issue5041)
Laurent Charignon <lcharignon@fb.com>
parents: 27321
diff changeset
   254
  $ echo "bar" >> x
505a10b504ed crecord: edit during hg crecord should preserve cursor position (issue5041)
Laurent Charignon <lcharignon@fb.com>
parents: 27321
diff changeset
   255
  $ cat <<EOF >testModeCommands
505a10b504ed crecord: edit during hg crecord should preserve cursor position (issue5041)
Laurent Charignon <lcharignon@fb.com>
parents: 27321
diff changeset
   256
  > f
505a10b504ed crecord: edit during hg crecord should preserve cursor position (issue5041)
Laurent Charignon <lcharignon@fb.com>
parents: 27321
diff changeset
   257
  > KEY_DOWN
505a10b504ed crecord: edit during hg crecord should preserve cursor position (issue5041)
Laurent Charignon <lcharignon@fb.com>
parents: 27321
diff changeset
   258
  > KEY_DOWN
505a10b504ed crecord: edit during hg crecord should preserve cursor position (issue5041)
Laurent Charignon <lcharignon@fb.com>
parents: 27321
diff changeset
   259
  > KEY_DOWN
505a10b504ed crecord: edit during hg crecord should preserve cursor position (issue5041)
Laurent Charignon <lcharignon@fb.com>
parents: 27321
diff changeset
   260
  > KEY_DOWN
505a10b504ed crecord: edit during hg crecord should preserve cursor position (issue5041)
Laurent Charignon <lcharignon@fb.com>
parents: 27321
diff changeset
   261
  > e
42570
75fd9421440b crecord: add "x" alias for space, remove test-only "TOGGLE" alias
Kyle Lippincott <spectral@google.com>
parents: 42569
diff changeset
   262
  > x
42569
756326d54761 crecord: stop using test-only "X" as alternative for "c"
Kyle Lippincott <spectral@google.com>
parents: 41438
diff changeset
   263
  > c
27914
505a10b504ed crecord: edit during hg crecord should preserve cursor position (issue5041)
Laurent Charignon <lcharignon@fb.com>
parents: 27321
diff changeset
   264
  > EOF
505a10b504ed crecord: edit during hg crecord should preserve cursor position (issue5041)
Laurent Charignon <lcharignon@fb.com>
parents: 27321
diff changeset
   265
  $ printf "printf 'editor ran\n'; exit 0" > editor.sh
37875
03350f5234a4 crecord: fix line number in hunk header (issue5917)
Jun Wu <quark@fb.com>
parents: 35400
diff changeset
   266
  $ HGEDITOR="\"sh\" \"`pwd`/editor.sh\"" hg commit  -i -m "edit hunk" -d "0 0" -q
27914
505a10b504ed crecord: edit during hg crecord should preserve cursor position (issue5041)
Laurent Charignon <lcharignon@fb.com>
parents: 27321
diff changeset
   267
  editor ran
505a10b504ed crecord: edit during hg crecord should preserve cursor position (issue5041)
Laurent Charignon <lcharignon@fb.com>
parents: 27321
diff changeset
   268
  $ hg cat -r . x
505a10b504ed crecord: edit during hg crecord should preserve cursor position (issue5041)
Laurent Charignon <lcharignon@fb.com>
parents: 27321
diff changeset
   269
  foo
505a10b504ed crecord: edit during hg crecord should preserve cursor position (issue5041)
Laurent Charignon <lcharignon@fb.com>
parents: 27321
diff changeset
   270
  hello world
505a10b504ed crecord: edit during hg crecord should preserve cursor position (issue5041)
Laurent Charignon <lcharignon@fb.com>
parents: 27321
diff changeset
   271
28638
44319097e7b9 crecord: re-enable reviewing a patch before comitting it
Jordi Gutiérrez Hermoso <jordigh@octave.org>
parents: 28543
diff changeset
   272
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
   273
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
   274
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
   275
"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
   276
reflect this edition.
27914
505a10b504ed crecord: edit during hg crecord should preserve cursor position (issue5041)
Laurent Charignon <lcharignon@fb.com>
parents: 27321
diff changeset
   277
28638
44319097e7b9 crecord: re-enable reviewing a patch before comitting it
Jordi Gutiérrez Hermoso <jordigh@octave.org>
parents: 28543
diff changeset
   278
  $ hg update -C .
44319097e7b9 crecord: re-enable reviewing a patch before comitting it
Jordi Gutiérrez Hermoso <jordigh@octave.org>
parents: 28543
diff changeset
   279
  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
   280
  $ echo "top" > c
44319097e7b9 crecord: re-enable reviewing a patch before comitting it
Jordi Gutiérrez Hermoso <jordigh@octave.org>
parents: 28543
diff changeset
   281
  $ cat x >> c
44319097e7b9 crecord: re-enable reviewing a patch before comitting it
Jordi Gutiérrez Hermoso <jordigh@octave.org>
parents: 28543
diff changeset
   282
  $ echo "bottom" >> c
44319097e7b9 crecord: re-enable reviewing a patch before comitting it
Jordi Gutiérrez Hermoso <jordigh@octave.org>
parents: 28543
diff changeset
   283
  $ mv c x
44319097e7b9 crecord: re-enable reviewing a patch before comitting it
Jordi Gutiérrez Hermoso <jordigh@octave.org>
parents: 28543
diff changeset
   284
  $ 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
   285
  $ 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
   286
44319097e7b9 crecord: re-enable reviewing a patch before comitting it
Jordi Gutiérrez Hermoso <jordigh@octave.org>
parents: 28543
diff changeset
   287
  $ 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
   288
  > cat "\$1"
44319097e7b9 crecord: re-enable reviewing a patch before comitting it
Jordi Gutiérrez Hermoso <jordigh@octave.org>
parents: 28543
diff changeset
   289
  > 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
   290
  > mv tmp "\$1"
44319097e7b9 crecord: re-enable reviewing a patch before comitting it
Jordi Gutiérrez Hermoso <jordigh@octave.org>
parents: 28543
diff changeset
   291
  > EOF
44319097e7b9 crecord: re-enable reviewing a patch before comitting it
Jordi Gutiérrez Hermoso <jordigh@octave.org>
parents: 28543
diff changeset
   292
  $ cat > testModeCommands <<EOF
44319097e7b9 crecord: re-enable reviewing a patch before comitting it
Jordi Gutiérrez Hermoso <jordigh@octave.org>
parents: 28543
diff changeset
   293
  > KEY_DOWN
42570
75fd9421440b crecord: add "x" alias for space, remove test-only "TOGGLE" alias
Kyle Lippincott <spectral@google.com>
parents: 42569
diff changeset
   294
  > x
28638
44319097e7b9 crecord: re-enable reviewing a patch before comitting it
Jordi Gutiérrez Hermoso <jordigh@octave.org>
parents: 28543
diff changeset
   295
  > KEY_DOWN
44319097e7b9 crecord: re-enable reviewing a patch before comitting it
Jordi Gutiérrez Hermoso <jordigh@octave.org>
parents: 28543
diff changeset
   296
  > f
44319097e7b9 crecord: re-enable reviewing a patch before comitting it
Jordi Gutiérrez Hermoso <jordigh@octave.org>
parents: 28543
diff changeset
   297
  > KEY_DOWN
42570
75fd9421440b crecord: add "x" alias for space, remove test-only "TOGGLE" alias
Kyle Lippincott <spectral@google.com>
parents: 42569
diff changeset
   298
  > x
28638
44319097e7b9 crecord: re-enable reviewing a patch before comitting it
Jordi Gutiérrez Hermoso <jordigh@octave.org>
parents: 28543
diff changeset
   299
  > R
44319097e7b9 crecord: re-enable reviewing a patch before comitting it
Jordi Gutiérrez Hermoso <jordigh@octave.org>
parents: 28543
diff changeset
   300
  > EOF
44319097e7b9 crecord: re-enable reviewing a patch before comitting it
Jordi Gutiérrez Hermoso <jordigh@octave.org>
parents: 28543
diff changeset
   301
44319097e7b9 crecord: re-enable reviewing a patch before comitting it
Jordi Gutiérrez Hermoso <jordigh@octave.org>
parents: 28543
diff changeset
   302
  $ 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
   303
  # 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
   304
  # 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
   305
  # 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
   306
  #
44319097e7b9 crecord: re-enable reviewing a patch before comitting it
Jordi Gutiérrez Hermoso <jordigh@octave.org>
parents: 28543
diff changeset
   307
  # 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
   308
  # 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
   309
  # 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
   310
  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
   311
  --- a/a
44319097e7b9 crecord: re-enable reviewing a patch before comitting it
Jordi Gutiérrez Hermoso <jordigh@octave.org>
parents: 28543
diff changeset
   312
  +++ b/a
44319097e7b9 crecord: re-enable reviewing a patch before comitting it
Jordi Gutiérrez Hermoso <jordigh@octave.org>
parents: 28543
diff changeset
   313
  @@ -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
   314
   a
44319097e7b9 crecord: re-enable reviewing a patch before comitting it
Jordi Gutiérrez Hermoso <jordigh@octave.org>
parents: 28543
diff changeset
   315
   a
44319097e7b9 crecord: re-enable reviewing a patch before comitting it
Jordi Gutiérrez Hermoso <jordigh@octave.org>
parents: 28543
diff changeset
   316
  +third a
44319097e7b9 crecord: re-enable reviewing a patch before comitting it
Jordi Gutiérrez Hermoso <jordigh@octave.org>
parents: 28543
diff changeset
   317
  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
   318
  --- a/x
44319097e7b9 crecord: re-enable reviewing a patch before comitting it
Jordi Gutiérrez Hermoso <jordigh@octave.org>
parents: 28543
diff changeset
   319
  +++ b/x
44319097e7b9 crecord: re-enable reviewing a patch before comitting it
Jordi Gutiérrez Hermoso <jordigh@octave.org>
parents: 28543
diff changeset
   320
  @@ -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
   321
   foo
44319097e7b9 crecord: re-enable reviewing a patch before comitting it
Jordi Gutiérrez Hermoso <jordigh@octave.org>
parents: 28543
diff changeset
   322
   hello world
44319097e7b9 crecord: re-enable reviewing a patch before comitting it
Jordi Gutiérrez Hermoso <jordigh@octave.org>
parents: 28543
diff changeset
   323
  +bottom
44319097e7b9 crecord: re-enable reviewing a patch before comitting it
Jordi Gutiérrez Hermoso <jordigh@octave.org>
parents: 28543
diff changeset
   324
44319097e7b9 crecord: re-enable reviewing a patch before comitting it
Jordi Gutiérrez Hermoso <jordigh@octave.org>
parents: 28543
diff changeset
   325
  $ 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
   326
  a
44319097e7b9 crecord: re-enable reviewing a patch before comitting it
Jordi Gutiérrez Hermoso <jordigh@octave.org>
parents: 28543
diff changeset
   327
  a
44319097e7b9 crecord: re-enable reviewing a patch before comitting it
Jordi Gutiérrez Hermoso <jordigh@octave.org>
parents: 28543
diff changeset
   328
  third a
44319097e7b9 crecord: re-enable reviewing a patch before comitting it
Jordi Gutiérrez Hermoso <jordigh@octave.org>
parents: 28543
diff changeset
   329
44319097e7b9 crecord: re-enable reviewing a patch before comitting it
Jordi Gutiérrez Hermoso <jordigh@octave.org>
parents: 28543
diff changeset
   330
  $ 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
   331
  x
44319097e7b9 crecord: re-enable reviewing a patch before comitting it
Jordi Gutiérrez Hermoso <jordigh@octave.org>
parents: 28543
diff changeset
   332
  1
44319097e7b9 crecord: re-enable reviewing a patch before comitting it
Jordi Gutiérrez Hermoso <jordigh@octave.org>
parents: 28543
diff changeset
   333
  2
44319097e7b9 crecord: re-enable reviewing a patch before comitting it
Jordi Gutiérrez Hermoso <jordigh@octave.org>
parents: 28543
diff changeset
   334
  3
44319097e7b9 crecord: re-enable reviewing a patch before comitting it
Jordi Gutiérrez Hermoso <jordigh@octave.org>
parents: 28543
diff changeset
   335
  4
44319097e7b9 crecord: re-enable reviewing a patch before comitting it
Jordi Gutiérrez Hermoso <jordigh@octave.org>
parents: 28543
diff changeset
   336
  5
44319097e7b9 crecord: re-enable reviewing a patch before comitting it
Jordi Gutiérrez Hermoso <jordigh@octave.org>
parents: 28543
diff changeset
   337
  6
44319097e7b9 crecord: re-enable reviewing a patch before comitting it
Jordi Gutiérrez Hermoso <jordigh@octave.org>
parents: 28543
diff changeset
   338
  7
44319097e7b9 crecord: re-enable reviewing a patch before comitting it
Jordi Gutiérrez Hermoso <jordigh@octave.org>
parents: 28543
diff changeset
   339
  8
44319097e7b9 crecord: re-enable reviewing a patch before comitting it
Jordi Gutiérrez Hermoso <jordigh@octave.org>
parents: 28543
diff changeset
   340
  9
44319097e7b9 crecord: re-enable reviewing a patch before comitting it
Jordi Gutiérrez Hermoso <jordigh@octave.org>
parents: 28543
diff changeset
   341
  10
44319097e7b9 crecord: re-enable reviewing a patch before comitting it
Jordi Gutiérrez Hermoso <jordigh@octave.org>
parents: 28543
diff changeset
   342
  y
44319097e7b9 crecord: re-enable reviewing a patch before comitting it
Jordi Gutiérrez Hermoso <jordigh@octave.org>
parents: 28543
diff changeset
   343
44319097e7b9 crecord: re-enable reviewing a patch before comitting it
Jordi Gutiérrez Hermoso <jordigh@octave.org>
parents: 28543
diff changeset
   344
  $ 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
   345
  foo
44319097e7b9 crecord: re-enable reviewing a patch before comitting it
Jordi Gutiérrez Hermoso <jordigh@octave.org>
parents: 28543
diff changeset
   346
  hello world
44319097e7b9 crecord: re-enable reviewing a patch before comitting it
Jordi Gutiérrez Hermoso <jordigh@octave.org>
parents: 28543
diff changeset
   347
  lower
30831
9f264adbe75b tests: test experimental.spacemovesdown config for commit -i
Anton Shestakov <av6@dwimlabs.net>
parents: 30564
diff changeset
   348
42573
9ac1a5a4a64f crecord: provide 'X' as a range-select mechanism
Kyle Lippincott <spectral@google.com>
parents: 42570
diff changeset
   349
Test range select: unselect 3, 5, and 6, reselect 5, then go back up to 2 and
9ac1a5a4a64f crecord: provide 'X' as a range-select mechanism
Kyle Lippincott <spectral@google.com>
parents: 42570
diff changeset
   350
press 'X', unselecting (because 2 is currently selected) 5 (because it's the
9ac1a5a4a64f crecord: provide 'X' as a range-select mechanism
Kyle Lippincott <spectral@google.com>
parents: 42570
diff changeset
   351
start of the range) and 4, leaving 3 unselected.
9ac1a5a4a64f crecord: provide 'X' as a range-select mechanism
Kyle Lippincott <spectral@google.com>
parents: 42570
diff changeset
   352
9ac1a5a4a64f crecord: provide 'X' as a range-select mechanism
Kyle Lippincott <spectral@google.com>
parents: 42570
diff changeset
   353
  $ hg init $TESTTMP/range_select
9ac1a5a4a64f crecord: provide 'X' as a range-select mechanism
Kyle Lippincott <spectral@google.com>
parents: 42570
diff changeset
   354
  $ cd $TESTTMP/range_select
9ac1a5a4a64f crecord: provide 'X' as a range-select mechanism
Kyle Lippincott <spectral@google.com>
parents: 42570
diff changeset
   355
  >>> open('range_select', 'wb').write(b"1\n2\n3\n4\n5\n6\n7\n8\n9\n10\n") and None
9ac1a5a4a64f crecord: provide 'X' as a range-select mechanism
Kyle Lippincott <spectral@google.com>
parents: 42570
diff changeset
   356
  $ hg add range_select
9ac1a5a4a64f crecord: provide 'X' as a range-select mechanism
Kyle Lippincott <spectral@google.com>
parents: 42570
diff changeset
   357
  $ cat <<EOF >testModeCommands
9ac1a5a4a64f crecord: provide 'X' as a range-select mechanism
Kyle Lippincott <spectral@google.com>
parents: 42570
diff changeset
   358
  > KEY_RIGHT
9ac1a5a4a64f crecord: provide 'X' as a range-select mechanism
Kyle Lippincott <spectral@google.com>
parents: 42570
diff changeset
   359
  > KEY_RIGHT
9ac1a5a4a64f crecord: provide 'X' as a range-select mechanism
Kyle Lippincott <spectral@google.com>
parents: 42570
diff changeset
   360
  > KEY_DOWN
9ac1a5a4a64f crecord: provide 'X' as a range-select mechanism
Kyle Lippincott <spectral@google.com>
parents: 42570
diff changeset
   361
  > KEY_DOWN
9ac1a5a4a64f crecord: provide 'X' as a range-select mechanism
Kyle Lippincott <spectral@google.com>
parents: 42570
diff changeset
   362
  > KEY_ENTER
9ac1a5a4a64f crecord: provide 'X' as a range-select mechanism
Kyle Lippincott <spectral@google.com>
parents: 42570
diff changeset
   363
  > KEY_DOWN
9ac1a5a4a64f crecord: provide 'X' as a range-select mechanism
Kyle Lippincott <spectral@google.com>
parents: 42570
diff changeset
   364
  > KEY_ENTER
9ac1a5a4a64f crecord: provide 'X' as a range-select mechanism
Kyle Lippincott <spectral@google.com>
parents: 42570
diff changeset
   365
  > x
9ac1a5a4a64f crecord: provide 'X' as a range-select mechanism
Kyle Lippincott <spectral@google.com>
parents: 42570
diff changeset
   366
  > KEY_UP
9ac1a5a4a64f crecord: provide 'X' as a range-select mechanism
Kyle Lippincott <spectral@google.com>
parents: 42570
diff changeset
   367
  > x
9ac1a5a4a64f crecord: provide 'X' as a range-select mechanism
Kyle Lippincott <spectral@google.com>
parents: 42570
diff changeset
   368
  > KEY_UP
9ac1a5a4a64f crecord: provide 'X' as a range-select mechanism
Kyle Lippincott <spectral@google.com>
parents: 42570
diff changeset
   369
  > KEY_UP
9ac1a5a4a64f crecord: provide 'X' as a range-select mechanism
Kyle Lippincott <spectral@google.com>
parents: 42570
diff changeset
   370
  > KEY_UP
9ac1a5a4a64f crecord: provide 'X' as a range-select mechanism
Kyle Lippincott <spectral@google.com>
parents: 42570
diff changeset
   371
  > X
9ac1a5a4a64f crecord: provide 'X' as a range-select mechanism
Kyle Lippincott <spectral@google.com>
parents: 42570
diff changeset
   372
  > c
9ac1a5a4a64f crecord: provide 'X' as a range-select mechanism
Kyle Lippincott <spectral@google.com>
parents: 42570
diff changeset
   373
  > EOF
9ac1a5a4a64f crecord: provide 'X' as a range-select mechanism
Kyle Lippincott <spectral@google.com>
parents: 42570
diff changeset
   374
  $ hg commit -i -m "range_select" -d "0 0"
9ac1a5a4a64f crecord: provide 'X' as a range-select mechanism
Kyle Lippincott <spectral@google.com>
parents: 42570
diff changeset
   375
  $ hg cat -r tip range_select
9ac1a5a4a64f crecord: provide 'X' as a range-select mechanism
Kyle Lippincott <spectral@google.com>
parents: 42570
diff changeset
   376
  1
9ac1a5a4a64f crecord: provide 'X' as a range-select mechanism
Kyle Lippincott <spectral@google.com>
parents: 42570
diff changeset
   377
  7
9ac1a5a4a64f crecord: provide 'X' as a range-select mechanism
Kyle Lippincott <spectral@google.com>
parents: 42570
diff changeset
   378
  8
9ac1a5a4a64f crecord: provide 'X' as a range-select mechanism
Kyle Lippincott <spectral@google.com>
parents: 42570
diff changeset
   379
  9
9ac1a5a4a64f crecord: provide 'X' as a range-select mechanism
Kyle Lippincott <spectral@google.com>
parents: 42570
diff changeset
   380
  10
9ac1a5a4a64f crecord: provide 'X' as a range-select mechanism
Kyle Lippincott <spectral@google.com>
parents: 42570
diff changeset
   381
  $ cat range_select
9ac1a5a4a64f crecord: provide 'X' as a range-select mechanism
Kyle Lippincott <spectral@google.com>
parents: 42570
diff changeset
   382
  1
9ac1a5a4a64f crecord: provide 'X' as a range-select mechanism
Kyle Lippincott <spectral@google.com>
parents: 42570
diff changeset
   383
  2
9ac1a5a4a64f crecord: provide 'X' as a range-select mechanism
Kyle Lippincott <spectral@google.com>
parents: 42570
diff changeset
   384
  3
9ac1a5a4a64f crecord: provide 'X' as a range-select mechanism
Kyle Lippincott <spectral@google.com>
parents: 42570
diff changeset
   385
  4
9ac1a5a4a64f crecord: provide 'X' as a range-select mechanism
Kyle Lippincott <spectral@google.com>
parents: 42570
diff changeset
   386
  5
9ac1a5a4a64f crecord: provide 'X' as a range-select mechanism
Kyle Lippincott <spectral@google.com>
parents: 42570
diff changeset
   387
  6
9ac1a5a4a64f crecord: provide 'X' as a range-select mechanism
Kyle Lippincott <spectral@google.com>
parents: 42570
diff changeset
   388
  7
9ac1a5a4a64f crecord: provide 'X' as a range-select mechanism
Kyle Lippincott <spectral@google.com>
parents: 42570
diff changeset
   389
  8
9ac1a5a4a64f crecord: provide 'X' as a range-select mechanism
Kyle Lippincott <spectral@google.com>
parents: 42570
diff changeset
   390
  9
9ac1a5a4a64f crecord: provide 'X' as a range-select mechanism
Kyle Lippincott <spectral@google.com>
parents: 42570
diff changeset
   391
  10
9ac1a5a4a64f crecord: provide 'X' as a range-select mechanism
Kyle Lippincott <spectral@google.com>
parents: 42570
diff changeset
   392
28542
71e12fc53b80 ui: add new config flag for interface selection
Simon Farnsworth <simonfar@fb.com>
parents: 27914
diff changeset
   393
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
   394
71e12fc53b80 ui: add new config flag for interface selection
Simon Farnsworth <simonfar@fb.com>
parents: 27914
diff changeset
   395
The default interface is text
71e12fc53b80 ui: add new config flag for interface selection
Simon Farnsworth <simonfar@fb.com>
parents: 27914
diff changeset
   396
  $ cp $HGRCPATH.pretest $HGRCPATH
71e12fc53b80 ui: add new config flag for interface selection
Simon Farnsworth <simonfar@fb.com>
parents: 27914
diff changeset
   397
  $ chunkselectorinterface() {
39723
5abc47d4ca6b tests: quote PYTHON usage
Matt Harbison <matt_harbison@yahoo.com>
parents: 38726
diff changeset
   398
  > "$PYTHON" <<EOF
41438
1d99c9a5ccb0 tests: handles bytes/str mismatch in test-commit-interface-curses.t
Gregory Szorc <gregory.szorc@gmail.com>
parents: 40253
diff changeset
   399
  > from mercurial import hg, pycompat, ui;\
1d99c9a5ccb0 tests: handles bytes/str mismatch in test-commit-interface-curses.t
Gregory Szorc <gregory.szorc@gmail.com>
parents: 40253
diff changeset
   400
  > repo = hg.repository(ui.ui.load(), b".");\
1d99c9a5ccb0 tests: handles bytes/str mismatch in test-commit-interface-curses.t
Gregory Szorc <gregory.szorc@gmail.com>
parents: 40253
diff changeset
   401
  > print(pycompat.sysstr(repo.ui.interface(b"chunkselector")))
28542
71e12fc53b80 ui: add new config flag for interface selection
Simon Farnsworth <simonfar@fb.com>
parents: 27914
diff changeset
   402
  > EOF
71e12fc53b80 ui: add new config flag for interface selection
Simon Farnsworth <simonfar@fb.com>
parents: 27914
diff changeset
   403
  > }
71e12fc53b80 ui: add new config flag for interface selection
Simon Farnsworth <simonfar@fb.com>
parents: 27914
diff changeset
   404
  $ chunkselectorinterface
71e12fc53b80 ui: add new config flag for interface selection
Simon Farnsworth <simonfar@fb.com>
parents: 27914
diff changeset
   405
  text
71e12fc53b80 ui: add new config flag for interface selection
Simon Farnsworth <simonfar@fb.com>
parents: 27914
diff changeset
   406
71e12fc53b80 ui: add new config flag for interface selection
Simon Farnsworth <simonfar@fb.com>
parents: 27914
diff changeset
   407
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
   408
  $ cp $HGRCPATH.pretest $HGRCPATH
71e12fc53b80 ui: add new config flag for interface selection
Simon Farnsworth <simonfar@fb.com>
parents: 27914
diff changeset
   409
  $ cat <<EOF >> $HGRCPATH
71e12fc53b80 ui: add new config flag for interface selection
Simon Farnsworth <simonfar@fb.com>
parents: 27914
diff changeset
   410
  > [ui]
71e12fc53b80 ui: add new config flag for interface selection
Simon Farnsworth <simonfar@fb.com>
parents: 27914
diff changeset
   411
  > interface = curses
71e12fc53b80 ui: add new config flag for interface selection
Simon Farnsworth <simonfar@fb.com>
parents: 27914
diff changeset
   412
  > EOF
71e12fc53b80 ui: add new config flag for interface selection
Simon Farnsworth <simonfar@fb.com>
parents: 27914
diff changeset
   413
  $ chunkselectorinterface
71e12fc53b80 ui: add new config flag for interface selection
Simon Farnsworth <simonfar@fb.com>
parents: 27914
diff changeset
   414
  curses
71e12fc53b80 ui: add new config flag for interface selection
Simon Farnsworth <simonfar@fb.com>
parents: 27914
diff changeset
   415
38726
d79f3afb079e curses: use "text" interface if TERM=dumb
Kyle Lippincott <spectral@google.com>
parents: 38431
diff changeset
   416
If TERM=dumb, we use text, even if the config says curses
d79f3afb079e curses: use "text" interface if TERM=dumb
Kyle Lippincott <spectral@google.com>
parents: 38431
diff changeset
   417
  $ chunkselectorinterface
d79f3afb079e curses: use "text" interface if TERM=dumb
Kyle Lippincott <spectral@google.com>
parents: 38431
diff changeset
   418
  curses
d79f3afb079e curses: use "text" interface if TERM=dumb
Kyle Lippincott <spectral@google.com>
parents: 38431
diff changeset
   419
  $ TERM=dumb chunkselectorinterface
d79f3afb079e curses: use "text" interface if TERM=dumb
Kyle Lippincott <spectral@google.com>
parents: 38431
diff changeset
   420
  text
d79f3afb079e curses: use "text" interface if TERM=dumb
Kyle Lippincott <spectral@google.com>
parents: 38431
diff changeset
   421
(Something is keeping TERM=dumb in the environment unless I do this, it's not
d79f3afb079e curses: use "text" interface if TERM=dumb
Kyle Lippincott <spectral@google.com>
parents: 38431
diff changeset
   422
scoped to just that previous command like in many shells)
d79f3afb079e curses: use "text" interface if TERM=dumb
Kyle Lippincott <spectral@google.com>
parents: 38431
diff changeset
   423
  $ TERM=xterm chunkselectorinterface
d79f3afb079e curses: use "text" interface if TERM=dumb
Kyle Lippincott <spectral@google.com>
parents: 38431
diff changeset
   424
  curses
d79f3afb079e curses: use "text" interface if TERM=dumb
Kyle Lippincott <spectral@google.com>
parents: 38431
diff changeset
   425
28542
71e12fc53b80 ui: add new config flag for interface selection
Simon Farnsworth <simonfar@fb.com>
parents: 27914
diff changeset
   426
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
   427
interface
71e12fc53b80 ui: add new config flag for interface selection
Simon Farnsworth <simonfar@fb.com>
parents: 27914
diff changeset
   428
  $ cp $HGRCPATH.pretest $HGRCPATH
71e12fc53b80 ui: add new config flag for interface selection
Simon Farnsworth <simonfar@fb.com>
parents: 27914
diff changeset
   429
  $ cat <<EOF >> $HGRCPATH
71e12fc53b80 ui: add new config flag for interface selection
Simon Farnsworth <simonfar@fb.com>
parents: 27914
diff changeset
   430
  > [ui]
71e12fc53b80 ui: add new config flag for interface selection
Simon Farnsworth <simonfar@fb.com>
parents: 27914
diff changeset
   431
  > interface = text
71e12fc53b80 ui: add new config flag for interface selection
Simon Farnsworth <simonfar@fb.com>
parents: 27914
diff changeset
   432
  > interface.chunkselector = curses
71e12fc53b80 ui: add new config flag for interface selection
Simon Farnsworth <simonfar@fb.com>
parents: 27914
diff changeset
   433
  > EOF
71e12fc53b80 ui: add new config flag for interface selection
Simon Farnsworth <simonfar@fb.com>
parents: 27914
diff changeset
   434
71e12fc53b80 ui: add new config flag for interface selection
Simon Farnsworth <simonfar@fb.com>
parents: 27914
diff changeset
   435
  $ chunkselectorinterface
71e12fc53b80 ui: add new config flag for interface selection
Simon Farnsworth <simonfar@fb.com>
parents: 27914
diff changeset
   436
  curses
71e12fc53b80 ui: add new config flag for interface selection
Simon Farnsworth <simonfar@fb.com>
parents: 27914
diff changeset
   437
71e12fc53b80 ui: add new config flag for interface selection
Simon Farnsworth <simonfar@fb.com>
parents: 27914
diff changeset
   438
  $ cp $HGRCPATH.pretest $HGRCPATH
71e12fc53b80 ui: add new config flag for interface selection
Simon Farnsworth <simonfar@fb.com>
parents: 27914
diff changeset
   439
  $ cat <<EOF >> $HGRCPATH
71e12fc53b80 ui: add new config flag for interface selection
Simon Farnsworth <simonfar@fb.com>
parents: 27914
diff changeset
   440
  > [ui]
71e12fc53b80 ui: add new config flag for interface selection
Simon Farnsworth <simonfar@fb.com>
parents: 27914
diff changeset
   441
  > interface = curses
71e12fc53b80 ui: add new config flag for interface selection
Simon Farnsworth <simonfar@fb.com>
parents: 27914
diff changeset
   442
  > interface.chunkselector = text
71e12fc53b80 ui: add new config flag for interface selection
Simon Farnsworth <simonfar@fb.com>
parents: 27914
diff changeset
   443
  > EOF
71e12fc53b80 ui: add new config flag for interface selection
Simon Farnsworth <simonfar@fb.com>
parents: 27914
diff changeset
   444
71e12fc53b80 ui: add new config flag for interface selection
Simon Farnsworth <simonfar@fb.com>
parents: 27914
diff changeset
   445
  $ chunkselectorinterface
71e12fc53b80 ui: add new config flag for interface selection
Simon Farnsworth <simonfar@fb.com>
parents: 27914
diff changeset
   446
  text
71e12fc53b80 ui: add new config flag for interface selection
Simon Farnsworth <simonfar@fb.com>
parents: 27914
diff changeset
   447
71e12fc53b80 ui: add new config flag for interface selection
Simon Farnsworth <simonfar@fb.com>
parents: 27914
diff changeset
   448
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
   449
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
   450
71e12fc53b80 ui: add new config flag for interface selection
Simon Farnsworth <simonfar@fb.com>
parents: 27914
diff changeset
   451
  $ cp $HGRCPATH.pretest $HGRCPATH
71e12fc53b80 ui: add new config flag for interface selection
Simon Farnsworth <simonfar@fb.com>
parents: 27914
diff changeset
   452
  $ cat <<EOF >> $HGRCPATH
71e12fc53b80 ui: add new config flag for interface selection
Simon Farnsworth <simonfar@fb.com>
parents: 27914
diff changeset
   453
  > [ui]
71e12fc53b80 ui: add new config flag for interface selection
Simon Farnsworth <simonfar@fb.com>
parents: 27914
diff changeset
   454
  > interface = blah
71e12fc53b80 ui: add new config flag for interface selection
Simon Farnsworth <simonfar@fb.com>
parents: 27914
diff changeset
   455
  > EOF
71e12fc53b80 ui: add new config flag for interface selection
Simon Farnsworth <simonfar@fb.com>
parents: 27914
diff changeset
   456
  $ chunkselectorinterface
71e12fc53b80 ui: add new config flag for interface selection
Simon Farnsworth <simonfar@fb.com>
parents: 27914
diff changeset
   457
  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
   458
  text
71e12fc53b80 ui: add new config flag for interface selection
Simon Farnsworth <simonfar@fb.com>
parents: 27914
diff changeset
   459
71e12fc53b80 ui: add new config flag for interface selection
Simon Farnsworth <simonfar@fb.com>
parents: 27914
diff changeset
   460
  $ cp $HGRCPATH.pretest $HGRCPATH
71e12fc53b80 ui: add new config flag for interface selection
Simon Farnsworth <simonfar@fb.com>
parents: 27914
diff changeset
   461
  $ cat <<EOF >> $HGRCPATH
71e12fc53b80 ui: add new config flag for interface selection
Simon Farnsworth <simonfar@fb.com>
parents: 27914
diff changeset
   462
  > [ui]
71e12fc53b80 ui: add new config flag for interface selection
Simon Farnsworth <simonfar@fb.com>
parents: 27914
diff changeset
   463
  > interface = curses
71e12fc53b80 ui: add new config flag for interface selection
Simon Farnsworth <simonfar@fb.com>
parents: 27914
diff changeset
   464
  > interface.chunkselector = blah
71e12fc53b80 ui: add new config flag for interface selection
Simon Farnsworth <simonfar@fb.com>
parents: 27914
diff changeset
   465
  > EOF
71e12fc53b80 ui: add new config flag for interface selection
Simon Farnsworth <simonfar@fb.com>
parents: 27914
diff changeset
   466
  $ chunkselectorinterface
71e12fc53b80 ui: add new config flag for interface selection
Simon Farnsworth <simonfar@fb.com>
parents: 27914
diff changeset
   467
  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
   468
  curses
71e12fc53b80 ui: add new config flag for interface selection
Simon Farnsworth <simonfar@fb.com>
parents: 27914
diff changeset
   469
71e12fc53b80 ui: add new config flag for interface selection
Simon Farnsworth <simonfar@fb.com>
parents: 27914
diff changeset
   470
  $ cp $HGRCPATH.pretest $HGRCPATH
71e12fc53b80 ui: add new config flag for interface selection
Simon Farnsworth <simonfar@fb.com>
parents: 27914
diff changeset
   471
  $ cat <<EOF >> $HGRCPATH
71e12fc53b80 ui: add new config flag for interface selection
Simon Farnsworth <simonfar@fb.com>
parents: 27914
diff changeset
   472
  > [ui]
71e12fc53b80 ui: add new config flag for interface selection
Simon Farnsworth <simonfar@fb.com>
parents: 27914
diff changeset
   473
  > interface = blah
71e12fc53b80 ui: add new config flag for interface selection
Simon Farnsworth <simonfar@fb.com>
parents: 27914
diff changeset
   474
  > interface.chunkselector = curses
71e12fc53b80 ui: add new config flag for interface selection
Simon Farnsworth <simonfar@fb.com>
parents: 27914
diff changeset
   475
  > EOF
71e12fc53b80 ui: add new config flag for interface selection
Simon Farnsworth <simonfar@fb.com>
parents: 27914
diff changeset
   476
  $ chunkselectorinterface
71e12fc53b80 ui: add new config flag for interface selection
Simon Farnsworth <simonfar@fb.com>
parents: 27914
diff changeset
   477
  invalid value for ui.interface: blah
71e12fc53b80 ui: add new config flag for interface selection
Simon Farnsworth <simonfar@fb.com>
parents: 27914
diff changeset
   478
  curses
71e12fc53b80 ui: add new config flag for interface selection
Simon Farnsworth <simonfar@fb.com>
parents: 27914
diff changeset
   479
71e12fc53b80 ui: add new config flag for interface selection
Simon Farnsworth <simonfar@fb.com>
parents: 27914
diff changeset
   480
  $ cp $HGRCPATH.pretest $HGRCPATH
71e12fc53b80 ui: add new config flag for interface selection
Simon Farnsworth <simonfar@fb.com>
parents: 27914
diff changeset
   481
  $ cat <<EOF >> $HGRCPATH
71e12fc53b80 ui: add new config flag for interface selection
Simon Farnsworth <simonfar@fb.com>
parents: 27914
diff changeset
   482
  > [ui]
71e12fc53b80 ui: add new config flag for interface selection
Simon Farnsworth <simonfar@fb.com>
parents: 27914
diff changeset
   483
  > interface = blah
71e12fc53b80 ui: add new config flag for interface selection
Simon Farnsworth <simonfar@fb.com>
parents: 27914
diff changeset
   484
  > interface.chunkselector = blah
71e12fc53b80 ui: add new config flag for interface selection
Simon Farnsworth <simonfar@fb.com>
parents: 27914
diff changeset
   485
  > EOF
71e12fc53b80 ui: add new config flag for interface selection
Simon Farnsworth <simonfar@fb.com>
parents: 27914
diff changeset
   486
  $ chunkselectorinterface
71e12fc53b80 ui: add new config flag for interface selection
Simon Farnsworth <simonfar@fb.com>
parents: 27914
diff changeset
   487
  invalid value for ui.interface: blah
71e12fc53b80 ui: add new config flag for interface selection
Simon Farnsworth <simonfar@fb.com>
parents: 27914
diff changeset
   488
  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
   489
  text