[PATCH 5 of 6] changeset: add precursors method for hg backend

Andrew Shadura andrew at shadura.me
Tue Jul 28 11:02:41 UTC 2015


# HG changeset patch
# User Sean Farley <sean.michael.farley at gmail.com>
# Date 1406666807 18000
#      Tue Jul 29 15:46:47 2014 -0500
# Node ID bb64b9c238e026bf84287851f22e2977575d0dc5
# Parent  28e4930d9bc2593c6e2b43629dc8b1f9122a7a5e
changeset: add precursors method for hg backend

diff --git a/kallithea/lib/vcs/backends/hg/changeset.py b/kallithea/lib/vcs/backends/hg/changeset.py
--- a/kallithea/lib/vcs/backends/hg/changeset.py
+++ b/kallithea/lib/vcs/backends/hg/changeset.py
@@ -58,6 +58,16 @@ class MercurialChangeset(BaseChangeset):
         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())
 


More information about the kallithea-general mailing list