Merge conflicts might be supported in the future, but for now are kept out of
scope.
Any places where we used to call flushall() should be replaced with some kind
of exception. At this point, IMM M1 is no longer supported.
( )
hg-reviewers |
Merge conflicts might be supported in the future, but for now are kept out of
scope.
Any places where we used to call flushall() should be replaced with some kind
of exception. At this point, IMM M1 is no longer supported.
Automatic diff as part of commit; lint not applicable. |
Automatic diff as part of commit; unit tests not applicable. |
Path | Packages | |||
---|---|---|---|---|
M | mercurial/filemerge.py (27 lines) |
Status | Author | Revision | |
---|---|---|---|
Closed | phillco | ||
Closed | phillco | ||
Closed | phillco | ||
Closed | phillco | ||
Closed | phillco | ||
Closed | phillco | ||
Closed | phillco | ||
Closed | phillco | ||
Closed | phillco | ||
Closed | phillco | ||
Closed | phillco | ||
Closed | phillco | ||
Closed | phillco | ||
Closed | phillco | ||
Closed | phillco | ||
Closed | phillco | ||
Closed | phillco | ||
Closed | phillco | ||
Closed | phillco | ||
Closed | phillco | ||
Closed | phillco | ||
Closed | phillco | ||
Closed | phillco | ||
Closed | phillco | ||
Closed | phillco | ||
Closed | phillco | ||
Closed | phillco | ||
Closed | phillco | ||
Abandoned | phillco |
@internaltool('prompt', nomerge) | @internaltool('prompt', nomerge) | ||||
def _iprompt(repo, mynode, orig, fcd, fco, fca, toolconf, labels=None): | def _iprompt(repo, mynode, orig, fcd, fco, fca, toolconf, labels=None): | ||||
"""Asks the user which of the local `p1()` or the other `p2()` version to | """Asks the user which of the local `p1()` or the other `p2()` version to | ||||
keep as the merged version.""" | keep as the merged version.""" | ||||
ui = repo.ui | ui = repo.ui | ||||
fd = fcd.path() | fd = fcd.path() | ||||
# Avoid prompting during an in-memory merge since it doesn't support merge | |||||
# conflicts. | |||||
if fcd.changectx().isinmemory(): | |||||
raise error.InMemoryMergeConflictsError('in-memory merge does not ' | |||||
'support file conflicts') | |||||
prompts = partextras(labels) | prompts = partextras(labels) | ||||
prompts['fd'] = fd | prompts['fd'] = fd | ||||
try: | try: | ||||
if fco.isabsent(): | if fco.isabsent(): | ||||
index = ui.promptchoice( | index = ui.promptchoice( | ||||
_localchangedotherdeletedmsg % prompts, 2) | _localchangedotherdeletedmsg % prompts, 2) | ||||
choice = ['local', 'other', 'unresolved'][index] | choice = ['local', 'other', 'unresolved'][index] | ||||
elif fcd.isabsent(): | elif fcd.isabsent(): | ||||
same directory as ``a.txt``. | same directory as ``a.txt``. | ||||
This implies premerge. Therefore, files aren't dumped, if premerge | This implies premerge. Therefore, files aren't dumped, if premerge | ||||
runs successfully. Use :forcedump to forcibly write files out. | runs successfully. Use :forcedump to forcibly write files out. | ||||
""" | """ | ||||
a = _workingpath(repo, fcd) | a = _workingpath(repo, fcd) | ||||
fd = fcd.path() | fd = fcd.path() | ||||
# Run ``flushall()`` to make any missing folders the following wwrite | |||||
# calls might be depending on. | |||||
from . import context | from . import context | ||||
if isinstance(fcd, context.overlayworkingfilectx): | if isinstance(fcd, context.overlayworkingfilectx): | ||||
fcd.changectx().flushall() | raise error.InMemoryMergeConflictsError('in-memory merge does not ' | ||||
'support the :dump tool.') | |||||
util.writefile(a + ".local", fcd.decodeddata()) | util.writefile(a + ".local", fcd.decodeddata()) | ||||
repo.wwrite(fd + ".other", fco.data(), fco.flags()) | repo.wwrite(fd + ".other", fco.data(), fco.flags()) | ||||
repo.wwrite(fd + ".base", fca.data(), fca.flags()) | repo.wwrite(fd + ".base", fca.data(), fca.flags()) | ||||
return False, 1, False | return False, 1, False | ||||
@internaltool('forcedump', mergeonly) | @internaltool('forcedump', mergeonly) | ||||
def _forcedump(repo, mynode, orig, fcd, fco, fca, toolconf, files, | def _forcedump(repo, mynode, orig, fcd, fco, fca, toolconf, files, | ||||
onfailure = func.onfailure | onfailure = func.onfailure | ||||
precheck = func.precheck | precheck = func.precheck | ||||
else: | else: | ||||
func = _xmerge | func = _xmerge | ||||
mergetype = fullmerge | mergetype = fullmerge | ||||
onfailure = _("merging %s failed!\n") | onfailure = _("merging %s failed!\n") | ||||
precheck = None | precheck = None | ||||
# If using deferred writes, must flush any deferred contents if running | if wctx.isinmemory(): | ||||
# an external merge tool since it has arbitrary access to the working | raise error.InMemoryMergeConflictsError('in-memory merge does not ' | ||||
# copy. | 'support external merge ' | ||||
wctx.flushall() | 'tools') | ||||
toolconf = tool, toolpath, binary, symlink | toolconf = tool, toolpath, binary, symlink | ||||
if mergetype == nomerge: | if mergetype == nomerge: | ||||
r, deleted = func(repo, mynode, orig, fcd, fco, fca, toolconf, labels) | r, deleted = func(repo, mynode, orig, fcd, fco, fca, toolconf, labels) | ||||
return True, r, deleted | return True, r, deleted | ||||
if premerge: | if premerge: | ||||
if orig != fco.path(): | if orig != fco.path(): | ||||
ui.status(_("merging %s and %s to %s\n") % (orig, fco.path(), fd)) | ui.status(_("merging %s and %s to %s\n") % (orig, fco.path(), fd)) | ||||
else: | else: | ||||
ui.status(_("merging %s\n") % fd) | ui.status(_("merging %s\n") % fd) | ||||
ui.debug("my %s other %s ancestor %s\n" % (fcd, fco, fca)) | ui.debug("my %s other %s ancestor %s\n" % (fcd, fco, fca)) | ||||
if precheck and not precheck(repo, mynode, orig, fcd, fco, fca, | if precheck and not precheck(repo, mynode, orig, fcd, fco, fca, | ||||
toolconf): | toolconf): | ||||
if onfailure: | if onfailure: | ||||
if wctx.isinmemory(): | |||||
raise error.InMemoryMergeConflictsError('in-memory merge does ' | |||||
'not support merge ' | |||||
'conflicts') | |||||
ui.warn(onfailure % fd) | ui.warn(onfailure % fd) | ||||
return True, 1, False | return True, 1, False | ||||
back = _makebackup(repo, ui, wctx, fcd, premerge) | back = _makebackup(repo, ui, wctx, fcd, premerge) | ||||
files = (None, None, None, back) | files = (None, None, None, back) | ||||
r = 1 | r = 1 | ||||
try: | try: | ||||
markerstyle = ui.config('ui', 'mergemarkers') | markerstyle = ui.config('ui', 'mergemarkers') | ||||
needcheck, r, deleted = func(repo, mynode, orig, fcd, fco, fca, | needcheck, r, deleted = func(repo, mynode, orig, fcd, fco, fca, | ||||
toolconf, files, labels=labels) | toolconf, files, labels=labels) | ||||
if needcheck: | if needcheck: | ||||
r = _check(repo, r, ui, tool, fcd, files) | r = _check(repo, r, ui, tool, fcd, files) | ||||
if r: | if r: | ||||
if onfailure: | if onfailure: | ||||
if wctx.isinmemory(): | |||||
raise error.InMemoryMergeConflictsError('in-memory merge ' | |||||
'does not support ' | |||||
'merge conflicts') | |||||
ui.warn(onfailure % fd) | ui.warn(onfailure % fd) | ||||
_onfilemergefailure(ui) | _onfilemergefailure(ui) | ||||
return True, r, deleted | return True, r, deleted | ||||
finally: | finally: | ||||
if not r and back is not None: | if not r and back is not None: | ||||
back.remove() | back.remove() | ||||