Commit e53e065c authored by Kyle Lippincott's avatar Kyle Lippincott
Browse files

patch: use a short, fixed-size message for last line of prompt (issue6158)

See issue6158 and the previous commit for examples of what might go wrong if we
have some combinations of readline version and terminal and need to wrap the
line.

Briefly: readline may not display the beginning of the last line of the prompt,
or it may print over it with the end of the prompt, making it difficult for
users to know what's going on.

Differential Revision: https://phab.mercurial-scm.org/D6563
parent 4764e8436b2a
......@@ -1089,7 +1089,9 @@ def filterpatch(ui, headers, match, operation=None):
return skipfile, skipfile, skipall, newpatches
while True:
resps = messages['help'][operation]
r = ui.promptchoice("%s %s" % (query, resps))
# IMPORTANT: keep the last line of this prompt short (<40 english
# chars is a good target) because of issue6158.
r = ui.promptchoice("%s\n(enter ? for help) %s" % (query, resps))
ui.write("\n")
if r == 8: # ?
for c, t in ui.extractchoices(resps)[1]:
......
......@@ -402,12 +402,14 @@ Executable files:
$ hg absorb --dry-run --interactive --print-changes
diff -r 99b4ae712f84 foo.py
1 hunks, 1 lines changed
examine changes to 'foo.py'? [Ynesfdaq?] y
examine changes to 'foo.py'?
(enter ? for help) [Ynesfdaq?] y
@@ -1,1 +1,1 @@
-
+bla
record this change to 'foo.py'? [Ynesfdaq?] y
record this change to 'foo.py'?
(enter ? for help) [Ynesfdaq?] y
showing changes for foo.py
@@ -0,1 +0,1 @@
......
......@@ -146,11 +146,13 @@ Interactive mode
> EOS
diff --git a/F b/F
new file mode 100644
examine changes to 'F'? [Ynesfdaq?] y
examine changes to 'F'?
(enter ? for help) [Ynesfdaq?] y
diff --git a/G b/G
new file mode 100644
examine changes to 'G'? [Ynesfdaq?] n
examine changes to 'G'?
(enter ? for help) [Ynesfdaq?] n
saved backup bundle to $TESTTMP/repo1/.hg/strip-backup/507be9bdac71-c8077452-amend.hg (obsstore-off !)
$ hg log -r . -T '{files}\n'
......
......@@ -100,7 +100,8 @@ Rename empty file
diff --git a/empty-rw b/empty-rename
rename from empty-rw
rename to empty-rename
examine changes to 'empty-rw' and 'empty-rename'? [Ynesfdaq?] y
examine changes to 'empty-rw' and 'empty-rename'?
(enter ? for help) [Ynesfdaq?] y
$ hg tip -p
......@@ -121,7 +122,8 @@ Copy empty file
diff --git a/empty-rename b/empty-copy
copy from empty-rename
copy to empty-copy
examine changes to 'empty-rename' and 'empty-copy'? [Ynesfdaq?] y
examine changes to 'empty-rename' and 'empty-copy'?
(enter ? for help) [Ynesfdaq?] y
$ hg tip -p
......@@ -141,7 +143,8 @@ Delete empty file
> EOF
diff --git a/empty-copy b/empty-copy
deleted file mode 100644
examine changes to 'empty-copy'? [Ynesfdaq?] y
examine changes to 'empty-copy'?
(enter ? for help) [Ynesfdaq?] y
$ hg tip -p
......@@ -164,7 +167,8 @@ Add binary file
diff --git a/tip.bundle b/tip.bundle
new file mode 100644
this is a binary file
examine changes to 'tip.bundle'? [Ynesfdaq?] y
examine changes to 'tip.bundle'?
(enter ? for help) [Ynesfdaq?] y
$ hg tip -p
......@@ -187,7 +191,8 @@ Change binary file
> EOF
diff --git a/tip.bundle b/tip.bundle
this modifies a binary file (all or nothing)
examine changes to 'tip.bundle'? [Ynesfdaq?] y
examine changes to 'tip.bundle'?
(enter ? for help) [Ynesfdaq?] y
$ hg tip -p
......@@ -213,7 +218,8 @@ Rename and change binary file
rename from tip.bundle
rename to top.bundle
this modifies a binary file (all or nothing)
examine changes to 'tip.bundle' and 'top.bundle'? [Ynesfdaq?] y
examine changes to 'tip.bundle' and 'top.bundle'?
(enter ? for help) [Ynesfdaq?] y
$ hg tip -p
......@@ -253,7 +259,8 @@ Add plain file
+8
+9
+10
record this change to 'plain'? [Ynesfdaq?] y
record this change to 'plain'?
(enter ? for help) [Ynesfdaq?] y
$ hg tip -p
changeset: 7:11fb457c1be4
......@@ -302,7 +309,8 @@ Modify end of plain file, also test that diffopts are accounted for
9
10
+11
record this change to 'plain'? [Ynesfdaq?] y
record this change to 'plain'?
(enter ? for help) [Ynesfdaq?] y
Modify end of plain file, no EOL
......@@ -320,7 +328,8 @@ Modify end of plain file, no EOL
11
+7264f99c5f5ff3261504828afa4fb4d406c3af54
\ No newline at end of file
record this change to 'plain'? [Ynesfdaq?] y
record this change to 'plain'?
(enter ? for help) [Ynesfdaq?] y
Record showfunc should preserve function across sections
......@@ -401,7 +410,8 @@ Record showfunc should preserve function across sections
> EOF
diff --git a/f1.py b/f1.py
3 hunks, 6 lines changed
examine changes to 'f1.py'? [Ynesfdaq?] y
examine changes to 'f1.py'?
(enter ? for help) [Ynesfdaq?] y
@@ -2,8 +2,8 @@ def annotate(ui, repo, *pats, **opts):
"""show changeset information by line for each file
......@@ -413,7 +423,8 @@ Record showfunc should preserve function across sections
This command is useful for discovering when a change was made and
by whom.
record change 1/3 to 'f1.py'? [Ynesfdaq?] y
record change 1/3 to 'f1.py'?
(enter ? for help) [Ynesfdaq?] y
@@ -6,11 +6,7 @@ def annotate(ui, repo, *pats, **opts):
......@@ -427,7 +438,8 @@ Record showfunc should preserve function across sections
Without the -a/--text option, annotate will avoid processing files
it detects as binary. With -a, annotate will annotate the file
anyway, although the results will probably be neither useful
record change 2/3 to 'f1.py'? [Ynesfdaq?] y
record change 2/3 to 'f1.py'?
(enter ? for help) [Ynesfdaq?] y
@@ -26,7 +22,7 @@ def archive(ui, repo, dest, **opts):
directory; use -r/--rev to specify a different revision.
......@@ -438,7 +450,8 @@ Record showfunc should preserve function across sections
.. container:: verbose
record change 3/3 to 'f1.py'? [Ynesfdaq?] y
record change 3/3 to 'f1.py'?
(enter ? for help) [Ynesfdaq?] y
Modify end of plain file, add EOL
......@@ -461,13 +474,15 @@ Modify end of plain file, add EOL
-7264f99c5f5ff3261504828afa4fb4d406c3af54
\ No newline at end of file
+7264f99c5f5ff3261504828afa4fb4d406c3af54
record change 1/2 to 'plain'? [Ynesfdaq?] y
record change 1/2 to 'plain'?
(enter ? for help) [Ynesfdaq?] y
diff --git a/plain2 b/plain2
new file mode 100644
@@ -0,0 +1,1 @@
+1
record change 2/2 to 'plain2'? [Ynesfdaq?] y
record change 2/2 to 'plain2'?
(enter ? for help) [Ynesfdaq?] y
Modify beginning, trim end, record both, add another file to test
changes numbering
......@@ -493,7 +508,8 @@ changes numbering
2
3
4
record change 1/3 to 'plain'? [Ynesfdaq?] y
record change 1/3 to 'plain'?
(enter ? for help) [Ynesfdaq?] y
@@ -8,5 +8,3 @@ 7
8
......@@ -501,14 +517,16 @@ changes numbering
10
-11
-7264f99c5f5ff3261504828afa4fb4d406c3af54
record change 2/3 to 'plain'? [Ynesfdaq?] y
record change 2/3 to 'plain'?
(enter ? for help) [Ynesfdaq?] y
diff --git a/plain2 b/plain2
1 hunks, 1 lines changed
@@ -1,1 +1,2 @@
1
+2
record change 3/3 to 'plain2'? [Ynesfdaq?] y
record change 3/3 to 'plain2'?
(enter ? for help) [Ynesfdaq?] y
$ hg tip -p
......@@ -566,7 +584,8 @@ Record end
7
8
9
record change 1/2 to 'plain'? [Ynesfdaq?] n
record change 1/2 to 'plain'?
(enter ? for help) [Ynesfdaq?] n
@@ -4,7 +1,7 @@
4
......@@ -577,7 +596,8 @@ Record end
9
-10
+10.new
record change 2/2 to 'plain'? [Ynesfdaq?] y
record change 2/2 to 'plain'?
(enter ? for help) [Ynesfdaq?] y
$ hg tip -p
......@@ -613,7 +633,8 @@ Record beginning
4
5
6
record this change to 'plain'? [Ynesfdaq?] y
record this change to 'plain'?
(enter ? for help) [Ynesfdaq?] y
$ hg tip -p
......@@ -660,7 +681,8 @@ Record end
7
8
9
record change 1/2 to 'plain'? [Ynesfdaq?] n
record change 1/2 to 'plain'?
(enter ? for help) [Ynesfdaq?] n
@@ -1,7 +4,6 @@
4
......@@ -670,7 +692,8 @@ Record end
8
9
-10.new
record change 2/2 to 'plain'? [Ynesfdaq?] y
record change 2/2 to 'plain'?
(enter ? for help) [Ynesfdaq?] y
Add to beginning, middle, end
......@@ -695,7 +718,8 @@ Record beginning, middle, and test that format-breaking diffopts are ignored
+3
4
5
record change 1/3 to 'plain'? [Ynesfdaq?] y
record change 1/3 to 'plain'?
(enter ? for help) [Ynesfdaq?] y
@@ -1,6 +4,8 @@
4
......@@ -706,7 +730,8 @@ Record beginning, middle, and test that format-breaking diffopts are ignored
7
8
9
record change 2/3 to 'plain'? [Ynesfdaq?] y
record change 2/3 to 'plain'?
(enter ? for help) [Ynesfdaq?] y
@@ -3,4 +8,6 @@
6
......@@ -715,7 +740,8 @@ Record beginning, middle, and test that format-breaking diffopts are ignored
9
+10
+11
record change 3/3 to 'plain'? [Ynesfdaq?] n
record change 3/3 to 'plain'?
(enter ? for help) [Ynesfdaq?] n
$ hg tip -p
......@@ -755,7 +781,8 @@ Record end
9
+10
+11
record this change to 'plain'? [Ynesfdaq?] y
record this change to 'plain'?
(enter ? for help) [Ynesfdaq?] y
$ hg tip -p
......@@ -786,11 +813,13 @@ Interactive commit can name a directory instead of files (issue6131)
adding subdir/a
diff --git a/subdir/a b/subdir/a
new file mode 100644
examine changes to 'subdir/a'? [Ynesfdaq?] y
examine changes to 'subdir/a'?
(enter ? for help) [Ynesfdaq?] y
@@ -0,0 +1,1 @@
+a
record this change to 'subdir/a'? [Ynesfdaq?] y
record this change to 'subdir/a'?
(enter ? for help) [Ynesfdaq?] y
$ cd subdir
......@@ -804,7 +833,8 @@ Interactive commit can name a directory instead of files (issue6131)
@@ -1,1 +1,2 @@
a
+a
record this change to 'subdir/a'? [Ynesfdaq?] y
record this change to 'subdir/a'?
(enter ? for help) [Ynesfdaq?] y
$ hg tip -p
......@@ -839,7 +869,8 @@ Help, quit
> EOF
diff --git a/subdir/f1 b/subdir/f1
1 hunks, 1 lines changed
examine changes to 'subdir/f1'? [Ynesfdaq?] ?
examine changes to 'subdir/f1'?
(enter ? for help) [Ynesfdaq?] ?
y - yes, record this change
n - no, skip this change
......@@ -850,7 +881,8 @@ Help, quit
a - record all changes to all remaining files
q - quit, recording no changes
? - ? (display help)
examine changes to 'subdir/f1'? [Ynesfdaq?] q
examine changes to 'subdir/f1'?
(enter ? for help) [Ynesfdaq?] q
abort: user quit
[255]
......@@ -865,21 +897,25 @@ Patterns
> EOF
diff --git a/subdir/f1 b/subdir/f1
1 hunks, 1 lines changed
examine changes to 'subdir/f1'? [Ynesfdaq?] y
examine changes to 'subdir/f1'?
(enter ? for help) [Ynesfdaq?] y
@@ -1,1 +1,2 @@
a
+a
record change 1/2 to 'subdir/f1'? [Ynesfdaq?] n
record change 1/2 to 'subdir/f1'?
(enter ? for help) [Ynesfdaq?] n
diff --git a/subdir/f2 b/subdir/f2
1 hunks, 1 lines changed
examine changes to 'subdir/f2'? [Ynesfdaq?] y
examine changes to 'subdir/f2'?
(enter ? for help) [Ynesfdaq?] y
@@ -1,1 +1,2 @@
b
+b
record change 2/2 to 'subdir/f2'? [Ynesfdaq?] n
record change 2/2 to 'subdir/f2'?
(enter ? for help) [Ynesfdaq?] n
no changes to record
[1]
......@@ -936,11 +972,13 @@ Skip
> EOF
diff --git a/subdir/f1 b/subdir/f1
1 hunks, 1 lines changed
examine changes to 'subdir/f1'? [Ynesfdaq?] s
examine changes to 'subdir/f1'?
(enter ? for help) [Ynesfdaq?] s
diff --git a/subdir/f2 b/subdir/f2
1 hunks, 1 lines changed
examine changes to 'subdir/f2'? [Ynesfdaq?] abort: response expected
examine changes to 'subdir/f2'?
(enter ? for help) [Ynesfdaq?] abort: response expected
[255]
No
......@@ -950,11 +988,13 @@ No
> EOF
diff --git a/subdir/f1 b/subdir/f1
1 hunks, 1 lines changed
examine changes to 'subdir/f1'? [Ynesfdaq?] n
examine changes to 'subdir/f1'?
(enter ? for help) [Ynesfdaq?] n
diff --git a/subdir/f2 b/subdir/f2
1 hunks, 1 lines changed
examine changes to 'subdir/f2'? [Ynesfdaq?] abort: response expected
examine changes to 'subdir/f2'?
(enter ? for help) [Ynesfdaq?] abort: response expected
[255]
f, quit
......@@ -965,11 +1005,13 @@ f, quit
> EOF
diff --git a/subdir/f1 b/subdir/f1
1 hunks, 1 lines changed
examine changes to 'subdir/f1'? [Ynesfdaq?] f
examine changes to 'subdir/f1'?
(enter ? for help) [Ynesfdaq?] f
diff --git a/subdir/f2 b/subdir/f2
1 hunks, 1 lines changed
examine changes to 'subdir/f2'? [Ynesfdaq?] q
examine changes to 'subdir/f2'?
(enter ? for help) [Ynesfdaq?] q
abort: user quit
[255]
......@@ -982,11 +1024,13 @@ s, all
> EOF
diff --git a/subdir/f1 b/subdir/f1
1 hunks, 1 lines changed
examine changes to 'subdir/f1'? [Ynesfdaq?] s
examine changes to 'subdir/f1'?
(enter ? for help) [Ynesfdaq?] s
diff --git a/subdir/f2 b/subdir/f2
1 hunks, 1 lines changed
examine changes to 'subdir/f2'? [Ynesfdaq?] a
examine changes to 'subdir/f2'?
(enter ? for help) [Ynesfdaq?] a
$ hg tip -p
......@@ -1011,7 +1055,8 @@ f
> EOF
diff --git a/subdir/f1 b/subdir/f1
1 hunks, 1 lines changed
examine changes to 'subdir/f1'? [Ynesfdaq?] f
examine changes to 'subdir/f1'?
(enter ? for help) [Ynesfdaq?] f
$ hg tip -p
......@@ -1044,13 +1089,15 @@ Preserve chmod +x
old mode 100644
new mode 100755
1 hunks, 1 lines changed
examine changes to 'subdir/f1'? [Ynesfdaq?] y
examine changes to 'subdir/f1'?
(enter ? for help) [Ynesfdaq?] y
@@ -1,2 +1,3 @@
a
a
+a
record this change to 'subdir/f1'? [Ynesfdaq?] y
record this change to 'subdir/f1'?
(enter ? for help) [Ynesfdaq?] y
$ hg tip --config diff.git=True -p
......@@ -1081,14 +1128,16 @@ Preserve execute permission on original
> EOF
diff --git a/subdir/f1 b/subdir/f1
1 hunks, 1 lines changed
examine changes to 'subdir/f1'? [Ynesfdaq?] y
examine changes to 'subdir/f1'?
(enter ? for help) [Ynesfdaq?] y
@@ -1,3 +1,4 @@
a
a
a
+b
record this change to 'subdir/f1'? [Ynesfdaq?] y
record this change to 'subdir/f1'?
(enter ? for help) [Ynesfdaq?] y
$ hg tip --config diff.git=True -p
......@@ -1121,14 +1170,16 @@ Preserve chmod -x
old mode 100755
new mode 100644
1 hunks, 1 lines changed
examine changes to 'subdir/f1'? [Ynesfdaq?] y
examine changes to 'subdir/f1'?
(enter ? for help) [Ynesfdaq?] y
@@ -2,3 +2,4 @@ a
a
a
b
+c
record this change to 'subdir/f1'? [Ynesfdaq?] y
record this change to 'subdir/f1'?
(enter ? for help) [Ynesfdaq?] y
$ hg tip --config diff.git=True -p
......@@ -1323,7 +1374,8 @@ Editing patch (and ignoring trailing text)
> EOF
diff --git a/editedfile b/editedfile
1 hunks, 2 lines changed
examine changes to 'editedfile'? [Ynesfdaq?] y
examine changes to 'editedfile'?
(enter ? for help) [Ynesfdaq?] y
@@ -1,3 +1,3 @@
-This is the first line
......@@ -1331,7 +1383,8 @@ Editing patch (and ignoring trailing text)
+This line has changed
+This change will be committed
This is the third line
record this change to 'editedfile'? [Ynesfdaq?] e
record this change to 'editedfile'?
(enter ? for help) [Ynesfdaq?] e
$ cat editedfile
This line has changed
......@@ -1352,10 +1405,12 @@ Trying to edit patch for whole file
> EOF
diff --git a/editedfile b/editedfile
1 hunks, 1 lines changed
examine changes to 'editedfile'? [Ynesfdaq?] e
examine changes to 'editedfile'?
(enter ? for help) [Ynesfdaq?] e
cannot edit patch for whole file
examine changes to 'editedfile'? [Ynesfdaq?] q
examine changes to 'editedfile'?
(enter ? for help) [Ynesfdaq?] q
abort: user quit
[255]
......@@ -1376,7 +1431,8 @@ Removing changes from patch
> EOF
diff --git a/editedfile b/editedfile
1 hunks, 3 lines changed
examine changes to 'editedfile'? [Ynesfdaq?] y
examine changes to 'editedfile'?
(enter ? for help) [Ynesfdaq?] y
@@ -1,3 +1,3 @@
-This is the first line
......@@ -1385,7 +1441,8 @@ Removing changes from patch
+This change will not be committed
+This is the second line
+This line has been added
record this change to 'editedfile'? [Ynesfdaq?] e
record this change to 'editedfile'?
(enter ? for help) [Ynesfdaq?] e
no changes to record
[1]
......@@ -1414,7 +1471,8 @@ Invalid patch
> EOF
diff --git a/editedfile b/editedfile
1 hunks, 3 lines changed
examine changes to 'editedfile'? [Ynesfdaq?] y
examine changes to 'editedfile'?
(enter ? for help) [Ynesfdaq?] y
@@ -1,3 +1,3 @@
-This is the first line
......@@ -1423,7 +1481,8 @@ Invalid patch
+This change will not be committed
+This is the second line
+This line has been added
record this change to 'editedfile'? [Ynesfdaq?] e
record this change to 'editedfile'?
(enter ? for help) [Ynesfdaq?] e
patching file editedfile
Hunk #1 FAILED at 0
......@@ -1461,7 +1520,8 @@ Malformed patch - error handling
> EOF
diff --git a/editedfile b/editedfile
1 hunks, 3 lines changed
examine changes to 'editedfile'? [Ynesfdaq?] y
examine changes to 'editedfile'?
(enter ? for help) [Ynesfdaq?] y
@@ -1,3 +1,3 @@
-This is the first line
......@@ -1470,7 +1530,8 @@ Malformed patch - error handling
+This change will not be committed
+This is the second line
+This line has been added
record this change to 'editedfile'? [Ynesfdaq?] e
record this change to 'editedfile'?
(enter ? for help) [Ynesfdaq?] e
abort: error parsing patch: unhandled transition: range -> range
[255]
......@@ -1485,7 +1546,8 @@ session
> EOF
diff --git a/editedfile b/editedfile
1 hunks, 3 lines changed
examine changes to 'editedfile'? [Ynesfdaq?] y
examine changes to 'editedfile'?
(enter ? for help) [Ynesfdaq?] y
@@ -1,3 +1,3 @@
-This is the first line
......@@ -1494,10 +1556,12 @@ session
+This change will not be committed
+This is the second line
+This line has been added
record this change to 'editedfile'? [Ynesfdaq?] e
record this change to 'editedfile'?
(enter ? for help) [Ynesfdaq?] e
editor exited with exit code 1
record this change to 'editedfile'? [Ynesfdaq?] n
record this change to 'editedfile'?
(enter ? for help) [Ynesfdaq?] n
no changes to record
[1]
......@@ -1516,7 +1580,8 @@ random text in random positions is still an error
> EOF
diff --git a/editedfile b/editedfile
1 hunks, 3 lines changed
examine changes to 'editedfile'? [Ynesfdaq?] y
examine changes to 'editedfile'?
(enter ? for help) [Ynesfdaq?] y
@@ -1,3 +1,3 @@
-This is the first line
......@@ -1525,7 +1590,8 @@ random text in random positions is still an error
+This change will not be committed
+This is the second line
+This line has been added
record this change to 'editedfile'? [Ynesfdaq?] e
record this change to 'editedfile'?
(enter ? for help) [Ynesfdaq?] e
abort: error parsing patch: unhandled transition: file -> other
[255]
......@@ -1556,14 +1622,16 @@ Ignore win32text deprecation warning for now:
> EOF
diff --git a/subdir/f1 b/subdir/f1
1 hunks, 1 lines changed
examine changes to 'subdir/f1'? [Ynesfdaq?] y
examine changes to 'subdir/f1'?