##// END OF EJS Templates
merge: tell _checkunknownfiles about whether this was merge --force...
Siddharth Agarwal -
r28020:cffa46cb default
parent child Browse files
Show More
@@ -452,7 +452,8 b' def overridecheckunknownfile(origfn, rep'
452 # writing the files into the working copy and lfcommands.updatelfiles
452 # writing the files into the working copy and lfcommands.updatelfiles
453 # will update the largefiles.
453 # will update the largefiles.
454 def overridecalculateupdates(origfn, repo, p1, p2, pas, branchmerge, force,
454 def overridecalculateupdates(origfn, repo, p1, p2, pas, branchmerge, force,
455 acceptremote, followcopies, matcher=None):
455 acceptremote, followcopies, matcher=None,
456 mergeforce=False):
456 overwrite = force and not branchmerge
457 overwrite = force and not branchmerge
457 actions, diverge, renamedelete = origfn(
458 actions, diverge, renamedelete = origfn(
458 repo, p1, p2, pas, branchmerge, force, acceptremote,
459 repo, p1, p2, pas, branchmerge, force, acceptremote,
@@ -5242,7 +5242,8 b' def merge(ui, repo, node=None, **opts):'
5242 try:
5242 try:
5243 # ui.forcemerge is an internal variable, do not document
5243 # ui.forcemerge is an internal variable, do not document
5244 repo.ui.setconfig('ui', 'forcemerge', opts.get('tool', ''), 'merge')
5244 repo.ui.setconfig('ui', 'forcemerge', opts.get('tool', ''), 'merge')
5245 return hg.merge(repo, node, force=opts.get('force'))
5245 force = opts.get('force')
5246 return hg.merge(repo, node, force=force, mergeforce=force)
5246 finally:
5247 finally:
5247 ui.setconfig('ui', 'forcemerge', '', 'merge')
5248 ui.setconfig('ui', 'forcemerge', '', 'merge')
5248
5249
@@ -671,10 +671,10 b' def clean(repo, node, show_stats=True, q'
671 _showstats(repo, stats, quietempty)
671 _showstats(repo, stats, quietempty)
672 return stats[3] > 0
672 return stats[3] > 0
673
673
674 def merge(repo, node, force=None, remind=True):
674 def merge(repo, node, force=None, remind=True, mergeforce=False):
675 """Branch merge with node, resolving changes. Return true if any
675 """Branch merge with node, resolving changes. Return true if any
676 unresolved conflicts."""
676 unresolved conflicts."""
677 stats = mergemod.update(repo, node, True, force)
677 stats = mergemod.update(repo, node, True, force, mergeforce=mergeforce)
678 _showstats(repo, stats)
678 _showstats(repo, stats)
679 if stats[3]:
679 if stats[3]:
680 repo.ui.status(_("use 'hg resolve' to retry unresolved file merges "
680 repo.ui.status(_("use 'hg resolve' to retry unresolved file merges "
@@ -603,7 +603,7 b' def _checkunknownfile(repo, wctx, mctx, '
603 and repo.dirstate.normalize(f) not in repo.dirstate
603 and repo.dirstate.normalize(f) not in repo.dirstate
604 and mctx[f2].cmp(wctx[f]))
604 and mctx[f2].cmp(wctx[f]))
605
605
606 def _checkunknownfiles(repo, wctx, mctx, force, actions):
606 def _checkunknownfiles(repo, wctx, mctx, force, actions, mergeforce):
607 """
607 """
608 Considers any actions that care about the presence of conflicting unknown
608 Considers any actions that care about the presence of conflicting unknown
609 files. For some actions, the result is to abort; for others, it is to
609 files. For some actions, the result is to abort; for others, it is to
@@ -905,13 +905,14 b' def _resolvetrivial(repo, wctx, mctx, an'
905 del actions[f] # don't get = keep local deleted
905 del actions[f] # don't get = keep local deleted
906
906
907 def calculateupdates(repo, wctx, mctx, ancestors, branchmerge, force,
907 def calculateupdates(repo, wctx, mctx, ancestors, branchmerge, force,
908 acceptremote, followcopies, matcher=None):
908 acceptremote, followcopies, matcher=None,
909 mergeforce=False):
909 "Calculate the actions needed to merge mctx into wctx using ancestors"
910 "Calculate the actions needed to merge mctx into wctx using ancestors"
910 if len(ancestors) == 1: # default
911 if len(ancestors) == 1: # default
911 actions, diverge, renamedelete = manifestmerge(
912 actions, diverge, renamedelete = manifestmerge(
912 repo, wctx, mctx, ancestors[0], branchmerge, force, matcher,
913 repo, wctx, mctx, ancestors[0], branchmerge, force, matcher,
913 acceptremote, followcopies)
914 acceptremote, followcopies)
914 _checkunknownfiles(repo, wctx, mctx, force, actions)
915 _checkunknownfiles(repo, wctx, mctx, force, actions, mergeforce)
915
916
916 else: # only when merge.preferancestor=* - the default
917 else: # only when merge.preferancestor=* - the default
917 repo.ui.note(
918 repo.ui.note(
@@ -926,7 +927,7 b' def calculateupdates(repo, wctx, mctx, a'
926 actions, diverge1, renamedelete1 = manifestmerge(
927 actions, diverge1, renamedelete1 = manifestmerge(
927 repo, wctx, mctx, ancestor, branchmerge, force, matcher,
928 repo, wctx, mctx, ancestor, branchmerge, force, matcher,
928 acceptremote, followcopies)
929 acceptremote, followcopies)
929 _checkunknownfiles(repo, wctx, mctx, force, actions)
930 _checkunknownfiles(repo, wctx, mctx, force, actions, mergeforce)
930
931
931 # Track the shortest set of warning on the theory that bid
932 # Track the shortest set of warning on the theory that bid
932 # merge will correctly incorporate more information
933 # merge will correctly incorporate more information
@@ -1344,7 +1345,7 b' def recordupdates(repo, actions, branchm'
1344 repo.dirstate.normal(f)
1345 repo.dirstate.normal(f)
1345
1346
1346 def update(repo, node, branchmerge, force, ancestor=None,
1347 def update(repo, node, branchmerge, force, ancestor=None,
1347 mergeancestor=False, labels=None, matcher=None):
1348 mergeancestor=False, labels=None, matcher=None, mergeforce=False):
1348 """
1349 """
1349 Perform a merge between the working directory and the given node
1350 Perform a merge between the working directory and the given node
1350
1351
@@ -1358,6 +1359,8 b' def update(repo, node, branchmerge, forc'
1358 between different named branches. This flag is used by rebase extension
1359 between different named branches. This flag is used by rebase extension
1359 as a temporary fix and should be avoided in general.
1360 as a temporary fix and should be avoided in general.
1360 labels = labels to use for base, local and other
1361 labels = labels to use for base, local and other
1362 mergeforce = whether the merge was run with 'merge --force' (deprecated): if
1363 this is True, then 'force' should be True as well.
1361
1364
1362 The table below shows all the behaviors of the update command
1365 The table below shows all the behaviors of the update command
1363 given the -c and -C or no options, whether the working directory
1366 given the -c and -C or no options, whether the working directory
@@ -1493,7 +1496,7 b' def update(repo, node, branchmerge, forc'
1493 ### calculate phase
1496 ### calculate phase
1494 actionbyfile, diverge, renamedelete = calculateupdates(
1497 actionbyfile, diverge, renamedelete = calculateupdates(
1495 repo, wc, p2, pas, branchmerge, force, mergeancestor,
1498 repo, wc, p2, pas, branchmerge, force, mergeancestor,
1496 followcopies, matcher=matcher)
1499 followcopies, matcher=matcher, mergeforce=mergeforce)
1497
1500
1498 # Prompt and create actions. Most of this is in the resolve phase
1501 # Prompt and create actions. Most of this is in the resolve phase
1499 # already, but we can't handle .hgsubstate in filemerge or
1502 # already, but we can't handle .hgsubstate in filemerge or
General Comments 0
You need to be logged in to leave comments. Login now