context: reintroduce `ctx.descendant` as deprecated
authorBoris Feld <boris.feld@octobus.net>
Mon, 16 Jul 2018 16:21:12 +0200
changeset 38709 6a032a8f741b
parent 38708 ff1182d166a2
child 38710 4ac3c2078567
context: reintroduce `ctx.descendant` as deprecated Reintroduce `ctx.descendant` to help extensions authors update their extensions in order to use the new API.
mercurial/context.py
--- a/mercurial/context.py	Sun Jul 15 18:32:17 2018 +0900
+++ b/mercurial/context.py	Mon Jul 16 16:21:12 2018 +0200
@@ -589,6 +589,12 @@
                             short(n) for n in sorted(cahs) if n != anc))
         return changectx(self._repo, anc)
 
+    def descendant(self, other):
+        msg = (b'ctx.descendant(other) is deprecated, '
+               'use ctx.isancestorof(other)')
+        self._repo.ui.deprecwarn(msg, b'4.7')
+        return self.isancestorof(other)
+
     def isancestorof(self, other):
         """True if this changeset is an ancestor of other"""
         return self._repo.changelog.isancestorrev(self._rev, other._rev)