changeset 39998:44c98cbc665f

filelog: remove checkhash() (API) It is unused. While a caller may want to ask the store to validate the hash of some provided text, since there are no in-core consumers of this method, let's drop it for now. Differential Revision: https://phab.mercurial-scm.org/D4793
author Gregory Szorc <gregory.szorc@gmail.com>
date Fri, 28 Sep 2018 09:33:05 -0700
parents 2f80eaf38ed4
children 0b24fcd88066
files mercurial/filelog.py mercurial/repository.py mercurial/testing/storage.py
diffstat 3 files changed, 0 insertions(+), 42 deletions(-) [+]
line wrap: on
line diff
--- a/mercurial/filelog.py	Fri Sep 28 09:28:38 2018 -0700
+++ b/mercurial/filelog.py	Fri Sep 28 09:33:05 2018 -0700
@@ -71,10 +71,6 @@
     def iscensored(self, rev):
         return self._revlog.iscensored(rev)
 
-    # Might be unused.
-    def checkhash(self, text, node, p1=None, p2=None, rev=None):
-        return self._revlog.checkhash(text, node, p1=p1, p2=p2, rev=rev)
-
     def revision(self, node, _df=None, raw=False):
         return self._revlog.revision(node, _df=_df, raw=raw)
 
--- a/mercurial/repository.py	Fri Sep 28 09:28:38 2018 -0700
+++ b/mercurial/repository.py	Fri Sep 28 09:33:05 2018 -0700
@@ -545,12 +545,6 @@
         Any metadata is excluded from size measurements.
         """
 
-    def checkhash(fulltext, node, p1=None, p2=None, rev=None):
-        """Validate the stored hash of a given fulltext and node.
-
-        Raises ``error.StorageError`` is hash validation fails.
-        """
-
     def revision(node, raw=False):
         """"Obtain fulltext data for a node.
 
--- a/mercurial/testing/storage.py	Fri Sep 28 09:28:38 2018 -0700
+++ b/mercurial/testing/storage.py	Fri Sep 28 09:33:05 2018 -0700
@@ -368,12 +368,6 @@
             with self.assertRaises(IndexError):
                 f.size(i)
 
-        with self.assertRaises(error.StorageError):
-            f.checkhash(b'', nullid)
-
-        with self.assertRaises(error.LookupError):
-            f.checkhash(b'', b'\x01' * 20)
-
         self.assertEqual(f.revision(nullid), b'')
         self.assertEqual(f.revision(nullid, raw=True), b'')
 
@@ -426,18 +420,6 @@
         with self.assertRaises(IndexError):
             f.size(1)
 
-        f.checkhash(fulltext, node)
-        f.checkhash(fulltext, node, nullid, nullid)
-
-        with self.assertRaises(error.StorageError):
-            f.checkhash(fulltext + b'extra', node)
-
-        with self.assertRaises(error.StorageError):
-            f.checkhash(fulltext, node, b'\x01' * 20, nullid)
-
-        with self.assertRaises(error.StorageError):
-            f.checkhash(fulltext, node, nullid, b'\x01' * 20)
-
         self.assertEqual(f.revision(node), fulltext)
         self.assertEqual(f.revision(node, raw=True), fulltext)
 
@@ -510,20 +492,6 @@
         with self.assertRaises(IndexError):
             f.size(3)
 
-        f.checkhash(fulltext0, node0)
-        f.checkhash(fulltext1, node1)
-        f.checkhash(fulltext1, node1, node0, nullid)
-        f.checkhash(fulltext2, node2, node1, nullid)
-
-        with self.assertRaises(error.StorageError):
-            f.checkhash(fulltext1, b'\x01' * 20)
-
-        with self.assertRaises(error.StorageError):
-            f.checkhash(fulltext1 + b'extra', node1, node0, nullid)
-
-        with self.assertRaises(error.StorageError):
-            f.checkhash(fulltext1, node1, node0, node0)
-
         self.assertEqual(f.revision(node0), fulltext0)
         self.assertEqual(f.revision(node0, raw=True), fulltext0)
         self.assertEqual(f.revision(node1), fulltext1)