diff hgext/mq.py @ 12879:da4a9ed369c8 stable

qnew: distinguish between existing file and directory (issue2464)
author Martin Geisler <mg@aragost.com>
date Fri, 29 Oct 2010 14:06:06 +0200
parents 1634287b6ab1
children de6a28ff5ffc f08df4d38442
line wrap: on
line diff
--- a/hgext/mq.py	Fri Oct 29 15:25:21 2010 +0200
+++ b/hgext/mq.py	Fri Oct 29 14:06:06 2010 +0200
@@ -821,7 +821,11 @@
         diffopts = self.diffopts({'git': opts.get('git')})
         self.check_reserved_name(patchfn)
         if os.path.exists(self.join(patchfn)):
-            raise util.Abort(_('patch "%s" already exists') % patchfn)
+            if os.path.isdir(self.join(patchfn)):
+                raise util.Abort(_('"%s" already exists as a directory')
+                                 % patchfn)
+            else:
+                raise util.Abort(_('patch "%s" already exists') % patchfn)
         if opts.get('include') or opts.get('exclude') or pats:
             match = cmdutil.match(repo, pats, opts)
             # detect missing files in pats