tests/failfilemerge.py
author Yuya Nishihara <yuya@tcha.org>
Sun, 16 Oct 2016 16:58:43 +0900
changeset 30610 c039eb03e652
parent 30342 318a24b52eeb
child 34137 c0ce60459d84
permissions -rw-r--r--
convert: inline strutil.rfindall() This is the only place where strutil is used. I don't think it's worth to keep the strutil module, so inline it. Also, strutil.rfindall() appears to have off-by-one error. 'end = c - 1' is wrong because 'end' is exclusive.

# extension to emulate interrupting filemerge._filemerge

from __future__ import absolute_import

from mercurial import (
    error,
    extensions,
    filemerge,
)

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

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