##// END OF EJS Templates
merge: pass merge ancestor to calculateupdates as a list...
Mads Kiilerich -
r21081:ffd7b6ce default
parent child Browse files
Show More
@@ -365,10 +365,10 b' def overridecheckunknownfile(origfn, rep'
365 365 # Finally, the merge.applyupdates function will then take care of
366 366 # writing the files into the working copy and lfcommands.updatelfiles
367 367 # will update the largefiles.
368 def overridecalculateupdates(origfn, repo, p1, p2, pa, branchmerge, force,
368 def overridecalculateupdates(origfn, repo, p1, p2, pas, branchmerge, force,
369 369 partial, acceptremote, followcopies):
370 370 overwrite = force and not branchmerge
371 actions = origfn(repo, p1, p2, pa, branchmerge, force, partial,
371 actions = origfn(repo, p1, p2, pas, branchmerge, force, partial,
372 372 acceptremote, followcopies)
373 373
374 374 if overwrite:
@@ -719,9 +719,11 b' def applyupdates(repo, actions, wctx, mc'
719 719
720 720 return updated, merged, removed, unresolved
721 721
722 def calculateupdates(repo, wctx, mctx, ancestor, branchmerge, force, partial,
722 def calculateupdates(repo, wctx, mctx, ancestors, branchmerge, force, partial,
723 723 acceptremote, followcopies):
724 "Calculate the actions needed to merge mctx into wctx using ancestor"
724 "Calculate the actions needed to merge mctx into wctx using ancestors"
725
726 ancestor = ancestors[0]
725 727
726 728 actions = manifestmerge(repo, wctx, mctx,
727 729 ancestor,
@@ -875,9 +877,9 b' def update(repo, node, branchmerge, forc'
875 877 wc = repo[None]
876 878 pl = wc.parents()
877 879 p1 = pl[0]
878 pa = None
880 pas = [None]
879 881 if ancestor:
880 pa = repo[ancestor]
882 pas = [repo[ancestor]]
881 883
882 884 if node is None:
883 885 # Here is where we should consider bookmarks, divergent bookmarks,
@@ -916,13 +918,13 b' def update(repo, node, branchmerge, forc'
916 918 # get the max revision for the given successors set,
917 919 # i.e. the 'tip' of a set
918 920 node = repo.revs("max(%ln)", successors)[0]
919 pa = p1
921 pas = [p1]
920 922
921 923 overwrite = force and not branchmerge
922 924
923 925 p2 = repo[node]
924 if pa is None:
925 pa = p1.ancestor(p2)
926 if pas[0] is None:
927 pas = [p1.ancestor(p2)]
926 928
927 929 fp1, fp2, xp1, xp2 = p1.node(), p2.node(), str(p1), str(p2)
928 930
@@ -930,10 +932,10 b' def update(repo, node, branchmerge, forc'
930 932 if not overwrite and len(pl) > 1:
931 933 raise util.Abort(_("outstanding uncommitted merges"))
932 934 if branchmerge:
933 if pa == p2:
935 if pas == [p2]:
934 936 raise util.Abort(_("merging with a working directory ancestor"
935 937 " has no effect"))
936 elif pa == p1:
938 elif pas == [p1]:
937 939 if not mergeancestor and p1.branch() == p2.branch():
938 940 raise util.Abort(_("nothing to merge"),
939 941 hint=_("use 'hg update' "
@@ -953,7 +955,7 b' def update(repo, node, branchmerge, forc'
953 955 repo.hook('update', parent1=xp2, parent2='', error=0)
954 956 return 0, 0, 0, 0
955 957
956 if pa not in (p1, p2): # nonlinear
958 if pas not in ([p1], [p2]): # nonlinear
957 959 dirty = wc.dirty(missing=True)
958 960 if dirty or onode is None:
959 961 # Branching is a bit strange to ensure we do the minimal
@@ -961,7 +963,7 b' def update(repo, node, branchmerge, forc'
961 963 foreground = obsolete.foreground(repo, [p1.node()])
962 964 # note: the <node> variable contains a random identifier
963 965 if repo[node].node() in foreground:
964 pa = p1 # allow updating to successors
966 pas = [p1] # allow updating to successors
965 967 elif dirty:
966 968 msg = _("uncommitted changes")
967 969 if onode is None:
@@ -977,20 +979,20 b' def update(repo, node, branchmerge, forc'
977 979 raise util.Abort(msg, hint=hint)
978 980 else:
979 981 # Allow jumping branches if clean and specific rev given
980 pa = p1
982 pas = [p1]
981 983
982 984 followcopies = False
983 985 if overwrite:
984 pa = wc
985 elif pa == p2: # backwards
986 pa = wc.p1()
986 pas = [wc]
987 elif pas == [p2]: # backwards
988 pas = [wc.p1()]
987 989 elif not branchmerge and not wc.dirty(missing=True):
988 990 pass
989 elif pa and repo.ui.configbool("merge", "followcopies", True):
991 elif pas[0] and repo.ui.configbool("merge", "followcopies", True):
990 992 followcopies = True
991 993
992 994 ### calculate phase
993 actions = calculateupdates(repo, wc, p2, pa, branchmerge, force,
995 actions = calculateupdates(repo, wc, p2, pas, branchmerge, force,
994 996 partial, mergeancestor, followcopies)
995 997
996 998 ### apply phase
General Comments 0
You need to be logged in to leave comments. Login now