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