diff options
author | Mike Bayer <mike_mp@zzzcomputing.com> | 2014-11-22 11:49:20 -0500 |
---|---|---|
committer | Mike Bayer <mike_mp@zzzcomputing.com> | 2014-11-22 11:49:20 -0500 |
commit | 296c5160285500fd52973d327608410c6b4ebbdd (patch) | |
tree | 9ca8f3ddb95b8e13b948666315c46a60c13d7cdf /alembic/script.py | |
parent | 43bb4ec14aacc8e014d565f88876a32bc8a90428 (diff) | |
download | alembic-296c5160285500fd52973d327608410c6b4ebbdd.tar.gz |
- break out the concept of "down revision" into two pieces:
down_revision and "dependencies". For migration traversal, the downrevs
we care about are the union of these two sets. however for location of nodes
and branch labeling, we look only at down_revsion. this works really well
and allows us to have mutually-dependent trees that can easily be itererated
independently of each other. docs are needed
Diffstat (limited to 'alembic/script.py')
-rw-r--r-- | alembic/script.py | 22 |
1 files changed, 18 insertions, 4 deletions
diff --git a/alembic/script.py b/alembic/script.py index 1835605..2147652 100644 --- a/alembic/script.py +++ b/alembic/script.py @@ -483,7 +483,10 @@ class Script(revision.Revision): rev_id, module.down_revision, branch_labels=util.to_tuple( - getattr(module, 'branch_labels', None), default=())) + getattr(module, 'branch_labels', None), default=()), + dependencies=util.to_tuple( + getattr(module, 'depends_on', None), default=()) + ) module = None """The Python module representing the actual script itself.""" @@ -522,6 +525,10 @@ class Script(revision.Revision): else: entry += "Parent: %s\n" % (self._format_down_revision(), ) + if self.dependencies: + entry += "Depends on: %s\n" % ( + util.format_as_comma(self.dependencies)) + if self.is_branch_point: entry += "Branches into: %s\n" % ( util.format_as_comma(self.nextrev)) @@ -554,8 +561,15 @@ class Script(revision.Revision): include_parents=False, tree_indicators=True): text = self.revision if include_parents: - text = "%s -> %s" % ( - self._format_down_revision(), text) + if self.dependencies: + text = "%s (%s) -> %s" % ( + self._format_down_revision(), + util.format_as_comma(self.dependencies), + text + ) + else: + text = "%s -> %s" % ( + self._format_down_revision(), text) if include_branches and self.branch_labels: text += " (%s)" % util.format_as_comma(self.branch_labels) if tree_indicators: @@ -584,7 +598,7 @@ class Script(revision.Revision): if not self.down_revision: return "<base>" else: - return util.format_as_comma(self._down_revision_tuple) + return util.format_as_comma(self._versioned_down_revisions) @classmethod def _from_path(cls, scriptdir, path): |