All pastes #1966787 Raw Edit

nicdumz

public text v1 · immutable
#1966787 ·published 2010-10-19 10:58 UTC
rendered paste body
diff --git a/mercurial/tags.py b/mercurial/tags.py--- a/mercurial/tags.py+++ b/mercurial/tags.py@@ -176,16 +176,22 @@     cacheheads = []                     # list of headnode     cachefnode = {}                     # map headnode to filenode     if cachefile:-        for line in cachelines:-            if line == "\n":-                break-            line = line.rstrip().split()-            cacherevs.append(int(line[0]))-            headnode = bin(line[1])-            cacheheads.append(headnode)-            if len(line) == 3:-                fnode = bin(line[2])-                cachefnode[headnode] = fnode+        try:+            for line in cachelines:+                if line == "\n":+                    break+                line = line.rstrip().split()+                cacherevs.append(int(line[0]))+                headnode = bin(line[1])+                cacheheads.append(headnode)+                if len(line) == 3:+                    fnode = bin(line[2])+                    cachefnode[headnode] = fnode+        except ValueError:+            # corruption of tags.cache, just recompute it+            cacheheads = []+            cacherevs = []+            cachefnode = {}      tipnode = repo.changelog.tip()     tiprev = len(repo.changelog) - 1