784 |
784 |
785 This is currently not implemented -- it's an extension point.""" |
785 This is currently not implemented -- it's an extension point.""" |
786 return True |
786 return True |
787 |
787 |
788 def manifestmerge(repo, wctx, p2, pa, branchmerge, force, matcher, |
788 def manifestmerge(repo, wctx, p2, pa, branchmerge, force, matcher, |
789 acceptremote, followcopies): |
789 acceptremote, followcopies, forcefulldiff=False): |
790 """ |
790 """ |
791 Merge wctx and p2 with ancestor pa and generate merge action list |
791 Merge wctx and p2 with ancestor pa and generate merge action list |
792 |
792 |
793 branchmerge and force are as passed in to update |
793 branchmerge and force are as passed in to update |
794 matcher = matcher to filter file lists |
794 matcher = matcher to filter file lists |
818 |
818 |
819 if '.hgsubstate' in m1: |
819 if '.hgsubstate' in m1: |
820 # check whether sub state is modified |
820 # check whether sub state is modified |
821 if any(wctx.sub(s).dirty() for s in wctx.substate): |
821 if any(wctx.sub(s).dirty() for s in wctx.substate): |
822 m1['.hgsubstate'] = modifiednodeid |
822 m1['.hgsubstate'] = modifiednodeid |
|
823 |
|
824 # Don't use m2-vs-ma optimization if: |
|
825 # - ma is the same as m1 or m2, which we're just going to diff again later |
|
826 # - The matcher is set already, so we can't override it |
|
827 # - The caller specifically asks for a full diff, which is useful during bid |
|
828 # merge. |
|
829 if (pa not in ([wctx, p2] + wctx.parents()) and |
|
830 matcher is None and not forcefulldiff): |
|
831 # Identify which files are relevant to the merge, so we can limit the |
|
832 # total m1-vs-m2 diff to just those files. This has significant |
|
833 # performance benefits in large repositories. |
|
834 relevantfiles = set(ma.diff(m2).keys()) |
|
835 |
|
836 # For copied and moved files, we need to add the source file too. |
|
837 for copykey, copyvalue in copy.iteritems(): |
|
838 if copyvalue in relevantfiles: |
|
839 relevantfiles.add(copykey) |
|
840 for movedirkey in movewithdir.iterkeys(): |
|
841 relevantfiles.add(movedirkey) |
|
842 matcher = scmutil.matchfiles(repo, relevantfiles) |
823 |
843 |
824 diff = m1.diff(m2, match=matcher) |
844 diff = m1.diff(m2, match=matcher) |
825 |
845 |
826 if matcher is None: |
846 if matcher is None: |
827 matcher = matchmod.always('', '') |
847 matcher = matchmod.always('', '') |
972 diverge, renamedelete = None, None |
992 diverge, renamedelete = None, None |
973 for ancestor in ancestors: |
993 for ancestor in ancestors: |
974 repo.ui.note(_('\ncalculating bids for ancestor %s\n') % ancestor) |
994 repo.ui.note(_('\ncalculating bids for ancestor %s\n') % ancestor) |
975 actions, diverge1, renamedelete1 = manifestmerge( |
995 actions, diverge1, renamedelete1 = manifestmerge( |
976 repo, wctx, mctx, ancestor, branchmerge, force, matcher, |
996 repo, wctx, mctx, ancestor, branchmerge, force, matcher, |
977 acceptremote, followcopies) |
997 acceptremote, followcopies, forcefulldiff=True) |
978 _checkunknownfiles(repo, wctx, mctx, force, actions, mergeforce) |
998 _checkunknownfiles(repo, wctx, mctx, force, actions, mergeforce) |
979 |
999 |
980 # Track the shortest set of warning on the theory that bid |
1000 # Track the shortest set of warning on the theory that bid |
981 # merge will correctly incorporate more information |
1001 # merge will correctly incorporate more information |
982 if diverge is None or len(diverge1) < len(diverge): |
1002 if diverge is None or len(diverge1) < len(diverge): |