don't use readline() to read branches.cache
authorAlexis S. L. Carvalho <alexis@cecm.usp.br>
Wed, 15 Nov 2006 17:56:57 -0200
changeset 3668 6f6696962986
parent 3667 d5032b951c5c
child 3669 48768b1ab23c
don't use readline() to read branches.cache The posixfile_nt class used on windows doesn't have that method.
mercurial/localrepo.py
--- 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