# HG changeset patch # User Gregory Szorc # Date 2018-09-24 19:49:17 # Node ID d909c44d29e16b14051efe4852bf4461f1b95aa6 # Parent 9596cf2a550d02141457e1934349e41a836a1e62 filelog: stop proxying rawsize() (API) This method is no longer used by external consumers. The API is quite low-level and is effectively len(revision(raw=True)). I don't see a compelling reason to keep it around. Let's drop the API and make the file storage interface simpler. Differential Revision: https://phab.mercurial-scm.org/D4750 diff --git a/mercurial/filelog.py b/mercurial/filelog.py --- a/mercurial/filelog.py +++ b/mercurial/filelog.py @@ -73,10 +73,6 @@ class filelog(object): def iscensored(self, rev): return self._revlog.iscensored(rev) - # Unused. - def rawsize(self, rev): - return self._revlog.rawsize(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) diff --git a/mercurial/repository.py b/mercurial/repository.py --- a/mercurial/repository.py +++ b/mercurial/repository.py @@ -542,14 +542,10 @@ class ifiledata(interfaceutil.Interface) This complements ``ifileindex`` and provides an interface for accessing data for a tracked file. """ - def rawsize(rev): - """The size of the fulltext data for a revision as stored.""" - def size(rev): """Obtain the fulltext size of file data. - Any metadata is excluded from size measurements. Use ``rawsize()`` if - metadata size is important. + Any metadata is excluded from size measurements. """ def checkhash(fulltext, node, p1=None, p2=None, rev=None): diff --git a/mercurial/testing/storage.py b/mercurial/testing/storage.py --- a/mercurial/testing/storage.py +++ b/mercurial/testing/storage.py @@ -371,15 +371,6 @@ class ifiledatatests(basetestcase): self.assertEqual(f.storageinfo(revisionscount=True, trackedsize=True), {'revisionscount': 0, 'trackedsize': 0}) - self.assertEqual(f.rawsize(nullrev), 0) - - for i in range(-5, 5): - if i == nullrev: - continue - - with self.assertRaises(IndexError): - f.rawsize(i) - self.assertEqual(f.size(nullrev), 0) for i in range(-5, 5): @@ -453,11 +444,6 @@ class ifiledatatests(basetestcase): self.assertEqual(f.storageinfo(revisionscount=True, trackedsize=True), {'revisionscount': 1, 'trackedsize': len(fulltext)}) - self.assertEqual(f.rawsize(0), len(fulltext)) - - with self.assertRaises(IndexError): - f.rawsize(1) - self.assertEqual(f.size(0), len(fulltext)) with self.assertRaises(IndexError): @@ -548,13 +534,6 @@ class ifiledatatests(basetestcase): 'trackedsize': len(fulltext0) + len(fulltext1) + len(fulltext2), }) - self.assertEqual(f.rawsize(0), len(fulltext0)) - self.assertEqual(f.rawsize(1), len(fulltext1)) - self.assertEqual(f.rawsize(2), len(fulltext2)) - - with self.assertRaises(IndexError): - f.rawsize(3) - self.assertEqual(f.size(0), len(fulltext0)) self.assertEqual(f.size(1), len(fulltext1)) self.assertEqual(f.size(2), len(fulltext2)) @@ -853,9 +832,6 @@ class ifiledatatests(basetestcase): node1 = f.add(fulltext1, meta1, tr, 1, node0, nullid) node2 = f.add(fulltext2, meta2, tr, 2, nullid, nullid) - self.assertEqual(f.rawsize(1), len(stored1)) - self.assertEqual(f.rawsize(2), len(stored2)) - # Metadata header isn't recognized when parent isn't nullid. self.assertEqual(f.size(1), len(stored1)) self.assertEqual(f.size(2), len(fulltext2)) @@ -898,9 +874,6 @@ class ifiledatatests(basetestcase): node0 = f.add(fulltext0, {}, tr, 0, nullid, nullid) node1 = f.add(fulltext1, meta1, tr, 1, nullid, nullid) - self.assertEqual(f.rawsize(0), len(stored0)) - self.assertEqual(f.rawsize(1), len(stored1)) - # TODO this is buggy. self.assertEqual(f.size(0), len(fulltext0) + 4) diff --git a/tests/simplestorerepo.py b/tests/simplestorerepo.py --- a/tests/simplestorerepo.py +++ b/tests/simplestorerepo.py @@ -249,11 +249,6 @@ class filestorage(object): return True - def rawsize(self, rev): - validaterev(rev) - node = self.node(rev) - return len(self.revision(node, raw=True)) - def _processflags(self, text, flags, operation, raw=False): if flags == 0: return text, True diff --git a/tests/test-lfs.t b/tests/test-lfs.t --- a/tests/test-lfs.t +++ b/tests/test-lfs.t @@ -690,7 +690,7 @@ absence doesn't cause an abort.) > fl = repo.file(name) > if len(fl) == 0: > continue - > sizes = [fl.rawsize(i) for i in fl] + > sizes = [fl._revlog.rawsize(i) for i in fl] > texts = [fl.revision(i, raw=True) for i in fl] > flags = [int(fl._revlog.flags(i)) for i in fl] > hashes = [hash(t) for t in texts]