##// END OF EJS Templates
merge: rework manifestmerge to use a matcher...
Augie Fackler -
r27346:ba0da4b7 default
parent child Browse files
Show More
@@ -683,15 +683,17 b' def driverconclude(repo, ms, wctx, label'
683 This is currently not implemented -- it's an extension point."""
683 This is currently not implemented -- it's an extension point."""
684 return True
684 return True
685
685
686 def manifestmerge(repo, wctx, p2, pa, branchmerge, force, partial,
686 def manifestmerge(repo, wctx, p2, pa, branchmerge, force, matcher,
687 acceptremote, followcopies):
687 acceptremote, followcopies):
688 """
688 """
689 Merge p1 and p2 with ancestor pa and generate merge action list
689 Merge p1 and p2 with ancestor pa and generate merge action list
690
690
691 branchmerge and force are as passed in to update
691 branchmerge and force are as passed in to update
692 partial = function to filter file lists
692 matcher = matcher to filter file lists
693 acceptremote = accept the incoming changes without prompting
693 acceptremote = accept the incoming changes without prompting
694 """
694 """
695 if matcher is not None and matcher.always():
696 matcher = None
695
697
696 copy, movewithdir, diverge, renamedelete = {}, {}, {}, {}
698 copy, movewithdir, diverge, renamedelete = {}, {}, {}, {}
697
699
@@ -705,7 +707,7 b' def manifestmerge(repo, wctx, p2, pa, br'
705
707
706 repo.ui.note(_("resolving manifests\n"))
708 repo.ui.note(_("resolving manifests\n"))
707 repo.ui.debug(" branchmerge: %s, force: %s, partial: %s\n"
709 repo.ui.debug(" branchmerge: %s, force: %s, partial: %s\n"
708 % (bool(branchmerge), bool(force), bool(partial)))
710 % (bool(branchmerge), bool(force), bool(matcher)))
709 repo.ui.debug(" ancestor: %s, local: %s, remote: %s\n" % (pa, wctx, p2))
711 repo.ui.debug(" ancestor: %s, local: %s, remote: %s\n" % (pa, wctx, p2))
710
712
711 m1, m2, ma = wctx.manifest(), p2.manifest(), pa.manifest()
713 m1, m2, ma = wctx.manifest(), p2.manifest(), pa.manifest()
@@ -724,7 +726,7 b' def manifestmerge(repo, wctx, p2, pa, br'
724
726
725 actions = {}
727 actions = {}
726 for f, ((n1, fl1), (n2, fl2)) in diff.iteritems():
728 for f, ((n1, fl1), (n2, fl2)) in diff.iteritems():
727 if partial and not partial(f):
729 if matcher and not matcher(f):
728 continue
730 continue
729 if n1 and n2: # file exists on both local and remote side
731 if n1 and n2: # file exists on both local and remote side
730 if f not in ma:
732 if f not in ma:
@@ -844,14 +846,9 b' def _resolvetrivial(repo, wctx, mctx, an'
844 def calculateupdates(repo, wctx, mctx, ancestors, branchmerge, force,
846 def calculateupdates(repo, wctx, mctx, ancestors, branchmerge, force,
845 acceptremote, followcopies, matcher=None):
847 acceptremote, followcopies, matcher=None):
846 "Calculate the actions needed to merge mctx into wctx using ancestors"
848 "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
851
852 if len(ancestors) == 1: # default
849 if len(ancestors) == 1: # default
853 actions, diverge, renamedelete = manifestmerge(
850 actions, diverge, renamedelete = manifestmerge(
854 repo, wctx, mctx, ancestors[0], branchmerge, force, partial,
851 repo, wctx, mctx, ancestors[0], branchmerge, force, matcher,
855 acceptremote, followcopies)
852 acceptremote, followcopies)
856 _checkunknownfiles(repo, wctx, mctx, force, actions)
853 _checkunknownfiles(repo, wctx, mctx, force, actions)
857
854
@@ -866,7 +863,7 b' def calculateupdates(repo, wctx, mctx, a'
866 for ancestor in ancestors:
863 for ancestor in ancestors:
867 repo.ui.note(_('\ncalculating bids for ancestor %s\n') % ancestor)
864 repo.ui.note(_('\ncalculating bids for ancestor %s\n') % ancestor)
868 actions, diverge1, renamedelete1 = manifestmerge(
865 actions, diverge1, renamedelete1 = manifestmerge(
869 repo, wctx, mctx, ancestor, branchmerge, force, partial,
866 repo, wctx, mctx, ancestor, branchmerge, force, matcher,
870 acceptremote, followcopies)
867 acceptremote, followcopies)
871 _checkunknownfiles(repo, wctx, mctx, force, actions)
868 _checkunknownfiles(repo, wctx, mctx, force, actions)
872
869
General Comments 0
You need to be logged in to leave comments. Login now