# HG changeset patch # User Martin von Zweigbergk # Date 1418360776 28800 # Node ID 35c7249031576a6398b853975f23ac25e88dbe63 # Parent 09be050ca98c237505fbba8a491f08cab91ab132 merge: let _resolvetrivial() work on the file->action dict By moving the conversion from the file->action dict after _resolvetrivial(), we greatly simplify and clarify that method. diff -r 09be050ca98c -r 35c724903157 mercurial/merge.py --- a/mercurial/merge.py Thu Dec 11 20:56:53 2014 -0800 +++ b/mercurial/merge.py Thu Dec 11 21:06:16 2014 -0800 @@ -531,25 +531,13 @@ """Resolves false conflicts where the nodeid changed but the content remained the same.""" - cdactions = [] - for action in actions['cd']: - f = action[0] - if f in ancestor and not wctx[f].cmp(ancestor[f]): + for f, (m, args, msg) in actions.items(): + if m == 'cd' and f in ancestor and not wctx[f].cmp(ancestor[f]): # local did change but ended up with same content - actions['r'].append((f, None, "prompt same")) - else: - cdactions.append(action) - actions['cd'] = cdactions - - dcactions = [] - for action in actions['dc']: - f = action[0] - if f in ancestor and not mctx[f].cmp(ancestor[f]): + actions[f] = 'r', None, "prompt same" + elif m == 'dc' and f in ancestor and not mctx[f].cmp(ancestor[f]): # remote did change but ended up with same content - pass # don't get = keep local deleted - else: - dcactions.append(action) - actions['dc'] = dcactions + del actions[f] # don't get = keep local deleted def calculateupdates(repo, wctx, mctx, ancestors, branchmerge, force, partial, acceptremote, followcopies): @@ -627,14 +615,14 @@ continue repo.ui.note(_('end of auction\n\n')) + _resolvetrivial(repo, wctx, mctx, ancestors[0], actions) + # Convert to dictionary-of-lists format actionbyfile = actions actions = dict((m, []) for m in 'a f g cd dc r dm dg m e k'.split()) for f, (m, args, msg) in actionbyfile.iteritems(): actions[m].append((f, args, msg)) - _resolvetrivial(repo, wctx, mctx, ancestors[0], actions) - if wctx.rev() is None: ractions, factions = _forgetremoved(wctx, mctx, branchmerge) actions['r'].extend(ractions)