diff mercurial/tags.py @ 11066:26abd91d9e84 stable

static-http: mimic more closely localrepo (issue2164: allow clone -r ) * httprangereader: name, __iter__ and close are needed to mimic file object * static-http opener: - disallow write/append modes - add (unused) atomictemp parameter * static-http repo: - root attribute is needed for localrepo.dirstate() - _branch* attributes are required for commitctx and branchmap calls * tags: force repo.opener.__iter__ call earlier to force httprangereader to try to read the cache early, to avoid raising IOError later.
author Nicolas Dumazet <nicdumz.commits@gmail.com>
date Mon, 26 Apr 2010 20:13:14 +0900
parents 25e572394f5c
children 37d1b20168d1
line wrap: on
line diff
--- a/mercurial/tags.py	Fri Apr 30 18:11:56 2010 +0200
+++ b/mercurial/tags.py	Mon Apr 26 20:13:14 2010 +0900
@@ -197,6 +197,8 @@
 
     try:
         cachefile = repo.opener('tags.cache', 'r')
+        # force reading the file for static-http
+        cachelines = iter(cachefile)
         _debug(ui, 'reading tag cache from %s\n' % cachefile.name)
     except IOError:
         cachefile = None
@@ -217,7 +219,7 @@
     cacheheads = []                     # list of headnode
     cachefnode = {}                     # map headnode to filenode
     if cachefile:
-        for line in cachefile:
+        for line in cachelines:
             if line == "\n":
                 break
             line = line.rstrip().split()
@@ -237,7 +239,7 @@
     # have been destroyed by strip or rollback.)
     if cacheheads and cacheheads[0] == tipnode and cacherevs[0] == tiprev:
         _debug(ui, "tag cache: tip unchanged\n")
-        tags = _readtags(ui, repo, cachefile, cachefile.name)
+        tags = _readtags(ui, repo, cachelines, cachefile.name)
         cachefile.close()
         return (None, None, tags, False)
     if cachefile: