From: Charles-Axel Dein Date: Mon, 11 Mar 2013 01:54:29 +0000 (-0700) Subject: Add head identifier to --head-only option output X-Git-Tag: rel_0_5_0~16^2~1 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=6b0adc933ac29e0bd41bdfd0283a191b2473c9f8;p=thirdparty%2Fsqlalchemy%2Falembic.git Add head identifier to --head-only option output --- diff --git a/alembic/command.py b/alembic/command.py index d326943d..35a4eae3 100644 --- a/alembic/command.py +++ b/alembic/command.py @@ -177,7 +177,9 @@ def current(config, head_only=False): rev = script.get_revision(rev) if head_only: - config.print_stdout(str(rev.revision)) + config.print_stdout("%s%s" % ( + rev.revision, + " (head)" if rev.is_head else "")) else: config.print_stdout("Current revision for %s: %s", diff --git a/alembic/config.py b/alembic/config.py index ca233e16..3c51024e 100644 --- a/alembic/config.py +++ b/alembic/config.py @@ -196,7 +196,8 @@ class CommandLine(object): if 'head_only' in kwargs: parser.add_argument("--head-only", action="store_true", - help="Only show head version") + help="Only show current version and " + "wheter or not this is the head revision.") positional_help = { 'directory': "location of scripts directory", diff --git a/docs/build/tutorial.rst b/docs/build/tutorial.rst index a90209a8..100f71d6 100644 --- a/docs/build/tutorial.rst +++ b/docs/build/tutorial.rst @@ -384,6 +384,8 @@ First we can view the current revision:: INFO [alembic.context] Will assume transactional DDL. Current revision for postgresql://scott:XXXXX@localhost/test: 1975ea83b712 -> ae1027a6acf (head), Add a column +``head`` is deplayed if the revision identifier for this database matches the head revision. + We can also view history:: $ alembic history