# HG changeset patch
# User Wagner Bruna <wbr...@softwareexpress.com.br>
# Date 1266613845 7200
# Branch stable
# Node ID 2c2fd8648cbae10fba896dcc471d0c299144f3e5
# Parent  fd5a42da5ce6af797d66fa3e8820f7816920a3db
tagadd: check for matching tag type when removing

diff --git a/tortoisehg/hgtk/tagadd.py b/tortoisehg/hgtk/tagadd.py
--- a/tortoisehg/hgtk/tagadd.py
+++ b/tortoisehg/hgtk/tagadd.py
@@ -292,12 +292,20 @@
 
     def remove_hg_tag(self, name, message, local, user=None, date=None,
                     english=False):
-        if hglib.fromutf(name) not in self.repo.tags():
-            raise util.Abort(_("Tag '%s' does not exist") % name)
+        lname = hglib.fromutf(name)
+
+        tagtype = self.repo.tagtype(lname)
+        if not tagtype:
+            raise util.Abort(_('tag \'%s\' does not exist') % lname)
+        if local:
+            if tagtype != 'local':
+                raise util.Abort(_('tag \'%s\' is not a local tag') % lname)
+        else:
+            if tagtype != 'global':
+                raise util.Abort(_('tag \'%s\' is not a global tag') % lname)
 
         if not message:
             msgset = keep._('Removed tag %s')
             message = (english and msgset['id'] or msgset['str']) % name
         r = self.repo[-1].node()
-        lname = hglib.fromutf(name)
         self.repo.tag(lname, r, hglib.fromutf(message), local, user, date)

------------------------------------------------------------------------------
Download Intel&#174; Parallel Studio Eval
Try the new software tools for yourself. Speed compiling, find bugs
proactively, and fine-tune applications for parallel performance.
See why Intel Parallel Studio got high marks during beta.
http://p.sf.net/sfu/intel-sw-dev
_______________________________________________
Tortoisehg-develop mailing list
Tortoisehg-develop@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/tortoisehg-develop

Reply via email to