# HG changeset patch # User Benjamin Pollack # Date 2010-07-27 18:40:25 # Node ID 52e4ac3e63f780114c5b7613fe0643b305d09789 # Parent f5aa20e177c0b2a206e2a40c25ad111e2573dd09 tag: do not allow tag names to consist solely of whitespace (issue2307) (simplification and test by mpm) diff --git a/mercurial/commands.py b/mercurial/commands.py --- a/mercurial/commands.py +++ b/mercurial/commands.py @@ -3660,6 +3660,8 @@ def tag(ui, repo, name1, *names, **opts) 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'): diff --git a/tests/test-tag b/tests/test-tag --- a/tests/test-tag +++ b/tests/test-tag @@ -7,6 +7,9 @@ echo a > a hg add a hg commit -m "test" -d "1000000 0" hg history + +hg tag ' ' + hg tag -d "1000000 0" "bleah" hg history diff --git a/tests/test-tag.out b/tests/test-tag.out --- a/tests/test-tag.out +++ b/tests/test-tag.out @@ -4,6 +4,7 @@ user: test 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