Patchwork [2,of,2] revlog: reintroduce `revlog.descendant` as deprecated

login
register
mail settings
Submitter Boris Feld
Date July 16, 2018, 4:30 p.m.
Message ID <52aa3f0c736e48779c3f.1531758617@FB-lair>
Download mbox | patch
Permalink /patch/32865/
State Accepted
Headers show

Comments

Boris Feld - July 16, 2018, 4:30 p.m.
# HG changeset patch
# User Boris Feld <boris.feld@octobus.net>
# Date 1531750963 -7200
#      Mon Jul 16 16:22:43 2018 +0200
# Node ID 52aa3f0c736e48779c3f0ef4ee54545dd73576b7
# Parent  94a6a0ef74f6e52cbb26e3461df2f155ab873039
# EXP-Topic deprecate-descendant
# Available At https://bitbucket.org/octobus/mercurial-devel/
#              hg pull https://bitbucket.org/octobus/mercurial-devel/ -r 52aa3f0c736e
revlog: reintroduce `revlog.descendant` as deprecated

Reintroduce `revlog.descendant` to help extensions authors update their
extensions in order to use the new API.
Yuya Nishihara - July 17, 2018, 11:47 a.m.
On Mon, 16 Jul 2018 18:30:17 +0200, Boris Feld wrote:
> # HG changeset patch
> # User Boris Feld <boris.feld@octobus.net>
> # Date 1531750963 -7200
> #      Mon Jul 16 16:22:43 2018 +0200
> # Node ID 52aa3f0c736e48779c3f0ef4ee54545dd73576b7
> # Parent  94a6a0ef74f6e52cbb26e3461df2f155ab873039
> # EXP-Topic deprecate-descendant
> # Available At https://bitbucket.org/octobus/mercurial-devel/
> #              hg pull https://bitbucket.org/octobus/mercurial-devel/ -r 52aa3f0c736e
> revlog: reintroduce `revlog.descendant` as deprecated

> +    def descendant(self, a, b):
> +        msg = (b'revlog.descendant is deprecated, use revlog.isancestorrev')
> +        self._repo.ui.deprecwarn(msg, b'4.7')
> +        return self.isancestorrev(a, b)

This appears to be ninja queued, but wouldn't work since revlog has no
self._repo.

Patch

diff --git a/mercurial/revlog.py b/mercurial/revlog.py
--- a/mercurial/revlog.py
+++ b/mercurial/revlog.py
@@ -1666,6 +1666,11 @@  class revlog(object):
         a, b = self.rev(a), self.rev(b)
         return self.isancestorrev(a, b)
 
+    def descendant(self, a, b):
+        msg = (b'revlog.descendant is deprecated, use revlog.isancestorrev')
+        self._repo.ui.deprecwarn(msg, b'4.7')
+        return self.isancestorrev(a, b)
+
     def isancestorrev(self, a, b):
         """return True if revision a is an ancestor of revision b