repoview: fix changelog.__contains__ method
authorPierre-Yves David <pierre-yves.david@octobus.net>
Sun, 25 Feb 2024 23:05:33 +0100
changeset 51458 ec8c1d0f6d48
parent 51457 c0d51565b501
child 51459 077d5a784c58
repoview: fix changelog.__contains__ method This have been around for ten years, so we can safely that this method have few callers. However I am about to add one.
mercurial/changelog.py
--- a/mercurial/changelog.py	Mon Jan 08 15:11:34 2024 +0100
+++ b/mercurial/changelog.py	Sun Feb 25 23:05:33 2024 +0100
@@ -327,6 +327,9 @@
         self._filteredrevs_hashcache = {}
         self._copiesstorage = opener.options.get(b'copies-storage')
 
+    def __contains__(self, rev):
+        return (0 <= rev < len(self)) and rev not in self._filteredrevs
+
     @property
     def filteredrevs(self):
         return self._filteredrevs