changeset 5351:78907d9989d6

changeset: add precursors method for hg backend
author Sean Farley <sean.michael.farley@gmail.com>
date Tue, 29 Jul 2014 15:46:47 -0500
parents 8737030a9550
children 1cdfd54a9c8f
files kallithea/lib/vcs/backends/hg/changeset.py
diffstat 1 files changed, 10 insertions(+), 0 deletions(-) [+]
line wrap: on
line diff
--- a/kallithea/lib/vcs/backends/hg/changeset.py	Tue Jul 29 16:15:50 2014 -0500
+++ b/kallithea/lib/vcs/backends/hg/changeset.py	Tue Jul 29 15:46:47 2014 -0500
@@ -58,6 +58,16 @@
         return successors
 
     @LazyProperty
+    def precursors(self):
+        precursors = set()
+        nm = self._ctx._repo.changelog.nodemap
+        for p in self._ctx._repo.obsstore.precursors.get(self._ctx.node(), ()):
+            pr = nm.get(p[0])
+            if pr is not None:
+                precursors.add(hex(p[0])[:12])
+        return precursors
+
+    @LazyProperty
     def bookmarks(self):
         return map(safe_unicode, self._ctx.bookmarks())