hgext/mq.py
changeset 14422 2e77525e52d9
parent 14396 170747a3e139
child 14423 7230aef66b7c
--- a/hgext/mq.py	Tue May 24 13:30:10 2011 -0500
+++ b/hgext/mq.py	Tue May 24 19:16:51 2011 +0300
@@ -873,6 +873,14 @@
                 raise util.Abort(_('"%s" cannot be used in the name of a patch')
                                  % c)
 
+    def checkpatchname(self, name, force=False):
+        self.check_reserved_name(name)
+        if not force and os.path.exists(self.join(name)):
+            if os.path.isdir(self.join(name)):
+                raise util.Abort(_('"%s" already exists as a directory')
+                                 % name)
+            else:
+                raise util.Abort(_('patch "%s" already exists') % name)
 
     def new(self, repo, patchfn, *pats, **opts):
         """options: