Show More
@@ -376,8 +376,6 b' def overridemanifestmerge(origfn, repo, ' | |||
|
376 | 376 | continue |
|
377 | 377 | f, m, args, msg = action |
|
378 | 378 | |
|
379 | choices = (_('&Largefile'), _('&Normal file')) | |
|
380 | ||
|
381 | 379 | splitstandin = lfutil.splitstandin(f) |
|
382 | 380 | if (m == "g" and splitstandin is not None and |
|
383 | 381 | splitstandin in p1 and f in p2): |
@@ -386,8 +384,9 b' def overridemanifestmerge(origfn, repo, ' | |||
|
386 | 384 | lfile = splitstandin |
|
387 | 385 | standin = f |
|
388 | 386 | msg = _('%s has been turned into a largefile\n' |
|
389 |
'use (l)argefile or keep as (n)ormal file?' |
|
|
390 | if repo.ui.promptchoice(msg, choices, 0) == 0: | |
|
387 | 'use (l)argefile or keep as (n)ormal file?' | |
|
388 | '$$ &Largefile $$ &Normal file') % lfile | |
|
389 | if repo.ui.promptchoice(msg, 0) == 0: | |
|
391 | 390 | processed.append((lfile, "r", None, msg)) |
|
392 | 391 | processed.append((standin, "g", (p2.flags(standin),), msg)) |
|
393 | 392 | else: |
@@ -398,8 +397,9 b' def overridemanifestmerge(origfn, repo, ' | |||
|
398 | 397 | standin = lfutil.standin(f) |
|
399 | 398 | lfile = f |
|
400 | 399 | msg = _('%s has been turned into a normal file\n' |
|
401 |
'keep as (l)argefile or use (n)ormal file?' |
|
|
402 | if repo.ui.promptchoice(msg, choices, 0) == 0: | |
|
400 | 'keep as (l)argefile or use (n)ormal file?' | |
|
401 | '$$ &Largefile $$ &Normal file') % lfile | |
|
402 | if repo.ui.promptchoice(msg, 0) == 0: | |
|
403 | 403 | processed.append((lfile, "r", None, msg)) |
|
404 | 404 | else: |
|
405 | 405 | processed.append((standin, "r", None, msg)) |
@@ -444,9 +444,9 b' def overridefilemerge(origfn, repo, myno' | |||
|
444 | 444 | return 0 |
|
445 | 445 | |
|
446 | 446 | if repo.ui.promptchoice(_('largefile %s has a merge conflict\n' |
|
447 |
'keep (l)ocal or take (o)ther?' |
|
|
448 | lfutil.splitstandin(orig), | |
|
449 |
( |
|
|
447 | 'keep (l)ocal or take (o)ther?' | |
|
448 | '$$ &Local $$ &Other') % | |
|
449 | lfutil.splitstandin(orig), 0) == 0: | |
|
450 | 450 | return 0 |
|
451 | 451 | else: |
|
452 | 452 | repo.wwrite(fcdest.path(), fcother.data(), fcother.flags()) |
@@ -482,8 +482,8 b' def patchbomb(ui, repo, *revs, **opts):' | |||
|
482 | 482 | if ds: |
|
483 | 483 | ui.write(ds) |
|
484 | 484 | ui.write('\n') |
|
485 |
if ui.promptchoice(_('are you sure you want to send (yn)?' |
|
|
486 |
|
|
|
485 | if ui.promptchoice(_('are you sure you want to send (yn)?' | |
|
486 | '$$ &Yes $$ &No')): | |
|
487 | 487 | raise util.Abort(_('patchbomb canceled')) |
|
488 | 488 | |
|
489 | 489 | ui.write('\n') |
@@ -283,17 +283,17 b' def filterpatch(ui, headers):' | |||
|
283 | 283 | if skipfile is not None: |
|
284 | 284 | return skipfile, skipfile, skipall, newpatches |
|
285 | 285 | while True: |
|
286 |
resps = _('[Ynesfdaq?]' |
|
|
287 |
|
|
|
288 |
|
|
|
289 |
|
|
|
290 |
|
|
|
291 |
|
|
|
292 |
|
|
|
293 |
|
|
|
294 |
|
|
|
295 |
|
|
|
296 |
r = ui.promptchoice("%s %s" % (query, resps) |
|
|
286 | resps = _('[Ynesfdaq?]' | |
|
287 | '$$ &Yes, record this change' | |
|
288 | '$$ &No, skip this change' | |
|
289 | '$$ &Edit the change manually' | |
|
290 | '$$ &Skip remaining changes to this file' | |
|
291 | '$$ Record remaining changes to this &file' | |
|
292 | '$$ &Done, skip remaining changes and files' | |
|
293 | '$$ Record &all changes to all remaining files' | |
|
294 | '$$ &Quit, recording no changes' | |
|
295 | '$$ &?') | |
|
296 | r = ui.promptchoice("%s %s" % (query, resps)) | |
|
297 | 297 | ui.write("\n") |
|
298 | 298 | if r == 8: # ? |
|
299 | 299 | doc = gettext(record.__doc__) |
@@ -144,8 +144,8 b' def _iprompt(repo, mynode, orig, fcd, fc' | |||
|
144 | 144 | fd = fcd.path() |
|
145 | 145 | |
|
146 | 146 | if ui.promptchoice(_(" no tool found to merge %s\n" |
|
147 |
"keep (l)ocal or take (o)ther?" |
|
|
148 |
|
|
|
147 | "keep (l)ocal or take (o)ther?" | |
|
148 | "$$ &Local $$ &Other") % fd, 0): | |
|
149 | 149 | return _iother(repo, mynode, orig, fcd, fco, fca, toolconf) |
|
150 | 150 | else: |
|
151 | 151 | return _ilocal(repo, mynode, orig, fcd, fco, fca, toolconf) |
@@ -348,16 +348,16 b' def filemerge(repo, mynode, orig, fcd, f' | |||
|
348 | 348 | checked = False |
|
349 | 349 | if 'prompt' in _toollist(ui, tool, "check"): |
|
350 | 350 | checked = True |
|
351 |
if ui.promptchoice(_("was merge of '%s' successful (yn)?" |
|
|
352 |
|
|
|
351 | if ui.promptchoice(_("was merge of '%s' successful (yn)?" | |
|
352 | "$$ &Yes $$ &No") % fd, 1): | |
|
353 | 353 | r = 1 |
|
354 | 354 | |
|
355 | 355 | if not r and not checked and (_toolbool(ui, tool, "checkchanged") or |
|
356 | 356 | 'changed' in _toollist(ui, tool, "check")): |
|
357 | 357 | if filecmp.cmp(a, back): |
|
358 | 358 | if ui.promptchoice(_(" output file %s appears unchanged\n" |
|
359 |
"was merge successful (yn)?" |
|
|
360 |
|
|
|
359 | "was merge successful (yn)?" | |
|
360 | "$$ &Yes $$ &No") % fd, 1): | |
|
361 | 361 | r = 1 |
|
362 | 362 | |
|
363 | 363 | if _toolbool(ui, tool, "fixeol"): |
@@ -365,8 +365,8 b' def manifestmerge(repo, wctx, p2, pa, br' | |||
|
365 | 365 | actions.append((f, "r", None, "remote delete")) |
|
366 | 366 | elif repo.ui.promptchoice( |
|
367 | 367 | _("local changed %s which remote deleted\n" |
|
368 |
"use (c)hanged version or (d)elete?" |
|
|
369 |
|
|
|
368 | "use (c)hanged version or (d)elete?" | |
|
369 | "$$ &Changed $$ &Delete") % f, 0): | |
|
370 | 370 | actions.append((f, "r", None, "prompt delete")) |
|
371 | 371 | else: |
|
372 | 372 | actions.append((f, "a", None, "prompt keep")) |
@@ -375,8 +375,8 b' def manifestmerge(repo, wctx, p2, pa, br' | |||
|
375 | 375 | actions.append((f, "g", (m2.flags(f),), "remote recreating")) |
|
376 | 376 | elif repo.ui.promptchoice( |
|
377 | 377 | _("remote changed %s which local deleted\n" |
|
378 |
"use (c)hanged version or leave (d)eleted?" |
|
|
379 |
|
|
|
378 | "use (c)hanged version or leave (d)eleted?" | |
|
379 | "$$ &Changed $$ &Deleted") % f, 0) == 0: | |
|
380 | 380 | actions.append((f, "g", (m2.flags(f),), "prompt recreating")) |
|
381 | 381 | else: assert False, m |
|
382 | 382 | return actions |
@@ -191,9 +191,8 b' def submerge(repo, wctx, mctx, actx, ove' | |||
|
191 | 191 | elif ld[0] != r[0]: # sources differ |
|
192 | 192 | if repo.ui.promptchoice( |
|
193 | 193 | _(' subrepository sources for %s differ\n' |
|
194 |
'use (l)ocal source (%s) or (r)emote source (%s)?' |
|
|
195 | % (s, l[0], r[0]), | |
|
196 | (_('&Local'), _('&Remote')), 0): | |
|
194 | 'use (l)ocal source (%s) or (r)emote source (%s)?' | |
|
195 | '$$ &Local $$ &Remote') % (s, l[0], r[0]), 0): | |
|
197 | 196 | debug(s, "prompt changed, get", r) |
|
198 | 197 | wctx.sub(s).get(r, overwrite) |
|
199 | 198 | sm[s] = r |
@@ -215,8 +214,8 b' def submerge(repo, wctx, mctx, actx, ove' | |||
|
215 | 214 | else: |
|
216 | 215 | if repo.ui.promptchoice( |
|
217 | 216 | _(' local changed subrepository %s which remote removed\n' |
|
218 |
'use (c)hanged version or (d)elete?' |
|
|
219 |
|
|
|
217 | 'use (c)hanged version or (d)elete?' | |
|
218 | '$$ &Changed $$ &Delete') % s, 0): | |
|
220 | 219 | debug(s, "prompt remove") |
|
221 | 220 | wctx.sub(s).remove() |
|
222 | 221 | |
@@ -230,8 +229,8 b' def submerge(repo, wctx, mctx, actx, ove' | |||
|
230 | 229 | elif r != sa[s]: |
|
231 | 230 | if repo.ui.promptchoice( |
|
232 | 231 | _(' remote changed subrepository %s which local removed\n' |
|
233 |
'use (c)hanged version or (d)elete?' |
|
|
234 |
|
|
|
232 | 'use (c)hanged version or (d)elete?' | |
|
233 | '$$ &Changed $$ &Delete') % s, 0) == 0: | |
|
235 | 234 | debug(s, "prompt recreate", r) |
|
236 | 235 | wctx.sub(s).get(r) |
|
237 | 236 | sm[s] = r |
@@ -242,14 +241,16 b' def submerge(repo, wctx, mctx, actx, ove' | |||
|
242 | 241 | def _updateprompt(ui, sub, dirty, local, remote): |
|
243 | 242 | if dirty: |
|
244 | 243 | msg = (_(' subrepository sources for %s differ\n' |
|
245 |
'use (l)ocal source (%s) or (r)emote source (%s)?\n' |
|
|
244 | 'use (l)ocal source (%s) or (r)emote source (%s)?\n' | |
|
245 | '$$ &Local $$ &Remote') | |
|
246 | 246 | % (subrelpath(sub), local, remote)) |
|
247 | 247 | else: |
|
248 | 248 | msg = (_(' subrepository sources for %s differ (in checked out ' |
|
249 | 249 | 'version)\n' |
|
250 |
'use (l)ocal source (%s) or (r)emote source (%s)?\n' |
|
|
250 | 'use (l)ocal source (%s) or (r)emote source (%s)?\n' | |
|
251 | '$$ &Local $$ &Remote') | |
|
251 | 252 | % (subrelpath(sub), local, remote)) |
|
252 |
return ui.promptchoice(msg, |
|
|
253 | return ui.promptchoice(msg, 0) | |
|
253 | 254 | |
|
254 | 255 | def reporelpath(repo): |
|
255 | 256 | """return path to this (sub)repo as seen from outermost repo""" |
@@ -639,13 +639,20 b' class ui(object):' | |||
|
639 | 639 | except EOFError: |
|
640 | 640 | raise util.Abort(_('response expected')) |
|
641 | 641 | |
|
642 |
def promptchoice(self, |
|
|
643 | """Prompt user with msg, read response, and ensure it matches | |
|
644 |
one of the provided choices. The |
|
|
645 | choices is a sequence of acceptable responses with the format: | |
|
646 | ('&None', 'E&xec', 'Sym&link') Responses are case insensitive. | |
|
647 | If ui is not interactive, the default is returned. | |
|
642 | def promptchoice(self, prompt, default=0): | |
|
643 | """Prompt user with a message, read response, and ensure it matches | |
|
644 | one of the provided choices. The prompt is formatted as follows: | |
|
645 | ||
|
646 | "would you like fries with that (Yn)? $$ &Yes $$ &No" | |
|
647 | ||
|
648 | The index of the choice is returned. Responses are case | |
|
649 | insensitive. If ui is not interactive, the default is | |
|
650 | returned. | |
|
648 | 651 | """ |
|
652 | ||
|
653 | parts = prompt.split('$$') | |
|
654 | msg = parts[0].rstrip(' ') | |
|
655 | choices = [p.strip(' ') for p in parts[1:]] | |
|
649 | 656 | resps = [s[s.index('&') + 1].lower() for s in choices] |
|
650 | 657 | while True: |
|
651 | 658 | r = self.prompt(msg, resps[default]) |
General Comments 0
You need to be logged in to leave comments.
Login now