mercurial/commands.py
changeset 1720 55017891051b
parent 1712 21dcf38e5d7d
child 1724 5a36609f73a7
child 1728 9b92b71d5dd7
equal deleted inserted replaced
1719:98072468ffde 1720:55017891051b
  2111     disallowed = (revrangesep, '\r', '\n')
  2111     disallowed = (revrangesep, '\r', '\n')
  2112     for c in disallowed:
  2112     for c in disallowed:
  2113         if name.find(c) >= 0:
  2113         if name.find(c) >= 0:
  2114             raise util.Abort(_("%s cannot be used in a tag name") % repr(c))
  2114             raise util.Abort(_("%s cannot be used in a tag name") % repr(c))
  2115 
  2115 
       
  2116     repo.hook('pretag', throw=True, node=r, tag=name,
       
  2117               local=not not opts['local'])
       
  2118 
  2116     if opts['local']:
  2119     if opts['local']:
  2117         repo.opener("localtags", "a").write("%s %s\n" % (r, name))
  2120         repo.opener("localtags", "a").write("%s %s\n" % (r, name))
       
  2121         repo.hook('tag', node=r, tag=name, local=1)
  2118         return
  2122         return
  2119 
  2123 
  2120     for x in repo.changes():
  2124     for x in repo.changes():
  2121         if ".hgtags" in x:
  2125         if ".hgtags" in x:
  2122             raise util.Abort(_("working copy of .hgtags is changed "
  2126             raise util.Abort(_("working copy of .hgtags is changed "
  2128 
  2132 
  2129     message = (opts['message'] or
  2133     message = (opts['message'] or
  2130                _("Added tag %s for changeset %s") % (name, r))
  2134                _("Added tag %s for changeset %s") % (name, r))
  2131     try:
  2135     try:
  2132         repo.commit([".hgtags"], message, opts['user'], opts['date'])
  2136         repo.commit([".hgtags"], message, opts['user'], opts['date'])
       
  2137         repo.hook('tag', node=r, tag=name, local=0)
  2133     except ValueError, inst:
  2138     except ValueError, inst:
  2134         raise util.Abort(str(inst))
  2139         raise util.Abort(str(inst))
  2135 
  2140 
  2136 def tags(ui, repo):
  2141 def tags(ui, repo):
  2137     """list repository tags
  2142     """list repository tags