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