--- a/mercurial/ui.py Tue May 21 15:32:15 2013 -0500
+++ b/mercurial/ui.py Wed May 22 17:31:43 2013 -0500
@@ -639,13 +639,20 @@
except EOFError:
raise util.Abort(_('response expected'))
- def promptchoice(self, msg, choices, default=0):
- """Prompt user with msg, read response, and ensure it matches
- one of the provided choices. The index of the choice is returned.
- choices is a sequence of acceptable responses with the format:
- ('&None', 'E&xec', 'Sym&link') Responses are case insensitive.
- If ui is not interactive, the default is returned.
+ def promptchoice(self, prompt, default=0):
+ """Prompt user with a message, read response, and ensure it matches
+ one of the provided choices. The prompt is formatted as follows:
+
+ "would you like fries with that (Yn)? $$ &Yes $$ &No"
+
+ The index of the choice is returned. Responses are case
+ insensitive. If ui is not interactive, the default is
+ returned.
"""
+
+ parts = prompt.split('$$')
+ msg = parts[0].rstrip(' ')
+ choices = [p.strip(' ') for p in parts[1:]]
resps = [s[s.index('&') + 1].lower() for s in choices]
while True:
r = self.prompt(msg, resps[default])