diff options
author | Mike Bayer <mike_mp@zzzcomputing.com> | 2013-04-14 18:47:09 -0400 |
---|---|---|
committer | Mike Bayer <mike_mp@zzzcomputing.com> | 2013-04-14 18:47:09 -0400 |
commit | 7f1fe62c0827099a433e9a7df3378f6eb6b7bd62 (patch) | |
tree | 9f913a262018bb66cf439901f9312f429d533c11 /alembic/script.py | |
parent | c27e9ef22c56ad6608e661fcc63e32452eaa6e64 (diff) | |
download | alembic-7f1fe62c0827099a433e9a7df3378f6eb6b7bd62.tar.gz |
- rework the -r flag on history to make use of existing walk_revisions();
this way we get at relative revisions, error handling, etc.
- don't run environment for history command unless "current" was requested;
running the environment modifies output with logging, might access multiple
dbs, etc., so don't get into it if not needed
- add test suite for commands, start with history output
- document/changelog for history -r feature
- fix sys.stdout writing for py3k
- one more with_statement future not needed
Diffstat (limited to 'alembic/script.py')
-rw-r--r-- | alembic/script.py | 10 |
1 files changed, 6 insertions, 4 deletions
diff --git a/alembic/script.py b/alembic/script.py index 229407b..637a749 100644 --- a/alembic/script.py +++ b/alembic/script.py @@ -56,20 +56,22 @@ class ScriptDirectory(object): "found in configuration.") return ScriptDirectory( util.coerce_resource_to_filename(script_location), - file_template = config.get_main_option( + file_template=config.get_main_option( 'file_template', _default_file_template) ) - def walk_revisions(self): + def walk_revisions(self, base="base", head="head"): """Iterate through all revisions. This is actually a breadth-first tree traversal, with leaf nodes being heads. """ - heads = set(self.get_heads()) - base = self.get_revision("base") + if head == "head": + heads = set(self.get_heads()) + else: + heads = set([head]) while heads: todo = set(heads) heads = set() |