]> git.ipfire.org Git - thirdparty/sqlalchemy/alembic.git/commitdiff
- additional fix which impacts #267. fix filtered_heads() to accommodate
authorMike Bayer <mike_mp@zzzcomputing.com>
Mon, 9 Feb 2015 00:27:42 +0000 (19:27 -0500)
committerMike Bayer <mike_mp@zzzcomputing.com>
Mon, 9 Feb 2015 00:28:59 +0000 (19:28 -0500)
being given "heads" as the target so that it will in fact match when all heads
are given.  fixes #267

alembic/revision.py
tests/test_revision.py
tests/test_version_traversal.py

index a1149ea3ebe84de69968ca45b5dc9328069573ae..4eea5145b1f6ee581afb8f4d4bf1629ba804b12d 100644 (file)
@@ -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
index cc91322c9f57392b95aec49b1abd68e585923fbd..d73316d8cc60b9d9e1d19084ea399a2bd932025c 100644 (file)
@@ -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'),
index 4d9926d759eb4b8aa645daf002bcfdba57840f7b..410995e1bc2e200bce2772923a52f457c5245928 100644 (file)
@@ -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):