Commit e53e065c authored by Kyle Lippincott's avatar Kyle Lippincott

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'
......
This diff is collapsed.
......@@ -171,7 +171,8 @@ record
a
a
c
\x1b[0;33mrecord this change to 'a'? [Ynesfdaq?]\x1b[0m y (esc)
\x1b[0;33mrecord this change to 'a'?\x1b[0m (esc)
\x1b[0;33m(enter ? for help) [Ynesfdaq?]\x1b[0m y (esc)
$ echo "[extensions]" >> $HGRCPATH
......@@ -190,7 +191,8 @@ qrecord
\x1b[0;36;1mold mode 100644\x1b[0m (esc)
\x1b[0;36;1mnew mode 100755\x1b[0m (esc)
1 hunks, 1 lines changed
\x1b[0;33mexamine changes to 'a'? [Ynesfdaq?]\x1b[0m y (esc)
\x1b[0;33mexamine changes to 'a'?\x1b[0m (esc)
\x1b[0;33m(enter ? for help) [Ynesfdaq?]\x1b[0m y (esc)
\x1b[0;35m@@ -2,7 +2,7 @@ c\x1b[0m (esc)
c
......@@ -201,7 +203,8 @@ qrecord
a
a
c
\x1b[0;33mrecord this change to 'a'? [Ynesfdaq?]\x1b[0m y (esc)
\x1b[0;33mrecord this change to 'a'?\x1b[0m (esc)
\x1b[0;33m(enter ? for help) [Ynesfdaq?]\x1b[0m y (esc)
$ hg qpop -a
......
......@@ -47,15 +47,18 @@ editor for a diff, the file ends in .diff.
> EOF
diff --git a/one b/one
new file mode 100644
examine changes to 'one'? [Ynesfdaq?] y
examine changes to 'one'?
(enter ? for help) [Ynesfdaq?] y
@@ -0,0 +1,1 @@
+1
record change 1/2 to 'one'? [Ynesfdaq?] e
record change 1/2 to 'one'?
(enter ? for help) [Ynesfdaq?] e
*.diff (glob)
editor exited with exit code 1
record change 1/2 to 'one'? [Ynesfdaq?] q
record change 1/2 to 'one'?
(enter ? for help) [Ynesfdaq?] q
abort: user quit
[255]
......@@ -392,13 +392,15 @@ record chunk
+foo
do not process $Id:
xxx $
record change 1/2 to 'a'? [Ynesfdaq?] y
record change 1/2 to 'a'?
(enter ? for help) [Ynesfdaq?] y
@@ -2,2 +3,3 @@
do not process $Id:
xxx $
+bar
record change 2/2 to 'a'? [Ynesfdaq?] n
record change 2/2 to 'a'?
(enter ? for help) [Ynesfdaq?] n
$ hg identify
......@@ -450,13 +452,15 @@ Record all chunks in file a
+foo
do not process $Id:
xxx $
record change 1/2 to 'a'? [Ynesfdaq?] y
record change 1/2 to 'a'?
(enter ? for help) [Ynesfdaq?] y
@@ -2,2 +3,3 @@
do not process $Id:
xxx $
+bar
record change 2/2 to 'a'? [Ynesfdaq?] y
record change 2/2 to 'a'?
(enter ? for help) [Ynesfdaq?] y
File a should be clean
......@@ -516,7 +520,8 @@ record added file alone
new file mode 100644
@@ -0,0 +1,1 @@
+$Id$
record this change to 'r'? [Ynesfdaq?] y
record this change to 'r'?
(enter ? for help) [Ynesfdaq?] y
resolving manifests
patching file r
......@@ -546,11 +551,13 @@ record added keyword ignored file
> EOF
diff --git a/i b/i
new file mode 100644
examine changes to 'i'? [Ynesfdaq?] y
examine changes to 'i'?
(enter ? for help) [Ynesfdaq?] y
@@ -0,0 +1,1 @@
+$Id$
record this change to 'i'? [Ynesfdaq?] y
record this change to 'i'?
(enter ? for help) [Ynesfdaq?] y
resolving manifests
patching file i
......
......@@ -190,25 +190,29 @@ partial qrefresh
> EOF
diff --git a/1.txt b/1.txt
2 hunks, 2 lines changed
examine changes to '1.txt'? [Ynesfdaq?] y
examine changes to '1.txt'?
(enter ? for help) [Ynesfdaq?] y
@@ -1,3 +1,3 @@
1
-2
+2 2
3
record change 1/4 to '1.txt'? [Ynesfdaq?] y
record change 1/4 to '1.txt'?
(enter ? for help) [Ynesfdaq?] y
@@ -3,3 +3,3 @@
3
-4
+4 4
5
record change 2/4 to '1.txt'? [Ynesfdaq?] n
record change 2/4 to '1.txt'?
(enter ? for help) [Ynesfdaq?] n
diff --git a/2.txt b/2.txt
1 hunks, 1 lines changed
examine changes to '2.txt'? [Ynesfdaq?] y
examine changes to '2.txt'?
(enter ? for help) [Ynesfdaq?] y
@@ -1,5 +1,5 @@
a
......@@ -217,11 +221,13 @@ partial qrefresh
c
d
e
record change 3/4 to '2.txt'? [Ynesfdaq?] y
record change 3/4 to '2.txt'?
(enter ? for help) [Ynesfdaq?] y
diff --git a/dir/a.txt b/dir/a.txt
1 hunks, 1 lines changed
examine changes to 'dir/a.txt'? [Ynesfdaq?] n
examine changes to 'dir/a.txt'?
(enter ? for help) [Ynesfdaq?] n
After partial qrefresh 'tip'
......@@ -290,7 +296,8 @@ qrefresh interactively everything else
> EOF
diff --git a/1.txt b/1.txt
1 hunks, 1 lines changed
examine changes to '1.txt'? [Ynesfdaq?] y
examine changes to '1.txt'?
(enter ? for help) [Ynesfdaq?] y
@@ -1,5 +1,5 @@
1
......@@ -299,11 +306,13 @@ qrefresh interactively everything else
-4
+4 4
5
record change 1/2 to '1.txt'? [Ynesfdaq?] y
record change 1/2 to '1.txt'?
(enter ? for help) [Ynesfdaq?] y
diff --git a/dir/a.txt b/dir/a.txt
1 hunks, 1 lines changed
examine changes to 'dir/a.txt'? [Ynesfdaq?] y
examine changes to 'dir/a.txt'?
(enter ? for help) [Ynesfdaq?] y
@@ -1,4 +1,4 @@
-hello world
......@@ -311,7 +320,8 @@ qrefresh interactively everything else
someone
up
record change 2/2 to 'dir/a.txt'? [Ynesfdaq?] y
record change 2/2 to 'dir/a.txt'?
(enter ? for help) [Ynesfdaq?] y
After final qrefresh 'tip'
......
......@@ -303,11 +303,13 @@ handle subrepos safely on qrecord
% qrecord --config ui.interactive=1 -m0 0.diff
diff --git a/.hgsub b/.hgsub
new file mode 100644
examine changes to '.hgsub'? [Ynesfdaq?] y
examine changes to '.hgsub'?
(enter ? for help) [Ynesfdaq?] y
@@ -0,0 +1,1 @@
+sub = sub
record this change to '.hgsub'? [Ynesfdaq?] y
record this change to '.hgsub'?
(enter ? for help) [Ynesfdaq?] y
warning: subrepo spec file '.hgsub' not found
warning: subrepo spec file '.hgsub' not found
......@@ -331,12 +333,14 @@ handle subrepos safely on qrecord
% qrecord --config ui.interactive=1 -m1 1.diff
diff --git a/.hgsub b/.hgsub
1 hunks, 1 lines changed
examine changes to '.hgsub'? [Ynesfdaq?] y
examine changes to '.hgsub'?
(enter ? for help) [Ynesfdaq?] y
@@ -1,1 +1,2 @@
sub = sub
+sub2 = sub2
record this change to '.hgsub'? [Ynesfdaq?] y
record this change to '.hgsub'?
(enter ? for help) [Ynesfdaq?] y
path sub
source sub
......@@ -358,7 +362,8 @@ handle subrepos safely on qrecord
% qrecord --config ui.interactive=1 -m2 2.diff
diff --git a/.hgsub b/.hgsub
deleted file mode 100644
examine changes to '.hgsub'? [Ynesfdaq?] y
examine changes to '.hgsub'?
(enter ? for help) [Ynesfdaq?] y
% debugsub should be empty
......@@ -374,7 +379,8 @@ handle subrepos safely on qrecord
% qrecord --config ui.interactive=1 -m3 3.diff
diff --git a/.hgsub b/.hgsub
deleted file mode 100644
examine changes to '.hgsub'? [Ynesfdaq?] y
examine changes to '.hgsub'?
(enter ? for help) [Ynesfdaq?] y
% debugsub should be empty
......
......@@ -260,25 +260,29 @@ qrecord a.patch
> EOF
diff --git a/1.txt b/1.txt
2 hunks, 2 lines changed
examine changes to '1.txt'? [Ynesfdaq?] y
examine changes to '1.txt'?
(enter ? for help) [Ynesfdaq?] y
@@ -1,3 +1,3 @@
1
-2
+2 2
3
record change 1/4 to '1.txt'? [Ynesfdaq?] y
record change 1/4 to '1.txt'?
(enter ? for help) [Ynesfdaq?] y
@@ -3,3 +3,3 @@
3
-4
+4 4
5
record change 2/4 to '1.txt'? [Ynesfdaq?] n
record change 2/4 to '1.txt'?
(enter ? for help) [Ynesfdaq?] n
diff --git a/2.txt b/2.txt
1 hunks, 1 lines changed
examine changes to '2.txt'? [Ynesfdaq?] y
examine changes to '2.txt'?
(enter ? for help) [Ynesfdaq?] y
@@ -1,5 +1,5 @@
a
......@@ -287,11 +291,13 @@ qrecord a.patch
c
d
e
record change 3/4 to '2.txt'? [Ynesfdaq?] y
record change 3/4 to '2.txt'?
(enter ? for help) [Ynesfdaq?] y
diff --git a/dir/a.txt b/dir/a.txt
1 hunks, 1 lines changed
examine changes to 'dir/a.txt'? [Ynesfdaq?] n
examine changes to 'dir/a.txt'?
(enter ? for help) [Ynesfdaq?] n
After qrecord a.patch 'tip'"
......@@ -361,7 +367,8 @@ qrecord b.patch
> EOF
diff --git a/1.txt b/1.txt
1 hunks, 1 lines changed
examine changes to '1.txt'? [Ynesfdaq?] y
examine changes to '1.txt'?
(enter ? for help) [Ynesfdaq?] y
@@ -1,5 +1,5 @@
1
......@@ -370,11 +377,13 @@ qrecord b.patch
-4
+4 4
5
record change 1/2 to '1.txt'? [Ynesfdaq?] y
record change 1/2 to '1.txt'?
(enter ? for help) [Ynesfdaq?] y
diff --git a/dir/a.txt b/dir/a.txt
1 hunks, 1 lines changed
examine changes to 'dir/a.txt'? [Ynesfdaq?] y
examine changes to 'dir/a.txt'?
(enter ? for help) [Ynesfdaq?] y
@@ -1,4 +1,4 @@
-hello world
......@@ -382,7 +391,8 @@ qrecord b.patch
someone
up
record change 2/2 to 'dir/a.txt'? [Ynesfdaq?] y
record change 2/2 to 'dir/a.txt'?
(enter ? for help) [Ynesfdaq?] y
After qrecord b.patch 'tip'
......
......@@ -55,7 +55,8 @@ Revert interactive tests
removing folder1/i
diff --git a/f b/f
2 hunks, 2 lines changed
examine changes to 'f'? [Ynesfdaq?] y
examine changes to 'f'?
(enter ? for help) [Ynesfdaq?] y
@@ -1,6 +1,5 @@
-a
......@@ -64,7 +65,8 @@ Revert interactive tests
3
4
5
apply change 1/6 to 'f'? [Ynesfdaq?] y
apply change 1/6 to 'f'?
(enter ? for help) [Ynesfdaq?] y
@@ -2,6 +1,5 @@
1
......@@ -73,11 +75,13 @@ Revert interactive tests
4
5
-b
apply change 2/6 to 'f'? [Ynesfdaq?] y
apply change 2/6 to 'f'?
(enter ? for help) [Ynesfdaq?] y
diff --git a/folder1/g b/folder1/g
2 hunks, 2 lines changed
examine changes to 'folder1/g'? [Ynesfdaq?] y
examine changes to 'folder1/g'?
(enter ? for help) [Ynesfdaq?] y
@@ -1,6 +1,5 @@
-c
......@@ -86,7 +90,8 @@ Revert interactive tests
3
4
5
apply change 3/6 to 'folder1/g'? [Ynesfdaq?] ?
apply change 3/6 to 'folder1/g'?
(enter ? for help) [Ynesfdaq?] ?
y - yes, apply this change
n - no, skip this change
......@@ -97,7 +102,8 @@ Revert interactive tests
a - apply all changes to all remaining files
q - quit, applying no changes
? - ? (display help)
apply change 3/6 to 'folder1/g'? [Ynesfdaq?] y
apply change 3/6 to 'folder1/g'?
(enter ? for help) [Ynesfdaq?] y
@@ -2,6 +1,5 @@
1
......@@ -106,11 +112,13 @@ Revert interactive tests
4
5
-d
apply change 4/6 to 'folder1/g'? [Ynesfdaq?] n
apply change 4/6 to 'folder1/g'?
(enter ? for help) [Ynesfdaq?] n
diff --git a/folder2/h b/folder2/h
2 hunks, 2 lines changed
examine changes to 'folder2/h'? [Ynesfdaq?] n
examine changes to 'folder2/h'?
(enter ? for help) [Ynesfdaq?] n
reverting f
reverting folder1/g
......@@ -141,7 +149,8 @@ Test that --interactive lift the need for --all
$ echo q | hg revert -i -r 2
diff --git a/folder1/g b/folder1/g
1 hunks, 1 lines changed
examine changes to 'folder1/g'? [Ynesfdaq?] q
examine changes to 'folder1/g'?
(enter ? for help) [Ynesfdaq?] q
abort: user quit
[255]
......@@ -157,7 +166,8 @@ Test that a noop revert doesn't do an unnecessary backup
4
5
-d
apply this change to 'folder1/g'? [Ynesfdaq?] n
apply this change to 'folder1/g'?
(enter ? for help) [Ynesfdaq?] n
$ ls folder1/
g
......@@ -171,7 +181,8 @@ Test --no-backup
4
5
-d
apply this change to 'folder1/g'? [Ynesfdaq?] y
apply this change to 'folder1/g'?
(enter ? for help) [Ynesfdaq?] y
$ ls folder1/
g
......@@ -193,7 +204,8 @@ Test --no-backup
remove added file folder1/i (Yn)? n
diff --git a/f b/f
2 hunks, 2 lines changed
examine changes to 'f'? [Ynesfdaq?] y
examine changes to 'f'?
(enter ? for help) [Ynesfdaq?] y
@@ -1,6 +1,5 @@
-a
......@@ -202,7 +214,8 @@ Test --no-backup
3
4
5
apply change 1/6 to 'f'? [Ynesfdaq?] y
apply change 1/6 to 'f'?
(enter ? for help) [Ynesfdaq?] y
@@ -2,6 +1,5 @@
1
......@@ -211,11 +224,13 @@ Test --no-backup
4
5
-b
apply change 2/6 to 'f'? [Ynesfdaq?] y
apply change 2/6 to 'f'?
(enter ? for help) [Ynesfdaq?] y
diff --git a/folder1/g b/folder1/g
2 hunks, 2 lines changed
examine changes to 'folder1/g'? [Ynesfdaq?] y
examine changes to 'folder1/g'?
(enter ? for help) [Ynesfdaq?] y
@@ -1,6 +1,5 @@
-c
......@@ -224,7 +239,8 @@ Test --no-backup
3
4
5
apply change 3/6 to 'folder1/g'? [Ynesfdaq?] y
apply change 3/6 to 'folder1/g'?
(enter ? for help) [Ynesfdaq?] y
@@ -2,6 +1,5 @@
1
......@@ -233,11 +249,13 @@ Test --no-backup
4
5
-d
apply change 4/6 to 'folder1/g'? [Ynesfdaq?] n
apply change 4/6 to 'folder1/g'?
(enter ? for help) [Ynesfdaq?] n
diff --git a/folder2/h b/folder2/h
2 hunks, 2 lines changed
examine changes to 'folder2/h'? [Ynesfdaq?] n
examine changes to 'folder2/h'?
(enter ? for help) [Ynesfdaq?] n
reverting f
reverting folder1/g
......@@ -280,7 +298,8 @@ Test --no-backup
3
4
5
discard change 1/2 to 'f'? [Ynesfdaq?] ?
discard change 1/2 to 'f'?
(enter ? for help) [Ynesfdaq?] ?
y - yes, discard this change
n - no, skip this change
......@@ -291,7 +310,8 @@ Test --no-backup
a - discard all changes to all remaining files
q - quit, discarding no changes
? - ? (display help)
discard change 1/2 to 'f'? [Ynesfdaq?] y
discard change 1/2 to 'f'?
(enter ? for help) [Ynesfdaq?] y
@@ -2,6 +1,5 @@
1
......@@ -300,7 +320,8 @@ Test --no-backup
4
5
-b
discard change 2/2 to 'f'? [Ynesfdaq?] n
discard change 2/2 to 'f'?
(enter ? for help) [Ynesfdaq?] n
$ hg st
M f
......@@ -329,14 +350,16 @@ Patterns
> EOF
diff --git a/f b/f
1 hunks, 1 lines changed
examine changes to 'f'? [Ynesfdaq?] y
examine changes to 'f'?
(enter ? for help) [Ynesfdaq?] y
@@ -4,4 +4,3 @@
3
4
5
-b
discard this change to 'f'? [Ynesfdaq?] n
discard this change to 'f'?
(enter ? for help) [Ynesfdaq?] n
$ hg update -C .
......@@ -363,13 +386,15 @@ Check editing files newly added by a revert
> EOF
diff --git a/k b/k
1 hunks, 2 lines changed
examine changes to 'k'? [Ynesfdaq?] y
examine changes to 'k'?
(enter ? for help) [Ynesfdaq?] y
@@ -1,1 +1,2 @@
-1
+0
+2
discard this change to 'k'? [Ynesfdaq?] e
discard this change to 'k'?
(enter ? for help) [Ynesfdaq?] e
reverting k
$ cat k
......@@ -414,13 +439,15 @@ When a line without EOL is selected during "revert -i" (issue5651)
> EOF
diff --git a/a b/a
1 hunks, 1 lines changed
examine changes to 'a'? [Ynesfdaq?] y
examine changes to 'a'?
(enter ? for help) [Ynesfdaq?] y
@@ -1,2 +1,1 @@
0
-1
\ No newline at end of file
apply this change to 'a'? [Ynesfdaq?] y
apply this change to 'a'?
(enter ? for help) [Ynesfdaq?] y
reverting a
$ cat a
......@@ -488,17 +515,20 @@ Test "keep" mode
> EOF
diff --git a/a b/a
2 hunks, 2 lines changed
examine changes to 'a'? [Ynesfdaq?] y
examine changes to 'a'?
(enter ? for help) [Ynesfdaq?] y
@@ -1,1 +1,2 @@
+x