From 1684d0ee89c0fc6b0b90bc5db614468b31119e9d Mon Sep 17 00:00:00 2001 From: CaselIT Date: Mon, 2 May 2022 22:53:39 +0200 Subject: Fix downgrade with effective head Fixed issue where downgrade using a relative revision would fail in case of multiple branches with a single effectively head due to interdependencies between revisions. Fixes: #1026 Change-Id: I79f5595fb9d03124db8039345055571a9134eecd --- tests/test_revision.py | 44 ++++++++++++++++++++++++++++++++++++++++---- 1 file changed, 40 insertions(+), 4 deletions(-) (limited to 'tests') diff --git a/tests/test_revision.py b/tests/test_revision.py index 61998bf..0d5bfd5 100644 --- a/tests/test_revision.py +++ b/tests/test_revision.py @@ -239,10 +239,7 @@ class DownIterateTest(TestBase): edges, list(reversed(result)) ) - eq_( - result, - assertion, - ) + eq_(result, assertion) class DiamondTest(DownIterateTest): @@ -573,6 +570,45 @@ class MultipleBranchTest(DownIterateTest): ) +class MultipleBranchEffectiveHead(DownIterateTest): + def setUp(self): + self.map = RevisionMap( + lambda: [ + Revision("y1", None, branch_labels="y"), + Revision("x1", None, branch_labels="x"), + Revision("y2", "y1", dependencies="x1"), + Revision("x2", "x1"), + ] + ) + + def test_other_downgrade(self): + self._assert_iteration( + ("x2", "y2"), + "x@-1", + ["x2"], + inclusive=False, + select_for_downgrade=True, + ) + + def test_use_all_current(self): + self._assert_iteration( + ("x1", "y2"), + "x@-1", + ["y2", "x1"], + inclusive=False, + select_for_downgrade=True, + ) + + def test_effective_head(self): + self._assert_iteration( + "y2", + "x@-1", + ["y2", "x1"], + inclusive=False, + select_for_downgrade=True, + ) + + class BranchTravellingTest(DownIterateTest): """test the order of revs when going along multiple branches. -- cgit v1.2.1