##// END OF EJS Templates
filelog: stop proxying rawsize() (API)...
Gregory Szorc -
r39911:d909c44d default
parent child Browse files
Show More
@@ -73,10 +73,6 b' class filelog(object):'
73 def iscensored(self, rev):
73 def iscensored(self, rev):
74 return self._revlog.iscensored(rev)
74 return self._revlog.iscensored(rev)
75
75
76 # Unused.
77 def rawsize(self, rev):
78 return self._revlog.rawsize(rev)
79
80 # Might be unused.
76 # Might be unused.
81 def checkhash(self, text, node, p1=None, p2=None, rev=None):
77 def checkhash(self, text, node, p1=None, p2=None, rev=None):
82 return self._revlog.checkhash(text, node, p1=p1, p2=p2, rev=rev)
78 return self._revlog.checkhash(text, node, p1=p1, p2=p2, rev=rev)
@@ -542,14 +542,10 b' class ifiledata(interfaceutil.Interface)'
542 This complements ``ifileindex`` and provides an interface for accessing
542 This complements ``ifileindex`` and provides an interface for accessing
543 data for a tracked file.
543 data for a tracked file.
544 """
544 """
545 def rawsize(rev):
546 """The size of the fulltext data for a revision as stored."""
547
548 def size(rev):
545 def size(rev):
549 """Obtain the fulltext size of file data.
546 """Obtain the fulltext size of file data.
550
547
551 Any metadata is excluded from size measurements. Use ``rawsize()`` if
548 Any metadata is excluded from size measurements.
552 metadata size is important.
553 """
549 """
554
550
555 def checkhash(fulltext, node, p1=None, p2=None, rev=None):
551 def checkhash(fulltext, node, p1=None, p2=None, rev=None):
@@ -371,15 +371,6 b' class ifiledatatests(basetestcase):'
371 self.assertEqual(f.storageinfo(revisionscount=True, trackedsize=True),
371 self.assertEqual(f.storageinfo(revisionscount=True, trackedsize=True),
372 {'revisionscount': 0, 'trackedsize': 0})
372 {'revisionscount': 0, 'trackedsize': 0})
373
373
374 self.assertEqual(f.rawsize(nullrev), 0)
375
376 for i in range(-5, 5):
377 if i == nullrev:
378 continue
379
380 with self.assertRaises(IndexError):
381 f.rawsize(i)
382
383 self.assertEqual(f.size(nullrev), 0)
374 self.assertEqual(f.size(nullrev), 0)
384
375
385 for i in range(-5, 5):
376 for i in range(-5, 5):
@@ -453,11 +444,6 b' class ifiledatatests(basetestcase):'
453 self.assertEqual(f.storageinfo(revisionscount=True, trackedsize=True),
444 self.assertEqual(f.storageinfo(revisionscount=True, trackedsize=True),
454 {'revisionscount': 1, 'trackedsize': len(fulltext)})
445 {'revisionscount': 1, 'trackedsize': len(fulltext)})
455
446
456 self.assertEqual(f.rawsize(0), len(fulltext))
457
458 with self.assertRaises(IndexError):
459 f.rawsize(1)
460
461 self.assertEqual(f.size(0), len(fulltext))
447 self.assertEqual(f.size(0), len(fulltext))
462
448
463 with self.assertRaises(IndexError):
449 with self.assertRaises(IndexError):
@@ -548,13 +534,6 b' class ifiledatatests(basetestcase):'
548 'trackedsize': len(fulltext0) + len(fulltext1) + len(fulltext2),
534 'trackedsize': len(fulltext0) + len(fulltext1) + len(fulltext2),
549 })
535 })
550
536
551 self.assertEqual(f.rawsize(0), len(fulltext0))
552 self.assertEqual(f.rawsize(1), len(fulltext1))
553 self.assertEqual(f.rawsize(2), len(fulltext2))
554
555 with self.assertRaises(IndexError):
556 f.rawsize(3)
557
558 self.assertEqual(f.size(0), len(fulltext0))
537 self.assertEqual(f.size(0), len(fulltext0))
559 self.assertEqual(f.size(1), len(fulltext1))
538 self.assertEqual(f.size(1), len(fulltext1))
560 self.assertEqual(f.size(2), len(fulltext2))
539 self.assertEqual(f.size(2), len(fulltext2))
@@ -853,9 +832,6 b' class ifiledatatests(basetestcase):'
853 node1 = f.add(fulltext1, meta1, tr, 1, node0, nullid)
832 node1 = f.add(fulltext1, meta1, tr, 1, node0, nullid)
854 node2 = f.add(fulltext2, meta2, tr, 2, nullid, nullid)
833 node2 = f.add(fulltext2, meta2, tr, 2, nullid, nullid)
855
834
856 self.assertEqual(f.rawsize(1), len(stored1))
857 self.assertEqual(f.rawsize(2), len(stored2))
858
859 # Metadata header isn't recognized when parent isn't nullid.
835 # Metadata header isn't recognized when parent isn't nullid.
860 self.assertEqual(f.size(1), len(stored1))
836 self.assertEqual(f.size(1), len(stored1))
861 self.assertEqual(f.size(2), len(fulltext2))
837 self.assertEqual(f.size(2), len(fulltext2))
@@ -898,9 +874,6 b' class ifiledatatests(basetestcase):'
898 node0 = f.add(fulltext0, {}, tr, 0, nullid, nullid)
874 node0 = f.add(fulltext0, {}, tr, 0, nullid, nullid)
899 node1 = f.add(fulltext1, meta1, tr, 1, nullid, nullid)
875 node1 = f.add(fulltext1, meta1, tr, 1, nullid, nullid)
900
876
901 self.assertEqual(f.rawsize(0), len(stored0))
902 self.assertEqual(f.rawsize(1), len(stored1))
903
904 # TODO this is buggy.
877 # TODO this is buggy.
905 self.assertEqual(f.size(0), len(fulltext0) + 4)
878 self.assertEqual(f.size(0), len(fulltext0) + 4)
906
879
@@ -249,11 +249,6 b' class filestorage(object):'
249
249
250 return True
250 return True
251
251
252 def rawsize(self, rev):
253 validaterev(rev)
254 node = self.node(rev)
255 return len(self.revision(node, raw=True))
256
257 def _processflags(self, text, flags, operation, raw=False):
252 def _processflags(self, text, flags, operation, raw=False):
258 if flags == 0:
253 if flags == 0:
259 return text, True
254 return text, True
@@ -690,7 +690,7 b" absence doesn't cause an abort.)"
690 > fl = repo.file(name)
690 > fl = repo.file(name)
691 > if len(fl) == 0:
691 > if len(fl) == 0:
692 > continue
692 > continue
693 > sizes = [fl.rawsize(i) for i in fl]
693 > sizes = [fl._revlog.rawsize(i) for i in fl]
694 > texts = [fl.revision(i, raw=True) for i in fl]
694 > texts = [fl.revision(i, raw=True) for i in fl]
695 > flags = [int(fl._revlog.flags(i)) for i in fl]
695 > flags = [int(fl._revlog.flags(i)) for i in fl]
696 > hashes = [hash(t) for t in texts]
696 > hashes = [hash(t) for t in texts]
General Comments 0
You need to be logged in to leave comments. Login now