Mercurial > hg
comparison hgext/largefiles/overrides.py @ 23541:495bc1b65d25
merge: move cd/dc prompts after largefiles prompts
By moving the cd/dc prompts out of calculateupdates(), we let
largefiles' overridecalculateupdates() so the unresolved values
(i.e. 'cd' or 'dc' rather than 'g', 'r', 'a' and missing). This allows
overridecalculateupdates() to ask the user whether to keep the normal
file or the largefile before the user gets the cd/dc prompt. Whichever
answer the user gives, we make overridecalculateupdates() replace 'cd'
or 'dc' action, saving the user one annoying (and less clear)
question.
author | Martin von Zweigbergk <martinvonz@google.com> |
---|---|
date | Thu, 11 Dec 2014 21:21:21 -0800 |
parents | f1b06a8aad42 |
children | 4dd8a6a1240d |
comparison
equal
deleted
inserted
replaced
23540:f274d27f1994 | 23541:495bc1b65d25 |
---|---|
438 elif lfutil.standin(f) in p1: | 438 elif lfutil.standin(f) in p1: |
439 lfiles.add(f) | 439 lfiles.add(f) |
440 | 440 |
441 for lfile in lfiles: | 441 for lfile in lfiles: |
442 standin = lfutil.standin(lfile) | 442 standin = lfutil.standin(lfile) |
443 lm = actionbyfile.get(lfile, (None, None, None))[0] | 443 (lm, largs, lmsg) = actionbyfile.get(lfile, (None, None, None)) |
444 sm = actionbyfile.get(standin, (None, None, None))[0] | 444 (sm, sargs, smsg) = actionbyfile.get(standin, (None, None, None)) |
445 if sm == 'g' and lm != 'r': | 445 if sm in ('g', 'dc') and lm != 'r': |
446 # Case 1: normal file in the working copy, largefile in | 446 # Case 1: normal file in the working copy, largefile in |
447 # the second parent | 447 # the second parent |
448 usermsg = _('remote turned local normal file %s into a largefile\n' | 448 usermsg = _('remote turned local normal file %s into a largefile\n' |
449 'use (l)argefile or keep (n)ormal file?' | 449 'use (l)argefile or keep (n)ormal file?' |
450 '$$ &Largefile $$ &Normal file') % lfile | 450 '$$ &Largefile $$ &Normal file') % lfile |
451 if repo.ui.promptchoice(usermsg, 0) == 0: # pick remote largefile | 451 if repo.ui.promptchoice(usermsg, 0) == 0: # pick remote largefile |
452 actionbyfile[lfile] = ('r', None, 'replaced by standin') | 452 actionbyfile[lfile] = ('r', None, 'replaced by standin') |
453 actionbyfile[standin] = ('g', sargs, 'replaces standin') | |
453 else: # keep local normal file | 454 else: # keep local normal file |
455 actionbyfile[lfile] = ('k', None, 'replaces standin') | |
454 if branchmerge: | 456 if branchmerge: |
455 actionbyfile[standin] = ('k', None, | 457 actionbyfile[standin] = ('k', None, |
456 'replaced by non-standin') | 458 'replaced by non-standin') |
457 else: | 459 else: |
458 actionbyfile[standin] = ('r', None, | 460 actionbyfile[standin] = ('r', None, |
459 'replaced by non-standin') | 461 'replaced by non-standin') |
460 elif lm == 'g' and sm != 'r': | 462 elif lm in ('g', 'dc') and sm != 'r': |
461 # Case 2: largefile in the working copy, normal file in | 463 # Case 2: largefile in the working copy, normal file in |
462 # the second parent | 464 # the second parent |
463 usermsg = _('remote turned local largefile %s into a normal file\n' | 465 usermsg = _('remote turned local largefile %s into a normal file\n' |
464 'keep (l)argefile or use (n)ormal file?' | 466 'keep (l)argefile or use (n)ormal file?' |
465 '$$ &Largefile $$ &Normal file') % lfile | 467 '$$ &Largefile $$ &Normal file') % lfile |
466 if repo.ui.promptchoice(usermsg, 0) == 0: # keep local largefile | 468 if repo.ui.promptchoice(usermsg, 0) == 0: # keep local largefile |
467 if branchmerge: | 469 if branchmerge: |
468 # largefile can be restored from standin safely | 470 # largefile can be restored from standin safely |
469 actionbyfile[lfile] = ('k', None, 'replaced by standin') | 471 actionbyfile[lfile] = ('k', None, 'replaced by standin') |
472 actionbyfile[standin] = ('k', None, 'replaces standin') | |
470 else: | 473 else: |
471 # "lfile" should be marked as "removed" without | 474 # "lfile" should be marked as "removed" without |
472 # removal of itself | 475 # removal of itself |
473 actionbyfile[lfile] = ('lfmr', None, | 476 actionbyfile[lfile] = ('lfmr', None, |
474 'forget non-standin largefile') | 477 'forget non-standin largefile') |
475 | 478 |
476 # linear-merge should treat this largefile as 're-added' | 479 # linear-merge should treat this largefile as 're-added' |
477 actionbyfile[standin] = ('a', None, 'keep standin') | 480 actionbyfile[standin] = ('a', None, 'keep standin') |
478 else: # pick remote normal file | 481 else: # pick remote normal file |
482 actionbyfile[lfile] = ('g', largs, 'replaces standin') | |
479 actionbyfile[standin] = ('r', None, 'replaced by non-standin') | 483 actionbyfile[standin] = ('r', None, 'replaced by non-standin') |
480 | 484 |
481 # Convert back to dictionary-of-lists format | 485 # Convert back to dictionary-of-lists format |
482 for l in actions.itervalues(): | 486 for l in actions.itervalues(): |
483 l[:] = [] | 487 l[:] = [] |