]> git.ipfire.org Git - thirdparty/sqlalchemy/alembic.git/commitdiff
Add head identifier to --head-only option output
authorCharles-Axel Dein <ca@d3in.org>
Mon, 11 Mar 2013 01:54:29 +0000 (18:54 -0700)
committerCharles-Axel Dein <ca@d3in.org>
Mon, 11 Mar 2013 01:54:29 +0000 (18:54 -0700)
alembic/command.py
alembic/config.py
docs/build/tutorial.rst

index d326943d21b3c6e60e305073b5f8bd287e1bc4f3..35a4eae3a044bad8b973ab230b3389714dcbf5fa 100644 (file)
@@ -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",
index ca233e16df7238eb13123bc59d9ae38586fa5d8b..3c51024ec3f26c4357ca9f9d94eaf220104d9904 100644 (file)
@@ -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",
index a90209a8aef9d0197053b8c78e000f2a7323931d..100f71d63ae009f08ca9eef0d101ab9612a140b3 100644 (file)
@@ -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