diff mercurial/commands.py @ 5657:47915bf68c44

Properly check tag's existence as a local/global tag when removing it.
author Osku Salerma <osku@iki.fi>
date Sun, 09 Dec 2007 16:32:05 +0900
parents 7e6ddde68a23
children ae3089cefaab
line wrap: on
line diff
--- a/mercurial/commands.py	Tue Dec 18 14:01:34 2007 -0600
+++ b/mercurial/commands.py	Sun Dec 09 16:32:05 2007 +0900
@@ -2428,8 +2428,15 @@
         rev_ = opts['rev']
     message = opts['message']
     if opts['remove']:
-        if not name in repo.tags():
+        tagtype = repo.tagtype(name)
+
+        if not tagtype:
             raise util.Abort(_('tag %s does not exist') % name)
+        if opts['local'] and tagtype == 'global':
+           raise util.Abort(_('%s tag is global') % name)
+        if not opts['local'] and tagtype == 'local':
+           raise util.Abort(_('%s tag is local') % name)
+
         rev_ = nullid
         if not message:
             message = _('Removed tag %s') % name