comparison mercurial/merge.py @ 27345:98266b1d144d

merge: restate calculateupdates in terms of a matcher Once we get a matcher down into manifestmerge, we can make narrowhg work more easily and potentially let manifest.match().diff() do less work in manifestmerge.
author Augie Fackler <augie@google.com>
date Mon, 14 Dec 2015 20:37:41 -0500
parents 43c00ca887d1
children ba0da4b7397d
comparison
equal deleted inserted replaced
27344:43c00ca887d1 27345:98266b1d144d
839 actions[f] = 'r', None, "prompt same" 839 actions[f] = 'r', None, "prompt same"
840 elif m == 'dc' and f in ancestor and not mctx[f].cmp(ancestor[f]): 840 elif m == 'dc' and f in ancestor and not mctx[f].cmp(ancestor[f]):
841 # remote did change but ended up with same content 841 # remote did change but ended up with same content
842 del actions[f] # don't get = keep local deleted 842 del actions[f] # don't get = keep local deleted
843 843
844 def calculateupdates(repo, wctx, mctx, ancestors, branchmerge, force, partial, 844 def calculateupdates(repo, wctx, mctx, ancestors, branchmerge, force,
845 acceptremote, followcopies): 845 acceptremote, followcopies, matcher=None):
846 "Calculate the actions needed to merge mctx into wctx using ancestors" 846 "Calculate the actions needed to merge mctx into wctx using ancestors"
847 if matcher is None or matcher.always():
848 partial = False
849 else:
850 partial = matcher.matchfn
847 851
848 if len(ancestors) == 1: # default 852 if len(ancestors) == 1: # default
849 actions, diverge, renamedelete = manifestmerge( 853 actions, diverge, renamedelete = manifestmerge(
850 repo, wctx, mctx, ancestors[0], branchmerge, force, partial, 854 repo, wctx, mctx, ancestors[0], branchmerge, force, partial,
851 acceptremote, followcopies) 855 acceptremote, followcopies)
1412 pass 1416 pass
1413 elif pas[0] and repo.ui.configbool('merge', 'followcopies', True): 1417 elif pas[0] and repo.ui.configbool('merge', 'followcopies', True):
1414 followcopies = True 1418 followcopies = True
1415 1419
1416 ### calculate phase 1420 ### calculate phase
1417 if matcher is None or matcher.always():
1418 partial = False
1419 else:
1420 partial = matcher.matchfn
1421 actionbyfile, diverge, renamedelete = calculateupdates( 1421 actionbyfile, diverge, renamedelete = calculateupdates(
1422 repo, wc, p2, pas, branchmerge, force, partial, mergeancestor, 1422 repo, wc, p2, pas, branchmerge, force, mergeancestor,
1423 followcopies) 1423 followcopies, matcher=matcher)
1424 # Convert to dictionary-of-lists format 1424 # Convert to dictionary-of-lists format
1425 actions = dict((m, []) for m in 'a am f g cd dc r dm dg m e k'.split()) 1425 actions = dict((m, []) for m in 'a am f g cd dc r dm dg m e k'.split())
1426 for f, (m, args, msg) in actionbyfile.iteritems(): 1426 for f, (m, args, msg) in actionbyfile.iteritems():
1427 if m not in actions: 1427 if m not in actions:
1428 actions[m] = [] 1428 actions[m] = []