# HG changeset patch # User Vadim Gelfer # Date 1139960845 28800 # Node ID 55017891051b1cc6cbe248ca5a6dfdeed683a9e8 # Parent 98072468ffde90e8cb4cd11d1efecb7130b2eb44 add pretag and tag hooks. pretag hook lets hook decide how tags can be named. tag hook is notifier. diff -r 98072468ffde -r 55017891051b doc/hgrc.5.txt --- a/doc/hgrc.5.txt Tue Feb 14 15:37:27 2006 -0800 +++ b/doc/hgrc.5.txt Tue Feb 14 15:47:25 2006 -0800 @@ -159,6 +159,15 @@ precommit;; Run before starting a commit. Exit status 0 allows the commit to proceed. Non-zero status will cause the commit to fail. + pretag;; + Run before creating a tag. Exit status 0 allows the tag to be + created. Non-zero status will cause the tag to fail. ID of + changeset to tag in $NODE. Name of tag in $TAG. Tag is local if + $LOCAL=1, in repo if $LOCAL=0. + tag;; + Run after a tag is created. ID of tagged changeset in $NODE. + Name of tag in $TAG. Tag is local if $LOCAL=1, in repo if + $LOCAL=0. http_proxy:: Used to access web-based Mercurial repositories through a HTTP diff -r 98072468ffde -r 55017891051b mercurial/commands.py --- 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))