from mercurial import util, ui
from mercurial.i18n import gettext as _
from mercurial.node import *
# Workaround for http://www.selenic.com/mercurial/bts/issue988
def hook(ui, repo, hooktype, node=None, **kwargs):
    ctx = repo.changectx('tip')
    if '.hgundead' in ctx:
        for undead in ctx.filectx('.hgundead').data().splitlines():
            if not undead or undead[0] == '#':
                continue
            if undead in ctx:
                ui.warn(_('Refusing to permit %s to be resurrected; see .hgundead\n') % undead)
                return True
    return False
