changeset 51458:ec8c1d0f6d48

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.
author Pierre-Yves David <pierre-yves.david@octobus.net>
date Sun, 25 Feb 2024 23:05:33 +0100
parents c0d51565b501
children 077d5a784c58
files mercurial/changelog.py
diffstat 1 files changed, 3 insertions(+), 0 deletions(-) [+]
line wrap: on
line diff
--- 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