diff hgext/mq.py @ 14054:3c616f512a5b

mq: be more explicit on invalid patch name message
author Idan Kamara <idankk86@gmail.com>
date Fri, 29 Apr 2011 22:21:13 +0300
parents ecaa78594983
children 135e244776f0
line wrap: on
line diff
--- a/hgext/mq.py	Sat Apr 30 11:16:52 2011 +0200
+++ b/hgext/mq.py	Fri Apr 29 22:21:13 2011 +0300
@@ -854,10 +854,18 @@
 
     _reserved = ('series', 'status', 'guards', '.', '..')
     def check_reserved_name(self, name):
-        if (name in self._reserved or name.startswith('.hg')
-            or name.startswith('.mq') or '#' in name or ':' in name):
+        if name in self._reserved:
             raise util.Abort(_('"%s" cannot be used as the name of a patch')
                              % name)
+        for prefix in ('.hg', '.mq'):
+            if name.startswith(prefix):
+                raise util.Abort(_('patch name cannot begin with "%s"')
+                                 % prefix)
+        for c in ('#', ':'):
+            if c in name:
+                raise util.Abort(_('"%s" cannot be used in the name of a patch')
+                                 % c)
+
 
     def new(self, repo, patchfn, *pats, **opts):
         """options: