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