]> git.ipfire.org Git - thirdparty/sqlalchemy/alembic.git/commitdiff
Add + to illegal revision characters list
authorMike Bayer <mike_mp@zzzcomputing.com>
Sat, 16 Sep 2017 00:25:43 +0000 (20:25 -0400)
committerMike Bayer <mike_mp@zzzcomputing.com>
Sat, 16 Sep 2017 00:25:43 +0000 (20:25 -0400)
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
alembic/script/revision.py
docs/build/unreleased/441.rst [new file with mode: 0644]
tests/test_script_production.py

index 7e25a86574da6d83f61c96b49c670185ef586fab..1e68a7c3c4abe4997f1c91b0ff8c05a532881a39 100644 (file)
@@ -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 (file)
index 0000000..9bacef8
--- /dev/null
@@ -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
index dca06ac9ff4bdc6d526c668f1e4c5902976fddc0..588b9d1ff50eb634541d7d6868f7e9932a1eaa94 100644 (file)
@@ -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")