mirror of
https://github.com/facebook/sapling.git
synced 2024-10-07 15:27:13 +03:00
tags: do not fail if tags.cache is corrupted (issue2444)
This file is not critical for hg, so we can safely swallow the ValueError
This commit is contained in:
parent
17cfc8fdc9
commit
9eb3896291
@ -176,16 +176,23 @@ def _readtagcache(ui, repo):
|
||||
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, TypeError):
|
||||
# corruption of tags.cache, just recompute it
|
||||
ui.warn(_('.hg/tags.cache is corrupt, rebuilding it\n'))
|
||||
cacheheads = []
|
||||
cacherevs = []
|
||||
cachefnode = {}
|
||||
|
||||
tipnode = repo.changelog.tip()
|
||||
tiprev = len(repo.changelog) - 1
|
||||
|
@ -34,6 +34,17 @@ Setup:
|
||||
$ cacheexists
|
||||
tag cache exists
|
||||
|
||||
Try corrupting the cache
|
||||
|
||||
$ echo 'a b\n' > .hg/tags.cache
|
||||
$ hg identify
|
||||
.hg/tags.cache is corrupt, rebuilding it
|
||||
acb14030fe0a tip
|
||||
$ cacheexists
|
||||
tag cache exists
|
||||
$ hg identify
|
||||
acb14030fe0a tip
|
||||
|
||||
Create local tag with long name:
|
||||
|
||||
$ T=`hg identify --debug --id`
|
||||
|
Loading…
Reference in New Issue
Block a user