changeset 3668:6f6696962986

don't use readline() to read branches.cache The posixfile_nt class used on windows doesn't have that method.
author Alexis S. L. Carvalho <alexis@cecm.usp.br>
date Wed, 15 Nov 2006 17:56:57 -0200
parents d5032b951c5c
children 48768b1ab23c
files mercurial/localrepo.py
diffstat 1 files changed, 5 insertions(+), 3 deletions(-) [+]
line wrap: on
line diff
--- a/mercurial/localrepo.py	Mon Nov 13 21:50:09 2006 +0100
+++ b/mercurial/localrepo.py	Wed Nov 15 17:56:57 2006 -0200
@@ -324,16 +324,18 @@
         partial = {}
         try:
             f = self.opener("branches.cache")
-            last, lrev = f.readline().rstrip().split(" ", 1)
+            lines = f.read().split('\n')
+            f.close()
+            last, lrev = lines.pop(0).rstrip().split(" ", 1)
             last, lrev = bin(last), int(lrev)
             if (lrev < self.changelog.count() and
                 self.changelog.node(lrev) == last): # sanity check
-                for l in f:
+                for l in lines:
+                    if not l: continue
                     node, label = l.rstrip().split(" ", 1)
                     partial[label] = bin(node)
             else: # invalidate the cache
                 last, lrev = nullid, nullrev
-            f.close()
         except IOError:
             last, lrev = nullid, nullrev
         return partial, last, lrev