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): ...@@ -1089,7 +1089,9 @@ def filterpatch(ui, headers, match, operation=None):
return skipfile, skipfile, skipall, newpatches return skipfile, skipfile, skipall, newpatches
while True: while True:
resps = messages['help'][operation] 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") ui.write("\n")
if r == 8: # ? if r == 8: # ?
for c, t in ui.extractchoices(resps)[1]: for c, t in ui.extractchoices(resps)[1]:
......
...@@ -402,12 +402,14 @@ Executable files: ...@@ -402,12 +402,14 @@ Executable files:
$ hg absorb --dry-run --interactive --print-changes $ hg absorb --dry-run --interactive --print-changes
diff -r 99b4ae712f84 foo.py diff -r 99b4ae712f84 foo.py
1 hunks, 1 lines changed 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 @@ @@ -1,1 +1,1 @@
- -
+bla +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 showing changes for foo.py
@@ -0,1 +0,1 @@ @@ -0,1 +0,1 @@
......
...@@ -146,11 +146,13 @@ Interactive mode ...@@ -146,11 +146,13 @@ Interactive mode
> EOS > EOS
diff --git a/F b/F diff --git a/F b/F
new file mode 100644 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 diff --git a/G b/G
new file mode 100644 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 !) saved backup bundle to $TESTTMP/repo1/.hg/strip-backup/507be9bdac71-c8077452-amend.hg (obsstore-off !)
$ hg log -r . -T '{files}\n' $ hg log -r . -T '{files}\n'
......
This diff is collapsed.
...@@ -171,7 +171,8 @@ record ...@@ -171,7 +171,8 @@ record
a a
a a
c 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 $ echo "[extensions]" >> $HGRCPATH
...@@ -190,7 +191,8 @@ qrecord ...@@ -190,7 +191,8 @@ qrecord
\x1b[0;36;1mold mode 100644\x1b[0m (esc) \x1b[0;36;1mold mode 100644\x1b[0m (esc)
\x1b[0;36;1mnew mode 100755\x1b[0m (esc) \x1b[0;36;1mnew mode 100755\x1b[0m (esc)
1 hunks, 1 lines changed 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) \x1b[0;35m@@ -2,7 +2,7 @@ c\x1b[0m (esc)
c c
...@@ -201,7 +203,8 @@ qrecord ...@@ -201,7 +203,8 @@ qrecord
a a
a a
c 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 $ hg qpop -a
......
...@@ -47,15 +47,18 @@ editor for a diff, the file ends in .diff. ...@@ -47,15 +47,18 @@ editor for a diff, the file ends in .diff.
> EOF > EOF
diff --git a/one b/one diff --git a/one b/one
new file mode 100644 new file mode 100644
examine changes to 'one'? [Ynesfdaq?] y examine changes to 'one'?
(enter ? for help) [Ynesfdaq?] y
@@ -0,0 +1,1 @@ @@ -0,0 +1,1 @@
+1 +1
record change 1/2 to 'one'? [Ynesfdaq?] e record change 1/2 to 'one'?
(enter ? for help) [Ynesfdaq?] e
*.diff (glob) *.diff (glob)
editor exited with exit code 1 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 abort: user quit
[255] [255]
...@@ -392,13 +392,15 @@ record chunk ...@@ -392,13 +392,15 @@ record chunk
+foo +foo
do not process $Id: do not process $Id:
xxx $ xxx $
record change 1/2 to 'a'? [Ynesfdaq?] y record change 1/2 to 'a'?
(enter ? for help) [Ynesfdaq?] y
@@ -2,2 +3,3 @@ @@ -2,2 +3,3 @@
do not process $Id: do not process $Id:
xxx $ xxx $
+bar +bar
record change 2/2 to 'a'? [Ynesfdaq?] n record change 2/2 to 'a'?
(enter ? for help) [Ynesfdaq?] n
$ hg identify $ hg identify
...@@ -450,13 +452,15 @@ Record all chunks in file a ...@@ -450,13 +452,15 @@ Record all chunks in file a
+foo +foo
do not process $Id: do not process $Id:
xxx $ xxx $
record change 1/2 to 'a'? [Ynesfdaq?] y record change 1/2 to 'a'?
(enter ? for help) [Ynesfdaq?] y
@@ -2,2 +3,3 @@ @@ -2,2 +3,3 @@
do not process $Id: do not process $Id:
xxx $ xxx $
+bar +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 File a should be clean
...@@ -516,7 +520,8 @@ record added file alone ...@@ -516,7 +520,8 @@ record added file alone
new file mode 100644 new file mode 100644
@@ -0,0 +1,1 @@ @@ -0,0 +1,1 @@
+$Id$ +$Id$
record this change to 'r'? [Ynesfdaq?] y record this change to 'r'?
(enter ? for help) [Ynesfdaq?] y
resolving manifests resolving manifests
patching file r patching file r
...@@ -546,11 +551,13 @@ record added keyword ignored file ...@@ -546,11 +551,13 @@ record added keyword ignored file
> EOF > EOF
diff --git a/i b/i diff --git a/i b/i
new file mode 100644 new file mode 100644
examine changes to 'i'? [Ynesfdaq?] y examine changes to 'i'?
(enter ? for help) [Ynesfdaq?] y
@@ -0,0 +1,1 @@ @@ -0,0 +1,1 @@
+$Id$ +$Id$
record this change to 'i'? [Ynesfdaq?] y record this change to 'i'?
(enter ? for help) [Ynesfdaq?] y
resolving manifests resolving manifests
patching file i patching file i
......
...@@ -190,25 +190,29 @@ partial qrefresh ...@@ -190,25 +190,29 @@ partial qrefresh
> EOF > EOF
diff --git a/1.txt b/1.txt diff --git a/1.txt b/1.txt
2 hunks, 2 lines changed 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,3 +1,3 @@
1 1
-2 -2
+2 2 +2 2
3 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,3 +3,3 @@
3 3
-4 -4
+4 4 +4 4
5 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 diff --git a/2.txt b/2.txt
1 hunks, 1 lines changed 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 @@ @@ -1,5 +1,5 @@
a a
...@@ -217,11 +221,13 @@ partial qrefresh ...@@ -217,11 +221,13 @@ partial qrefresh
c c
d d
e 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 diff --git a/dir/a.txt b/dir/a.txt
1 hunks, 1 lines changed 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' After partial qrefresh 'tip'
...@@ -290,7 +296,8 @@ qrefresh interactively everything else ...@@ -290,7 +296,8 @@ qrefresh interactively everything else
> EOF > EOF
diff --git a/1.txt b/1.txt diff --git a/1.txt b/1.txt
1 hunks, 1 lines changed 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,5 +1,5 @@
1 1
...@@ -299,11 +306,13 @@ qrefresh interactively everything else ...@@ -299,11 +306,13 @@ qrefresh interactively everything else
-4 -4
+4 4 +4 4
5 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 diff --git a/dir/a.txt b/dir/a.txt
1 hunks, 1 lines changed 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 @@ @@ -1,4 +1,4 @@
-hello world -hello world
...@@ -311,7 +320,8 @@ qrefresh interactively everything else ...@@ -311,7 +320,8 @@ qrefresh interactively everything else
someone someone
up 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' After final qrefresh 'tip'
......
...@@ -303,11 +303,13 @@ handle subrepos safely on qrecord ...@@ -303,11 +303,13 @@ handle subrepos safely on qrecord
% qrecord --config ui.interactive=1 -m0 0.diff % qrecord --config ui.interactive=1 -m0 0.diff
diff --git a/.hgsub b/.hgsub diff --git a/.hgsub b/.hgsub
new file mode 100644 new file mode 100644
examine changes to '.hgsub'? [Ynesfdaq?] y examine changes to '.hgsub'?
(enter ? for help) [Ynesfdaq?] y
@@ -0,0 +1,1 @@ @@ -0,0 +1,1 @@
+sub = sub +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
warning: subrepo spec file '.hgsub' not found warning: subrepo spec file '.hgsub' not found
...@@ -331,12 +333,14 @@ handle subrepos safely on qrecord ...@@ -331,12 +333,14 @@ handle subrepos safely on qrecord
% qrecord --config ui.interactive=1 -m1 1.diff % qrecord --config ui.interactive=1 -m1 1.diff
diff --git a/.hgsub b/.hgsub diff --git a/.hgsub b/.hgsub
1 hunks, 1 lines changed 1 hunks, 1 lines changed
examine changes to '.hgsub'? [Ynesfdaq?] y examine changes to '.hgsub'?
(enter ? for help) [Ynesfdaq?] y
@@ -1,1 +1,2 @@ @@ -1,1 +1,2 @@
sub = sub sub = sub
+sub2 = sub2 +sub2 = sub2
record this change to '.hgsub'? [Ynesfdaq?] y record this change to '.hgsub'?
(enter ? for help) [Ynesfdaq?] y
path sub path sub
source sub source sub
...@@ -358,7 +362,8 @@ handle subrepos safely on qrecord ...@@ -358,7 +362,8 @@ handle subrepos safely on qrecord
% qrecord --config ui.interactive=1 -m2 2.diff % qrecord --config ui.interactive=1 -m2 2.diff
diff --git a/.hgsub b/.hgsub diff --git a/.hgsub b/.hgsub
deleted file mode 100644 deleted file mode 100644
examine changes to '.hgsub'? [Ynesfdaq?] y examine changes to '.hgsub'?
(enter ? for help) [Ynesfdaq?] y
% debugsub should be empty % debugsub should be empty
...@@ -374,7 +379,8 @@ handle subrepos safely on qrecord ...@@ -374,7 +379,8 @@ handle subrepos safely on qrecord
% qrecord --config ui.interactive=1 -m3 3.diff % qrecord --config ui.interactive=1 -m3 3.diff
diff --git a/.hgsub b/.hgsub diff --git a/.hgsub b/.hgsub
deleted file mode 100644 deleted file mode 100644
examine changes to '.hgsub'? [Ynesfdaq?] y examine changes to '.hgsub'?
(enter ? for help) [Ynesfdaq?] y
% debugsub should be empty % debugsub should be empty
......
...@@ -260,25 +260,29 @@ qrecord a.patch ...@@ -260,25 +260,29 @@ qrecord a.patch
> EOF > EOF
diff --git a/1.txt b/1.txt diff --git a/1.txt b/1.txt
2 hunks, 2 lines changed 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,3 +1,3 @@
1 1
-2 -2
+2 2 +2 2
3 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,3 +3,3 @@
3 3
-4 -4
+4 4 +4 4
5 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 diff --git a/2.txt b/2.txt
1 hunks, 1 lines changed 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 @@ @@ -1,5 +1,5 @@
a a
...@@ -287,11 +291,13 @@ qrecord a.patch ...@@ -287,11 +291,13 @@ qrecord a.patch
c c
d d
e 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 diff --git a/dir/a.txt b/dir/a.txt
1 hunks, 1 lines changed 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'" After qrecord a.patch 'tip'"
...@@ -361,7 +367,8 @@ qrecord b.patch ...@@ -361,7 +367,8 @@ qrecord b.patch
> EOF > EOF
diff --git a/1.txt b/1.txt diff --git a/1.txt b/1.txt
1 hunks, 1 lines changed 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,5 +1,5 @@
1 1
...@@ -370,11 +377,13 @@ qrecord b.patch ...@@ -370,11 +377,13 @@ qrecord b.patch
-4 -4
+4 4 +4 4
5 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 diff --git a/dir/a.txt b/dir/a.txt
1 hunks, 1 lines changed 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 @@ @@ -1,4 +1,4 @@
-hello world -hello world
...@@ -382,7 +391,8 @@ qrecord b.patch ...@@ -382,7 +391,8 @@ qrecord b.patch
someone someone
up 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' After qrecord b.patch 'tip'
......
...@@ -55,7 +55,8 @@ Revert interactive tests ...@@ -55,7 +55,8 @@ Revert interactive tests
removing folder1/i removing folder1/i
diff --git a/f b/f diff --git a/f b/f
2 hunks, 2 lines changed 2 hunks, 2 lines changed
examine changes to 'f'? [Ynesfdaq?] y examine changes to 'f'?
(enter ? for help) [Ynesfdaq?] y
@@ -1,6 +1,5 @@ @@ -1,6 +1,5 @@
-a -a
...@@ -64,7 +65,8 @@ Revert interactive tests ...@@ -64,7 +65,8 @@ Revert interactive tests
3 3
4 4
5 5
apply change 1/6 to 'f'? [Ynesfdaq?] y apply change 1/6 to 'f'?
(enter ? for help) [Ynesfdaq?] y
@@ -2,6 +1,5 @@ @@ -2,6 +1,5 @@
1 1
...@@ -73,11 +75,13 @@ Revert interactive tests ...@@ -73,11 +75,13 @@ Revert interactive tests
4 4
5 5
-b -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 diff --git a/folder1/g b/folder1/g
2 hunks, 2 lines changed 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 @@ @@ -1,6 +1,5 @@
-c -c
...@@ -86,7 +90,8 @@ Revert interactive tests ...@@ -86,7 +90,8 @@ Revert interactive tests
3 3
4 4
5 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 y - yes, apply this change
n - no, skip this change n - no, skip this change
...@@ -97,7 +102,8 @@ Revert interactive tests