view tests/crashgetbundler.py @ 31540:6d5b77abf306

util: add tryunlink function Throughout mercurial cdoe, there is a common pattern of attempting to remove a file and ignoring ENOENT errors. Let's move this into a common function to allow for cleaner code.
author Ryan McElroy <rmcelroy@fb.com>
date Tue, 21 Mar 2017 06:50:28 -0700
parents f3807a135e43
children 2372284d9457
line wrap: on
line source

from __future__ import absolute_import

from mercurial.i18n import _
from mercurial import (
        changegroup,
        error,
        extensions
    )

def abort(orig, *args, **kwargs):
    raise error.Abort(_('this is an exercise'))

def uisetup(ui):
    extensions.wrapfunction(changegroup, 'getbundler', abort)