D4793: filelog: remove checkhash() (API)

indygreg (Gregory Szorc) phabricator at mercurial-scm.org
Sat Sep 29 00:19:12 UTC 2018


indygreg created this revision.
Herald added a subscriber: mercurial-devel.
Herald added a reviewer: hg-reviewers.

REVISION SUMMARY
  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.

REPOSITORY
  rHG Mercurial

REVISION DETAIL
  https://phab.mercurial-scm.org/D4793

AFFECTED FILES
  mercurial/filelog.py
  mercurial/repository.py
  mercurial/testing/storage.py

CHANGE DETAILS

diff --git a/mercurial/testing/storage.py b/mercurial/testing/storage.py
--- a/mercurial/testing/storage.py
+++ b/mercurial/testing/storage.py
@@ -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)
diff --git a/mercurial/repository.py b/mercurial/repository.py
--- a/mercurial/repository.py
+++ b/mercurial/repository.py
@@ -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.
 
diff --git a/mercurial/filelog.py b/mercurial/filelog.py
--- a/mercurial/filelog.py
+++ b/mercurial/filelog.py
@@ -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)
 



To: indygreg, #hg-reviewers
Cc: mercurial-devel


More information about the Mercurial-devel mailing list