# HG changeset patch # User Sean Farley # Date 1405392766 18000 # Node ID 2978928a95ea7cc1d16031e4c394c8dc1fcfafdb # Parent 46d42b34cf3ee43b210596b5d3657d70d6e5cb56 changeset: add successors method for hg backend diff -r 46d42b34cf3e -r 2978928a95ea kallithea/lib/vcs/backends/hg/changeset.py --- a/kallithea/lib/vcs/backends/hg/changeset.py Wed Jul 09 14:09:19 2014 -0500 +++ b/kallithea/lib/vcs/backends/hg/changeset.py Mon Jul 14 21:52:46 2014 -0500 @@ -16,6 +16,7 @@ from kallithea.lib.vcs.utils.paths import get_dirs_for_path from kallithea.lib.vcs.utils.hgcompat import archival, hex +from mercurial import obsolete class MercurialChangeset(BaseChangeset): """ @@ -47,6 +48,16 @@ return self._ctx.obsolete() @LazyProperty + def successors(self): + 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()] + + return successors + + @LazyProperty def bookmarks(self): return map(safe_unicode, self._ctx.bookmarks())