comparison mercurial/merge.py @ 23641:a7a0f32a383f

merge: make calculateupdates() return file->action dict This simplifies largefiles' overridecalculateupdates(), which no longer has to do the conversion it started doing in 38e55e55ae4d (largefiles: rewrite merge code using dictionary with entry per file, 2014-12-09). To keep this patch small, we'll leave the name 'actionbyfile' in overrides.py. It will be renamed in the next patch.
author Martin von Zweigbergk <martinvonz@google.com>
date Thu, 11 Dec 2014 22:07:41 -0800
parents b46b9865dd08
children 18ab5e5955df
comparison
equal deleted inserted replaced
23640:b46b9865dd08 23641:a7a0f32a383f
619 619
620 if wctx.rev() is None: 620 if wctx.rev() is None:
621 fractions = _forgetremoved(wctx, mctx, branchmerge) 621 fractions = _forgetremoved(wctx, mctx, branchmerge)
622 actions.update(fractions) 622 actions.update(fractions)
623 623
624 # Convert to dictionary-of-lists format
625 actionbyfile = actions
626 actions = dict((m, []) for m in 'a f g cd dc r dm dg m e k'.split())
627 for f, (m, args, msg) in actionbyfile.iteritems():
628 actions[m].append((f, args, msg))
629
630 return actions, diverge, renamedelete 624 return actions, diverge, renamedelete
631 625
632 def batchremove(repo, actions): 626 def batchremove(repo, actions):
633 """apply removes to the working directory 627 """apply removes to the working directory
634 628
1067 pass 1061 pass
1068 elif pas[0] and repo.ui.configbool('merge', 'followcopies', True): 1062 elif pas[0] and repo.ui.configbool('merge', 'followcopies', True):
1069 followcopies = True 1063 followcopies = True
1070 1064
1071 ### calculate phase 1065 ### calculate phase
1072 actions, diverge, renamedelete = calculateupdates( 1066 actionbyfile, diverge, renamedelete = calculateupdates(
1073 repo, wc, p2, pas, branchmerge, force, partial, mergeancestor, 1067 repo, wc, p2, pas, branchmerge, force, partial, mergeancestor,
1074 followcopies) 1068 followcopies)
1069 # Convert to dictionary-of-lists format
1070 actions = dict((m, []) for m in 'a f g cd dc r dm dg m e k'.split())
1071 for f, (m, args, msg) in actionbyfile.iteritems():
1072 if m not in actions:
1073 actions[m] = []
1074 actions[m].append((f, args, msg))
1075 1075
1076 if not util.checkcase(repo.path): 1076 if not util.checkcase(repo.path):
1077 # check collision between files only in p2 for clean update 1077 # check collision between files only in p2 for clean update
1078 if (not branchmerge and 1078 if (not branchmerge and
1079 (force or not wc.dirty(missing=True, branch=False))): 1079 (force or not wc.dirty(missing=True, branch=False))):