[Zodb-checkins] CVS: ZODB3/Tools - repozo.py:1.1.2.6

Tim Peters tim.one at comcast.net
Sat Aug 16 20:31:58 EDT 2003


Update of /cvs-repository/ZODB3/Tools
In directory cvs.zope.org:/tmp/cvs-serv11592/Tools

Modified Files:
      Tag: ZODB3-3_1-branch
	repozo.py 
Log Message:
scandat():  Simplify overly-complex logic for finding the last line.  I
don't believe a .dat file can grow to gazillions of entries in reasonable
use, so there's no sane reason to avoid readlines().  Still untested.


=== ZODB3/Tools/repozo.py 1.1.2.5 => 1.1.2.6 ===
--- ZODB3/Tools/repozo.py:1.1.2.5	Sat Aug 16 19:28:24 2003
+++ ZODB3/Tools/repozo.py	Sat Aug 16 19:31:52 2003
@@ -316,18 +316,14 @@
         if e.errno <> errno.ENOENT:
             raise
     else:
-        while True:
-            line = fp.readline()
-            if not line:
-                break
-            # We only care about the last one.
-            fn, startpos, endpos, sum = line.split()
+        # We only care about the last one.
+        lines = fp.readlines()
         fp.close()
+        if lines:
+            fn, startpos, endpos, sum = lines[-1].split()
+            startpos = long(startpos)
+            endpos = long(endpos)
 
-    if startpos is not None:
-        assert endpos is not None
-        startpos = long(startpos)
-        endpos = long(endpos)
     return fn, startpos, endpos, sum
 
 




More information about the Zodb-checkins mailing list