tests/failfilemerge.py
author Pierre-Yves David <pierre-yves.david@octobus.net>
Fri, 26 Nov 2021 17:17:49 +0100
changeset 48361 0d0ce2529540
parent 45681 a736ab681b78
child 48426 de8181c5414d
permissions -rw-r--r--
extension: add a `required` suboption to enforce the use of an extensions If `required` is set, failing to load an extensions will abort. See the test and documentation for details. Differential Revision: https://phab.mercurial-scm.org/D11822

# extension to emulate interrupting filemerge._filemerge

from __future__ import absolute_import

from mercurial import (
    error,
    extensions,
    filemerge,
)


def failfilemerge(
    filemergefn, premerge, repo, wctx, mynode, orig, fcd, fco, fca, labels=None
):
    raise error.Abort(b"^C")
    return filemergefn(premerge, repo, mynode, orig, fcd, fco, fca, labels)


def extsetup(ui):
    extensions.wrapfunction(filemerge, '_filemerge', failfilemerge)