changeset 7532:d1b07a8b2b00

hg: make `successors` property of MercurialChangeset compatible with newer versions of Mercurial.
author Manuel Jacob <me@manueljacob.de>
date Mon, 18 Feb 2019 23:58:33 +0100
parents 56e456117510
children 346b97cf1aaa
files kallithea/lib/vcs/backends/hg/changeset.py kallithea/tests/vcs/test_hg.py
diffstat 2 files changed, 5 insertions(+), 2 deletions(-) [+]
line wrap: on
line diff
--- a/kallithea/lib/vcs/backends/hg/changeset.py	Mon Feb 18 23:55:07 2019 +0100
+++ b/kallithea/lib/vcs/backends/hg/changeset.py	Mon Feb 18 23:58:33 2019 +0100
@@ -88,7 +88,11 @@
 
     @LazyProperty
     def successors(self):
-        successors = obsolete.successorssets(self._ctx._repo, self._ctx.node())
+        try:
+            from mercurial import obsutil
+            successors = obsutil.successorssets(self._ctx._repo, self._ctx.node())
+        except ImportError:  # moved in Mercurial 4.3 (4f49810a1011)
+            successors = obsolete.successorssets(self._ctx._repo, self._ctx.node())
         if successors:
             # flatten the list here handles both divergent (len > 1)
             # and the usual case (len = 1)
--- a/kallithea/tests/vcs/test_hg.py	Mon Feb 18 23:55:07 2019 +0100
+++ b/kallithea/tests/vcs/test_hg.py	Mon Feb 18 23:58:33 2019 +0100
@@ -585,7 +585,6 @@
         assert 'Lukasz Balcerzak' == self.repo.get_changeset('3803844fdbd3').author_name
         assert 'marcink' == self.repo.get_changeset('84478366594b').author_name
 
-    @pytest.mark.xfail
     def test_successors(self):
         init_chset = self.repo.get_changeset(0)
         assert init_chset.successors == []