diff mercurial/commands.py @ 4267:8185a1ca8628

tags: require -f to replace an existing tag based on a patch from Johan Herland <johherla@online.no>
author Matt Mackall <mpm@selenic.com>
date Fri, 23 Mar 2007 00:12:28 -0500
parents 89075f106414
children f38f90a177dc bc6f5a1d8b7b
line wrap: on
line diff
--- a/mercurial/commands.py	Thu Mar 22 23:52:50 2007 -0500
+++ b/mercurial/commands.py	Fri Mar 23 00:12:28 2007 -0500
@@ -2463,6 +2463,9 @@
         rev_ = nullid
         if not message:
             message = _('Removed tag %s') % name
+    elif name in repo.tags() and not opts['force']:
+        raise util.Abort(_('a tag named %s already exists (use -f to force)')
+                         % name)
     if not rev_ and repo.dirstate.parents()[1] != nullid:
         raise util.Abort(_('uncommitted merge - please provide a '
                            'specific revision'))
@@ -2955,7 +2958,8 @@
          _('hg status [OPTION]... [FILE]...')),
     "tag":
         (tag,
-         [('l', 'local', None, _('make the tag local')),
+         [('f', 'force', None, _('replace existing tag')),
+          ('l', 'local', None, _('make the tag local')),
           ('m', 'message', '', _('message for tag commit log entry')),
           ('d', 'date', '', _('record datecode as commit date')),
           ('u', 'user', '', _('record user as commiter')),