Mercurial > hg
changeset 28020:cffa46cbdb8f
merge: tell _checkunknownfiles about whether this was merge --force
In an upcoming patch we'll have different behavior here for when 'merge
--force' is used as opposed to when other kinds of force operations are
performed, like rebases.
author | Siddharth Agarwal <sid0@fb.com> |
---|---|
date | Mon, 01 Feb 2016 20:28:32 -0800 |
parents | e81d11794036 |
children | d0d805df6a44 |
files | hgext/largefiles/overrides.py mercurial/commands.py mercurial/hg.py mercurial/merge.py |
diffstat | 4 files changed, 15 insertions(+), 10 deletions(-) [+] |
line wrap: on
line diff
--- a/hgext/largefiles/overrides.py Mon Feb 01 20:28:32 2016 -0800 +++ b/hgext/largefiles/overrides.py Mon Feb 01 20:28:32 2016 -0800 @@ -452,7 +452,8 @@ # writing the files into the working copy and lfcommands.updatelfiles # will update the largefiles. def overridecalculateupdates(origfn, repo, p1, p2, pas, branchmerge, force, - acceptremote, followcopies, matcher=None): + acceptremote, followcopies, matcher=None, + mergeforce=False): overwrite = force and not branchmerge actions, diverge, renamedelete = origfn( repo, p1, p2, pas, branchmerge, force, acceptremote,
--- a/mercurial/commands.py Mon Feb 01 20:28:32 2016 -0800 +++ b/mercurial/commands.py Mon Feb 01 20:28:32 2016 -0800 @@ -5242,7 +5242,8 @@ try: # ui.forcemerge is an internal variable, do not document repo.ui.setconfig('ui', 'forcemerge', opts.get('tool', ''), 'merge') - return hg.merge(repo, node, force=opts.get('force')) + force = opts.get('force') + return hg.merge(repo, node, force=force, mergeforce=force) finally: ui.setconfig('ui', 'forcemerge', '', 'merge')
--- a/mercurial/hg.py Mon Feb 01 20:28:32 2016 -0800 +++ b/mercurial/hg.py Mon Feb 01 20:28:32 2016 -0800 @@ -671,10 +671,10 @@ _showstats(repo, stats, quietempty) return stats[3] > 0 -def merge(repo, node, force=None, remind=True): +def merge(repo, node, force=None, remind=True, mergeforce=False): """Branch merge with node, resolving changes. Return true if any unresolved conflicts.""" - stats = mergemod.update(repo, node, True, force) + stats = mergemod.update(repo, node, True, force, mergeforce=mergeforce) _showstats(repo, stats) if stats[3]: repo.ui.status(_("use 'hg resolve' to retry unresolved file merges "
--- a/mercurial/merge.py Mon Feb 01 20:28:32 2016 -0800 +++ b/mercurial/merge.py Mon Feb 01 20:28:32 2016 -0800 @@ -603,7 +603,7 @@ and repo.dirstate.normalize(f) not in repo.dirstate and mctx[f2].cmp(wctx[f])) -def _checkunknownfiles(repo, wctx, mctx, force, actions): +def _checkunknownfiles(repo, wctx, mctx, force, actions, mergeforce): """ Considers any actions that care about the presence of conflicting unknown files. For some actions, the result is to abort; for others, it is to @@ -905,13 +905,14 @@ del actions[f] # don't get = keep local deleted def calculateupdates(repo, wctx, mctx, ancestors, branchmerge, force, - acceptremote, followcopies, matcher=None): + acceptremote, followcopies, matcher=None, + mergeforce=False): "Calculate the actions needed to merge mctx into wctx using ancestors" if len(ancestors) == 1: # default actions, diverge, renamedelete = manifestmerge( repo, wctx, mctx, ancestors[0], branchmerge, force, matcher, acceptremote, followcopies) - _checkunknownfiles(repo, wctx, mctx, force, actions) + _checkunknownfiles(repo, wctx, mctx, force, actions, mergeforce) else: # only when merge.preferancestor=* - the default repo.ui.note( @@ -926,7 +927,7 @@ actions, diverge1, renamedelete1 = manifestmerge( repo, wctx, mctx, ancestor, branchmerge, force, matcher, acceptremote, followcopies) - _checkunknownfiles(repo, wctx, mctx, force, actions) + _checkunknownfiles(repo, wctx, mctx, force, actions, mergeforce) # Track the shortest set of warning on the theory that bid # merge will correctly incorporate more information @@ -1344,7 +1345,7 @@ repo.dirstate.normal(f) def update(repo, node, branchmerge, force, ancestor=None, - mergeancestor=False, labels=None, matcher=None): + mergeancestor=False, labels=None, matcher=None, mergeforce=False): """ Perform a merge between the working directory and the given node @@ -1358,6 +1359,8 @@ between different named branches. This flag is used by rebase extension as a temporary fix and should be avoided in general. labels = labels to use for base, local and other + mergeforce = whether the merge was run with 'merge --force' (deprecated): if + this is True, then 'force' should be True as well. The table below shows all the behaviors of the update command given the -c and -C or no options, whether the working directory @@ -1493,7 +1496,7 @@ ### calculate phase actionbyfile, diverge, renamedelete = calculateupdates( repo, wc, p2, pas, branchmerge, force, mergeancestor, - followcopies, matcher=matcher) + followcopies, matcher=matcher, mergeforce=mergeforce) # Prompt and create actions. Most of this is in the resolve phase # already, but we can't handle .hgsubstate in filemerge or