Changeset - d1b07a8b2b00
[Not reviewed]
default
0 2 0
Manuel Jacob - 7 years ago 2019-02-18 23:58:33
me@manueljacob.de
hg: make `successors` property of MercurialChangeset compatible with newer versions of Mercurial.
2 files changed with 4 insertions and 1 deletions:
0 comments (0 inline, 0 general)
kallithea/lib/vcs/backends/hg/changeset.py
Show inline comments
 
@@ -85,12 +85,16 @@ class MercurialChangeset(BaseChangeset):
 
            return 'Secret'
 
        else:
 
            return ''
 

	
 
    @LazyProperty
 
    def successors(self):
 
        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)
 
            successors = [hex(n)[:12] for sub in successors for n in sub if n != self._ctx.node()]
 

	
kallithea/tests/vcs/test_hg.py
Show inline comments
 
@@ -582,13 +582,12 @@ class TestMercurialChangeset(object):
 

	
 
    def test_author_username(self):
 
        assert 'Marcin Kuzminski' == self.repo.get_changeset('b986218ba1c9').author_name
 
        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 == []
 

	
 
    @pytest.mark.xfail
 
    def test_predecessors(self):
0 comments (0 inline, 0 general)