Show More
@@ -282,8 +282,16 b' def filterpatch(ui, chunks):' | |||
|
282 | 282 | if resp_file[0] is not None: |
|
283 | 283 | return resp_file[0] |
|
284 | 284 | while True: |
|
285 |
|
|
|
286 | r = (ui.prompt("%s %s " % (query, choices), '(?i)%s?$' % choices) | |
|
285 | resps = _('[Ynsfdaq?]') | |
|
286 | choices = (_('&Yes, record this change'), | |
|
287 | _('&No, skip this change'), | |
|
288 | _('&Skip remaining changes to this file'), | |
|
289 | _('Record remaining changes to this &file'), | |
|
290 | _('&Done, skip remaining changes and files'), | |
|
291 | _('Record &all changes to all remaining files'), | |
|
292 | _('&Quit, recording no changes'), | |
|
293 | _('&?')) | |
|
294 | r = (ui.prompt("%s %s " % (query, resps), choices) | |
|
287 | 295 | or _('y')).lower() |
|
288 | 296 | if r == _('?'): |
|
289 | 297 | doc = gettext(record.__doc__) |
@@ -143,7 +143,7 b' def filemerge(repo, mynode, orig, fcd, f' | |||
|
143 | 143 | tool = "internal:local" |
|
144 | 144 | if ui.prompt(_(" no tool found to merge %s\n" |
|
145 | 145 | "keep (l)ocal or take (o)ther?") % fd, |
|
146 |
_(" |
|
|
146 | (_("&Local"), _("&Other")), _("l")) != _("l"): | |
|
147 | 147 | tool = "internal:other" |
|
148 | 148 | if tool == "internal:local": |
|
149 | 149 | return 0 |
@@ -205,7 +205,7 b' def filemerge(repo, mynode, orig, fcd, f' | |||
|
205 | 205 | if filecmp.cmp(repo.wjoin(fd), back): |
|
206 | 206 | if ui.prompt(_(" output file %s appears unchanged\n" |
|
207 | 207 | "was merge successful (yn)?") % fd, |
|
208 |
_(" |
|
|
208 | (_("&Yes"), _("&No")), _("n")) != _("y"): | |
|
209 | 209 | r = 1 |
|
210 | 210 | |
|
211 | 211 | if _toolbool(ui, tool, "fixeol"): |
@@ -147,8 +147,9 b' def manifestmerge(repo, p1, p2, pa, over' | |||
|
147 | 147 | if not a: # both differ from parent |
|
148 | 148 | r = repo.ui.prompt( |
|
149 | 149 | _(" conflicting flags for %s\n" |
|
150 |
"(n)one, e(x)ec or sym(l)ink?") % f, |
|
|
151 | return r != "n" and r or '' | |
|
150 | "(n)one, e(x)ec or sym(l)ink?") % f, | |
|
151 | (_("&None"), _("E&xec"), _("Sym&link")), _("n")) | |
|
152 | return r != _("n") and r or '' | |
|
152 | 153 | if m == a: |
|
153 | 154 | return n # changed from m to n |
|
154 | 155 | return m # changed from n to m |
@@ -219,7 +220,7 b' def manifestmerge(repo, p1, p2, pa, over' | |||
|
219 | 220 | if repo.ui.prompt( |
|
220 | 221 | _(" local changed %s which remote deleted\n" |
|
221 | 222 | "use (c)hanged version or (d)elete?") % f, |
|
222 |
_(" |
|
|
223 | (_("&Changed"), _("&Delete")), _("c")) == _("d"): | |
|
223 | 224 | act("prompt delete", "r", f) |
|
224 | 225 | act("prompt keep", "a", f) |
|
225 | 226 | else: |
@@ -254,7 +255,7 b' def manifestmerge(repo, p1, p2, pa, over' | |||
|
254 | 255 | if repo.ui.prompt( |
|
255 | 256 | _("remote changed %s which local deleted\n" |
|
256 | 257 | "use (c)hanged version or leave (d)eleted?") % f, |
|
257 |
_(" |
|
|
258 | (_("&Changed"), _("&Deleted")), _("c")) == _("c"): | |
|
258 | 259 | act("prompt recreating", "g", f, m2.flags(f)) |
|
259 | 260 | else: |
|
260 | 261 | act("remote created", "g", f, m2.flags(f)) |
@@ -268,10 +268,12 b' class ui(object):' | |||
|
268 | 268 | line = line[:-1] |
|
269 | 269 | return line |
|
270 | 270 | |
|
271 |
def prompt(self, msg, |
|
|
272 |
"""Prompt user with msg, read response, and ensure it matches |
|
|
273 | ||
|
274 | If not interactive -- the default is returned | |
|
271 | def prompt(self, msg, choices=None, default="y"): | |
|
272 | """Prompt user with msg, read response, and ensure it matches | |
|
273 | one of the provided choices. choices is a sequence of acceptable | |
|
274 | responses with the format: ('&None', 'E&xec', 'Sym&link') | |
|
275 | No sequence implies no response checking. Responses are case | |
|
276 | insensitive. If ui is not interactive, the default is returned. | |
|
275 | 277 | """ |
|
276 | 278 | if not self.interactive(): |
|
277 | 279 | self.note(msg, ' ', default, "\n") |
@@ -281,8 +283,11 b' class ui(object):' | |||
|
281 | 283 | r = self._readline(msg + ' ') |
|
282 | 284 | if not r: |
|
283 | 285 | return default |
|
284 |
if not |
|
|
286 | if not choices: | |
|
285 | 287 | return r |
|
288 | resps = [s[s.index('&')+1].lower() for s in choices] | |
|
289 | if r.lower() in resps: | |
|
290 | return r.lower() | |
|
286 | 291 | else: |
|
287 | 292 | self.write(_("unrecognized response\n")) |
|
288 | 293 | except EOFError: |
General Comments 0
You need to be logged in to leave comments.
Login now