From e8a0c740b17100e6e366a7484d58d5b26f68c094 Mon Sep 17 00:00:00 2001 From: Mike Bayer Date: Sun, 8 Feb 2015 19:27:42 -0500 Subject: [PATCH] - additional fix which impacts #267. fix filtered_heads() to accommodate being given "heads" as the target so that it will in fact match when all heads are given. fixes #267 --- alembic/revision.py | 4 +--- tests/test_revision.py | 9 +++++++++ tests/test_version_traversal.py | 5 +++++ 3 files changed, 15 insertions(+), 3 deletions(-) diff --git a/alembic/revision.py b/alembic/revision.py index a1149ea3..4eea5145 100644 --- a/alembic/revision.py +++ b/alembic/revision.py @@ -353,9 +353,7 @@ class RevisionMap(object): if branch_label: shares.append(branch_label) if id_: - shares.append(id_[0]) - - #shares = branch_label or (id_[0] if id_ else None) + shares.extend(id_) return [ tg for tg in targets diff --git a/tests/test_revision.py b/tests/test_revision.py index cc91322c..d73316d8 100644 --- a/tests/test_revision.py +++ b/tests/test_revision.py @@ -181,6 +181,15 @@ class LabeledBranchTest(DownIterateTest): [c1, c2, d] ) + def test_filter_for_lineage_heads(self): + eq_( + self.map.filter_for_lineage( + [self.map.get_revision("f")], + "heads" + ), + [self.map.get_revision("f")] + ) + def setUp(self): self.map = RevisionMap(lambda: [ Revision('a', (), branch_labels='abranch'), diff --git a/tests/test_version_traversal.py b/tests/test_version_traversal.py index 4d9926d7..410995e1 100644 --- a/tests/test_version_traversal.py +++ b/tests/test_version_traversal.py @@ -576,6 +576,11 @@ class ForestTest(MigrationTest): set([(self.b1.revision,), (self.b2.revision,)]) ) + def test_stamp_to_heads_no_moves_needed(self): + revs = self.env._stamp_revs( + "heads", (self.b1.revision, self.b2.revision)) + eq_(len(revs), 0) + class MergedPathTest(MigrationTest): -- 2.47.2