[PATCH 1 of 4] revlog: do inclusive descendant testing (API)

Paul Morelle paul.morelle at octobus.net
Sun Jul 1 06:38:39 UTC 2018


# HG changeset patch
# User Boris Feld <boris.feld at octobus.net>
# Date 1529621623 -3600
#      Thu Jun 21 23:53:43 2018 +0100
# Node ID c6a8430582d584770c873a3b6234750482b9b65e
# Parent  a0e185f104541858a0b049e1fb67c4d113930a9a
# EXP-Topic descendant
# Available At https://bitbucket.org/octobus/mercurial-devel/
#              hg pull https://bitbucket.org/octobus/mercurial-devel/ -r c6a8430582d5
revlog: do inclusive descendant testing (API)

In many other places, a revision is considered a descendant of itself.  We
update the behavior of `revlog.descendant()` to match this. (for example.
`revlog.isancestor` does inclusive testing).

No tests break, so it seems safe to do so.

This will make it easier to use a more efficient implementation in a later
changeset.

diff -r a0e185f10454 -r c6a8430582d5 mercurial/revlog.py
--- a/mercurial/revlog.py	Fri Feb 02 14:21:04 2018 -0800
+++ b/mercurial/revlog.py	Thu Jun 21 23:53:43 2018 +0100
@@ -1378,6 +1378,8 @@
     def descendant(self, start, end):
         if start == nullrev:
             return True
+        elif start == end:
+            return True
         for i in self.descendants([start]):
             if i == end:
                 return True


More information about the Mercurial-devel mailing list