summaryrefslogtreecommitdiff
path: root/alembic/command.py
diff options
context:
space:
mode:
authorThomas Bechtold <tbechtold@suse.com>2019-09-24 10:27:03 -0400
committerMike Bayer <mike_mp@zzzcomputing.com>2019-09-24 11:42:40 -0400
commit310017f4acafaab750d8fdfbf3eec0007962dfc1 (patch)
tree24fa65fea163fca066985e5e6a2cea8c222718bc /alembic/command.py
parent68ca631575a812f4f36e7521f11f4f351833282d (diff)
downloadalembic-310017f4acafaab750d8fdfbf3eec0007962dfc1.tar.gz
Revert alembic.stamp "revisions" to "revision"
Reverted the name change of the "revisions" argument to :func:`.command.stamp` to "revision" as apparently applications are calling upon this argument as a keyword name. Pull request courtesy Thomas Bechtold. Special translations are also added to the command line interface so that it is still known as "revisions" in the CLI. Co-authored-by: Mike Bayer <mike_mp@zzzcomputing.com> Fixes: #601 Closes: #602 Pull-request: https://github.com/sqlalchemy/alembic/pull/602 Pull-request-sha: 4126635e272f82ec53d630bb77c00cb6ff42cec9 Change-Id: I4312954bedc42bb4b76656a70c95b2b7280efae7
Diffstat (limited to 'alembic/command.py')
-rw-r--r--alembic/command.py21
1 files changed, 14 insertions, 7 deletions
diff --git a/alembic/command.py b/alembic/command.py
index d4acfdb..7d19e3c 100644
--- a/alembic/command.py
+++ b/alembic/command.py
@@ -515,13 +515,20 @@ def current(config, verbose=False, head_only=False):
script.run_env()
-def stamp(config, revisions, sql=False, tag=None, purge=False):
+def stamp(config, revision, sql=False, tag=None, purge=False):
"""'stamp' the revision table with the given revision; don't
run any migrations.
:param config: a :class:`.Config` instance.
- :param revision: target revision.
+ :param revision: target revision or list of revisions. May be a list
+ to indicate stamping of multiple branch heads.
+
+ .. note:: this parameter is called "revisions" in the command line
+ interface.
+
+ .. versionchanged:: 1.2 The revision may be a single revision or
+ list of revisions when stamping multiple branch heads.
:param sql: use ``--sql`` mode
@@ -540,9 +547,9 @@ def stamp(config, revisions, sql=False, tag=None, purge=False):
if sql:
destination_revs = []
starting_rev = None
- for revision in util.to_list(revisions):
- if ":" in revision:
- srev, revision = revision.split(":", 2)
+ for _revision in util.to_list(revision):
+ if ":" in _revision:
+ srev, _revision = _revision.split(":", 2)
if starting_rev != srev:
if starting_rev is None:
@@ -552,9 +559,9 @@ def stamp(config, revisions, sql=False, tag=None, purge=False):
"Stamp operation with --sql only supports a "
"single starting revision at a time"
)
- destination_revs.append(revision)
+ destination_revs.append(_revision)
else:
- destination_revs = util.to_list(revisions)
+ destination_revs = util.to_list(revision)
def do_stamp(rev, context):
return script._stamp_revs(util.to_tuple(destination_revs), rev)