changeset 38518:cc3543c87de5

revlog: reuse 'descendant' implemention in 'isancestor' The two functions do the same thing, but one takes nodes while the other takes revs. Using one to implement the other make sense. We should probably cleanup the API at some point to avoid having so many similar functions. However, we focus on an efficient implementation for now.
author Boris Feld <boris.feld@octobus.net>
date Fri, 22 Jun 2018 00:07:22 +0100
parents 6db38c9d7e00
children 19076e2d62e7
files mercurial/revlog.py
diffstat 1 files changed, 2 insertions(+), 1 deletions(-) [+]
line wrap: on
line diff
--- a/mercurial/revlog.py	Fri Jun 22 00:05:20 2018 +0100
+++ b/mercurial/revlog.py	Fri Jun 22 00:07:22 2018 +0100
@@ -1404,7 +1404,8 @@
 
         The implementation of this is trivial but the use of
         commonancestorsheads is not."""
-        return a in self.commonancestorsheads(a, b)
+        a, b = self.rev(a), self.rev(b)
+        return self.descendant(a, b)
 
     def ancestor(self, a, b):
         """calculate the "best" common ancestor of nodes a and b"""