# HG changeset patch # User Gregory Szorc # Date 1538152385 25200 # Node ID 44c98cbc665f33ea3eac924771abb8de43ac56cd # Parent 2f80eaf38ed48d7a078051b2cc15a45393048198 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 diff -r 2f80eaf38ed4 -r 44c98cbc665f mercurial/filelog.py --- 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) diff -r 2f80eaf38ed4 -r 44c98cbc665f mercurial/repository.py --- 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. diff -r 2f80eaf38ed4 -r 44c98cbc665f mercurial/testing/storage.py --- 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)