[PATCH 1 of 3] mq: add '.' and '..' to list of forbidden patch names

Idan Kamara idankk86 at gmail.com
Fri Apr 29 14:32:43 CDT 2011


# HG changeset patch
# User Idan Kamara <idankk86 at gmail.com>
# Date 1304104873 -10800
# Node ID 4c3cbfdd055c611192b9bbed1086b4a78e3c42e8
# Parent  98f79a5c308665e1ce1b020bb66ed37f47f102e6
mq: add '.' and '..' to list of forbidden patch names

When an empty string is being passed to normname
it would return '.' causing checkfile() to always
return that a patch with that name exists.

diff -r 98f79a5c3086 -r 4c3cbfdd055c hgext/mq.py
--- a/hgext/mq.py	Tue Apr 26 10:51:19 2011 -0500
+++ b/hgext/mq.py	Fri Apr 29 22:21:13 2011 +0300
@@ -852,7 +852,7 @@
                 raise util.Abort(_("local changes found"))
         return m, a, r, d
 
-    _reserved = ('series', 'status', 'guards')
+    _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):
diff -r 98f79a5c3086 -r 4c3cbfdd055c tests/test-mq-qnew.t
--- a/tests/test-mq-qnew.t	Tue Apr 26 10:51:19 2011 -0500
+++ b/tests/test-mq-qnew.t	Fri Apr 29 22:21:13 2011 +0300
@@ -15,6 +15,8 @@
   >     hg qnew series
   >     hg qnew status
   >     hg qnew guards
+  >     hg qnew .
+  >     hg qnew ..
   >     hg qnew .hgignore
   >     hg qnew .mqfoo
   >     hg qnew 'foo#bar'
@@ -102,6 +104,8 @@
   abort: "series" cannot be used as the name of a patch
   abort: "status" cannot be used as the name of a patch
   abort: "guards" cannot be used as the name of a patch
+  abort: "." cannot be used as the name of a patch
+  abort: ".." cannot be used as the name of a patch
   abort: ".hgignore" cannot be used as the name of a patch
   abort: ".mqfoo" cannot be used as the name of a patch
   abort: "foo#bar" cannot be used as the name of a patch
@@ -167,6 +171,8 @@
   abort: "series" cannot be used as the name of a patch
   abort: "status" cannot be used as the name of a patch
   abort: "guards" cannot be used as the name of a patch
+  abort: "." cannot be used as the name of a patch
+  abort: ".." cannot be used as the name of a patch
   abort: ".hgignore" cannot be used as the name of a patch
   abort: ".mqfoo" cannot be used as the name of a patch
   abort: "foo#bar" cannot be used as the name of a patch


More information about the Mercurial-devel mailing list