From: Mike Bayer Date: Sat, 16 Sep 2017 00:25:43 +0000 (-0400) Subject: Add + to illegal revision characters list X-Git-Tag: rel_0_9_6~10 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=b6a0ba0164b2d2d786ec2e3b5e06349018897f0f;p=thirdparty%2Fsqlalchemy%2Falembic.git Add + to illegal revision characters list An addition to :ticket:`441` fixed in 0.9.5, we forgot to also filter for the ``+`` sign in migration names which also breaks due to the relative migrations feature. Change-Id: I94d3882e84ba13e7569b47230dc9422a8ac6408c Fixes: #445 --- diff --git a/alembic/script/revision.py b/alembic/script/revision.py index 7e25a865..1e68a7c3 100644 --- a/alembic/script/revision.py +++ b/alembic/script/revision.py @@ -6,7 +6,7 @@ from sqlalchemy import util as sqlautil from ..util import compat _relative_destination = re.compile(r'(?:(.+?)@)?(\w+)?((?:\+|-)\d+)') -_revision_illegal_chars = ['@', '-'] +_revision_illegal_chars = ['@', '-', '+'] class RevisionError(Exception): diff --git a/docs/build/unreleased/441.rst b/docs/build/unreleased/441.rst new file mode 100644 index 00000000..9bacef81 --- /dev/null +++ b/docs/build/unreleased/441.rst @@ -0,0 +1,7 @@ +.. change:: + :tags: bug, commands + :tickets: 441 + + An addition to :ticket:`441` fixed in 0.9.5, we forgot to also filter + for the ``+`` sign in migration names which also breaks due to the relative + migrations feature. \ No newline at end of file diff --git a/tests/test_script_production.py b/tests/test_script_production.py index dca06ac9..588b9d1f 100644 --- a/tests/test_script_production.py +++ b/tests/test_script_production.py @@ -292,6 +292,14 @@ class RevisionCommandTest(TestBase): self.cfg, message="some message", rev_id="no@atsigns-ordashes" ) + assert_raises_message( + util.CommandError, + r"Character\(s\) '\+' not allowed in revision " + r"identifier 'no\+plussignseither'", + command.revision, + self.cfg, message="some message", rev_id="no+plussignseither" + ) + def test_create_script_branches(self): rev = command.revision( self.cfg, message="some message", branch_label="foobar")