diff mercurial/commands.py @ 1720:55017891051b

add pretag and tag hooks. pretag hook lets hook decide how tags can be named. tag hook is notifier.
author Vadim Gelfer <vadim.gelfer@gmail.com>
date Tue, 14 Feb 2006 15:47:25 -0800
parents 21dcf38e5d7d
children 5a36609f73a7 9b92b71d5dd7
line wrap: on
line diff
--- a/mercurial/commands.py	Tue Feb 14 15:37:27 2006 -0800
+++ b/mercurial/commands.py	Tue Feb 14 15:47:25 2006 -0800
@@ -2113,8 +2113,12 @@
         if name.find(c) >= 0:
             raise util.Abort(_("%s cannot be used in a tag name") % repr(c))
 
+    repo.hook('pretag', throw=True, node=r, tag=name,
+              local=not not opts['local'])
+
     if opts['local']:
         repo.opener("localtags", "a").write("%s %s\n" % (r, name))
+        repo.hook('tag', node=r, tag=name, local=1)
         return
 
     for x in repo.changes():
@@ -2130,6 +2134,7 @@
                _("Added tag %s for changeset %s") % (name, r))
     try:
         repo.commit([".hgtags"], message, opts['user'], opts['date'])
+        repo.hook('tag', node=r, tag=name, local=0)
     except ValueError, inst:
         raise util.Abort(str(inst))