##// END OF EJS Templates
merge: move ancestor selection tweaking from manifestmerge to update function...
Mads Kiilerich -
r21080:04540a84 default
parent child Browse files
Show More
@@ -366,10 +366,10 b' def overridecheckunknownfile(origfn, rep'
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, pa, branchmerge, force,
369 partial, acceptremote=False):
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, pa, branchmerge, force, partial,
372 acceptremote)
372 acceptremote, followcopies)
373
373
374 if overwrite:
374 if overwrite:
375 return actions
375 return actions
@@ -376,7 +376,7 b' def _checkcollision(repo, wmf, actions):'
376 foldmap[fold] = f
376 foldmap[fold] = f
377
377
378 def manifestmerge(repo, wctx, p2, pa, branchmerge, force, partial,
378 def manifestmerge(repo, wctx, p2, pa, branchmerge, force, partial,
379 acceptremote=False):
379 acceptremote, followcopies):
380 """
380 """
381 Merge p1 and p2 with ancestor pa and generate merge action list
381 Merge p1 and p2 with ancestor pa and generate merge action list
382
382
@@ -385,19 +385,8 b' def manifestmerge(repo, wctx, p2, pa, br'
385 acceptremote = accept the incoming changes without prompting
385 acceptremote = accept the incoming changes without prompting
386 """
386 """
387
387
388 overwrite = force and not branchmerge
389 actions, copy, movewithdir = [], {}, {}
388 actions, copy, movewithdir = [], {}, {}
390
389
391 followcopies = False
392 if overwrite:
393 pa = wctx
394 elif pa == p2: # backwards
395 pa = wctx.p1()
396 elif not branchmerge and not wctx.dirty(missing=True):
397 pass
398 elif pa and repo.ui.configbool("merge", "followcopies", True):
399 followcopies = True
400
401 # manifests fetched in order are going to be faster, so prime the caches
390 # manifests fetched in order are going to be faster, so prime the caches
402 [x.manifest() for x in
391 [x.manifest() for x in
403 sorted(wctx.parents() + [p2, pa], key=lambda x: x.rev())]
392 sorted(wctx.parents() + [p2, pa], key=lambda x: x.rev())]
@@ -730,14 +719,14 b' def applyupdates(repo, actions, wctx, mc'
730
719
731 return updated, merged, removed, unresolved
720 return updated, merged, removed, unresolved
732
721
733 def calculateupdates(repo, tctx, mctx, ancestor, branchmerge, force, partial,
722 def calculateupdates(repo, wctx, mctx, ancestor, branchmerge, force, partial,
734 acceptremote=False):
723 acceptremote, followcopies):
735 "Calculate the actions needed to merge mctx into tctx"
724 "Calculate the actions needed to merge mctx into wctx using ancestor"
736 actions = []
725
737 actions += manifestmerge(repo, tctx, mctx,
726 actions = manifestmerge(repo, wctx, mctx,
738 ancestor,
727 ancestor,
739 branchmerge, force,
728 branchmerge, force,
740 partial, acceptremote)
729 partial, acceptremote, followcopies)
741
730
742 # Filter out prompts.
731 # Filter out prompts.
743 newactions, prompts = [], []
732 newactions, prompts = [], []
@@ -765,8 +754,8 b' def calculateupdates(repo, tctx, mctx, a'
765 newactions.append((f, "g", (flags,), "prompt recreating"))
754 newactions.append((f, "g", (flags,), "prompt recreating"))
766 else: assert False, m
755 else: assert False, m
767
756
768 if tctx.rev() is None:
757 if wctx.rev() is None:
769 newactions += _forgetremoved(tctx, mctx, branchmerge)
758 newactions += _forgetremoved(wctx, mctx, branchmerge)
770
759
771 return newactions
760 return newactions
772
761
@@ -990,9 +979,19 b' def update(repo, node, branchmerge, forc'
990 # Allow jumping branches if clean and specific rev given
979 # Allow jumping branches if clean and specific rev given
991 pa = p1
980 pa = p1
992
981
982 followcopies = False
983 if overwrite:
984 pa = wc
985 elif pa == p2: # backwards
986 pa = wc.p1()
987 elif not branchmerge and not wc.dirty(missing=True):
988 pass
989 elif pa and repo.ui.configbool("merge", "followcopies", True):
990 followcopies = True
991
993 ### calculate phase
992 ### calculate phase
994 actions = calculateupdates(repo, wc, p2, pa,
993 actions = calculateupdates(repo, wc, p2, pa, branchmerge, force,
995 branchmerge, force, partial, mergeancestor)
994 partial, mergeancestor, followcopies)
996
995
997 ### apply phase
996 ### apply phase
998 if not branchmerge: # just jump to the new rev
997 if not branchmerge: # just jump to the new rev
General Comments 0
You need to be logged in to leave comments. Login now