D275: ui: refactor extractchoices so it doesn't break on Python 3
durin42 (Augie Fackler)
phabricator at mercurial-scm.org
Wed Aug 9 14:18:29 UTC 2017
This revision was automatically updated to reflect the committed changes.
Closed by commit rHGd880a6bcef2f: ui: refactor extractchoices so it doesn't break on Python 3 (authored by durin42).
REPOSITORY
rHG Mercurial
CHANGES SINCE LAST UPDATE
https://phab.mercurial-scm.org/D275?vs=640&id=670
REVISION DETAIL
https://phab.mercurial-scm.org/D275
AFFECTED FILES
mercurial/ui.py
CHANGE DETAILS
diff --git a/mercurial/ui.py b/mercurial/ui.py
--- a/mercurial/ui.py
+++ b/mercurial/ui.py
@@ -1269,9 +1269,10 @@
m = re.match(br'(?s)(.+?)\$\$([^\$]*&[^ \$].*)', prompt)
msg = m.group(1)
choices = [p.strip(' ') for p in m.group(2).split('$$')]
- return (msg,
- [(s[s.index('&') + 1].lower(), s.replace('&', '', 1))
- for s in choices])
+ def choicetuple(s):
+ ampidx = s.index('&')
+ return s[ampidx + 1:ampidx + 2].lower(), s.replace('&', '', 1)
+ return (msg, [choicetuple(s) for s in choices])
def promptchoice(self, prompt, default=0):
"""Prompt user with a message, read response, and ensure it matches
To: durin42, #hg-reviewers, quark
Cc: mercurial-devel
More information about the Mercurial-devel
mailing list