From: Mike Bayer Date: Mon, 9 Feb 2015 00:27:42 +0000 (-0500) Subject: - additional fix which impacts #267. fix filtered_heads() to accommodate X-Git-Tag: rel_0_7_5~9 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=e8a0c740b17100e6e366a7484d58d5b26f68c094;p=thirdparty%2Fsqlalchemy%2Falembic.git - 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 --- 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):