I am a newbie to Mercurial and I am writing a pretag hook to check policy on tag names.
I have the below code.
version_re = r'(ver-\d+\.\d+\.\d+|tip)$'
def invalidtag(ui, repo, hooktype, node, tag, **kwargs):
assert(hooktype == 'pretag')
....
if not re_.match(tag):
ui.warn('Invalid tag name "%s".\n' % tag)
return True
return False
This hooks works perfect when I am tagging. But this hook is also executed when I want to remove invalid tags with --remove options.
So, is there any way to avoid his situation?