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