##// END OF EJS Templates
largefiles: rewrite merge code using dictionary with entry per file...
Martin von Zweigbergk -
r23529:38e55e55 default
parent child Browse files
Show More
@@ -425,10 +425,14 b' def overridecalculateupdates(origfn, rep'
425 425 if overwrite:
426 426 return actions, diverge, renamedelete
427 427
428 # Convert to dictionary with filename as key and action as value.
429 actionbyfile = {}
430 for m, l in actions.iteritems():
431 for f, args, msg in l:
432 actionbyfile[f] = m, args, msg
433
428 434 removes = set(a[0] for a in actions['r'])
429 435
430 newglist = []
431 lfmr = [] # LargeFiles: Mark as Removed
432 436 for action in actions['g']:
433 437 f, args, msg = action
434 438 splitstandin = f and lfutil.splitstandin(f)
@@ -442,15 +446,14 b' def overridecalculateupdates(origfn, rep'
442 446 'use (l)argefile or keep (n)ormal file?'
443 447 '$$ &Largefile $$ &Normal file') % lfile
444 448 if repo.ui.promptchoice(usermsg, 0) == 0: # pick remote largefile
445 actions['r'].append((lfile, None, 'replaced by standin'))
446 newglist.append(action)
449 actionbyfile[lfile] = ('r', None, 'replaced by standin')
447 450 else: # keep local normal file
448 451 if branchmerge:
449 actions['k'].append((standin, None,
450 'replaced by non-standin'))
452 actionbyfile[standin] = ('k', None,
453 'replaced by non-standin')
451 454 else:
452 actions['r'].append((standin, None,
453 'replaced by non-standin'))
455 actionbyfile[standin] = ('r', None,
456 'replaced by non-standin')
454 457 elif lfutil.standin(f) in p1 and lfutil.standin(f) not in removes:
455 458 # Case 2: largefile in the working copy, normal file in
456 459 # the second parent
@@ -462,23 +465,24 b' def overridecalculateupdates(origfn, rep'
462 465 if repo.ui.promptchoice(usermsg, 0) == 0: # keep local largefile
463 466 if branchmerge:
464 467 # largefile can be restored from standin safely
465 actions['k'].append((lfile, None, 'replaced by standin'))
468 actionbyfile[lfile] = ('k', None, 'replaced by standin')
466 469 else:
467 470 # "lfile" should be marked as "removed" without
468 471 # removal of itself
469 lfmr.append((lfile, None, 'forget non-standin largefile'))
472 actionbyfile[lfile] = ('lfmr', None,
473 'forget non-standin largefile')
470 474
471 475 # linear-merge should treat this largefile as 're-added'
472 actions['a'].append((standin, None, 'keep standin'))
476 actionbyfile[standin] = ('a', None, 'keep standin')
473 477 else: # pick remote normal file
474 actions['r'].append((standin, None, 'replaced by non-standin'))
475 newglist.append(action)
476 else:
477 newglist.append(action)
478 actionbyfile[standin] = ('r', None, 'replaced by non-standin')
478 479
479 actions['g'] = newglist
480 if lfmr:
481 actions['lfmr'] = lfmr
480 # Convert back to dictionary-of-lists format
481 for l in actions.itervalues():
482 l[:] = []
483 actions['lfmr'] = []
484 for f, (m, args, msg) in actionbyfile.iteritems():
485 actions[m].append((f, args, msg))
482 486
483 487 return actions, diverge, renamedelete
484 488
General Comments 0
You need to be logged in to leave comments. Login now