tag: do not allow tag names to consist solely of whitespace (issue2307) stable
authorBenjamin Pollack <benjamin@bitquabit.com>
Tue, 27 Jul 2010 14:40:25 -0400
branchstable
changeset 11692 52e4ac3e63f7
parent 11678 f5aa20e177c0
child 11697 efcdf6a953a0
child 11710 58a038605a2b
tag: do not allow tag names to consist solely of whitespace (issue2307) (simplification and test by mpm)
mercurial/commands.py
tests/test-tag
tests/test-tag.out
--- a/mercurial/commands.py	Sun Jul 25 20:01:33 2010 -0500
+++ b/mercurial/commands.py	Tue Jul 27 14:40:25 2010 -0400
@@ -3660,6 +3660,8 @@
     for n in names:
         if n in ['tip', '.', 'null']:
             raise util.Abort(_('the name \'%s\' is reserved') % n)
+        if not n:
+            raise util.Abort(_('tag names cannot consist entirely of whitespace'))
     if opts.get('rev') and opts.get('remove'):
         raise util.Abort(_("--rev and --remove are incompatible"))
     if opts.get('rev'):
--- a/tests/test-tag	Sun Jul 25 20:01:33 2010 -0500
+++ b/tests/test-tag	Tue Jul 27 14:40:25 2010 -0400
@@ -7,6 +7,9 @@
 hg add a
 hg commit -m "test" -d "1000000 0"
 hg history
+
+hg tag ' '
+
 hg tag -d "1000000 0" "bleah"
 hg history
 
--- a/tests/test-tag.out	Sun Jul 25 20:01:33 2010 -0500
+++ b/tests/test-tag.out	Tue Jul 27 14:40:25 2010 -0400
@@ -4,6 +4,7 @@
 date:        Mon Jan 12 13:46:40 1970 +0000
 summary:     test
 
+abort: tag names cannot consist entirely of whitespace
 changeset:   1:3ecf002a1c57
 tag:         tip
 user:        test