diff options
Diffstat (limited to 'mercurial/tags.py')
-rw-r--r-- | mercurial/tags.py | 11 |
1 files changed, 3 insertions, 8 deletions
diff --git a/mercurial/tags.py b/mercurial/tags.py index e4e0129..d4047bd 100644 --- a/mercurial/tags.py +++ b/mercurial/tags.py @@ -181,7 +181,7 @@ def _readtagcache(ui, repo): for line in cachelines: if line == "\n": break - line = line.split() + line = line.rstrip().split() cacherevs.append(int(line[0])) headnode = bin(line[1]) cacheheads.append(headnode) @@ -228,11 +228,6 @@ def _readtagcache(ui, repo): # N.B. in case 4 (nodes destroyed), "new head" really means "newly # exposed". - if not len(repo.file('.hgtags')): - # No tags have ever been committed, so we can avoid a - # potentially expensive search. - return (repoheads, cachefnode, None, True) - newheads = [head for head in repoheads if head not in set(cacheheads)] @@ -241,7 +236,7 @@ def _readtagcache(ui, repo): # This is the most expensive part of finding tags, so performance # depends primarily on the size of newheads. Worst case: no cache # file, so newheads == repoheads. - for head in reversed(newheads): + for head in newheads: cctx = repo[head] try: fnode = cctx.filenode('.hgtags') @@ -292,6 +287,6 @@ def _writetagcache(ui, repo, heads, tagfnode, cachetags): cachefile.write("%s %s\n" % (hex(node), name)) try: - cachefile.close() + cachefile.rename() except (OSError, IOError): pass |