Disallow ':' character in custom revision identifiers. Previously, using a
colon in a revision ID (e.g., 'REV:1') would create the revision, however
revisions with colons in them are not correctly interpreted by other
commands, as it overlaps with the revision range syntax. Pull request
courtesy Kim Wooseok with original implementation by Hrushikesh Patil.
Fixes: #1540
Closes: #1741
Pull-request: https://github.com/sqlalchemy/alembic/pull/1741
Pull-request-sha:
3894b1f9a1b1685a01465f53886af9086e23d079
Change-Id: Ie935f0e04981a0b3d0ac8a2ac03ffebce898280a
_TR = TypeVar("_TR", bound=Optional[_RevisionOrStr])
_relative_destination = re.compile(r"(?:(.+?)@)?(\w+)?((?:\+|-)\d+)")
-_revision_illegal_chars = ["@", "-", "+"]
+_revision_illegal_chars = ["@", "-", "+", ":"]
class _CollectRevisionsProtocol(Protocol):
--- /dev/null
+.. change::
+ :tags: bug, commands
+ :tickets: 1540
+
+ Disallow ':' character in custom revision identifiers. Previously, using a
+ colon in a revision ID (e.g., 'REV:1') would create the revision, however
+ revisions with colons in them are not correctly interpreted by other
+ commands, as it overlaps with the revision range syntax. Pull request
+ courtesy Kim Wooseok with original implementation by Hrushikesh Patil.
\ No newline at end of file
rev_id="no@atsigns",
)
+ assert_raises_message(
+ util.CommandError,
+ r"Character\(s\) ':' not allowed in "
+ "revision identifier 'no:colons'",
+ command.revision,
+ self.cfg,
+ message="some message",
+ rev_id="no:colons",
+ )
+
assert_raises_message(
util.CommandError,
r"Character\(s\) '-, @' not allowed in revision "