##// END OF EJS Templates
Smarter handling of revlog key errors...
mpm@selenic.com -
r1214:34706a83 default
parent child Browse files
Show More
@@ -1961,6 +1961,8 b' def dispatch(args):'
1961 raise
1961 raise
1962 except hg.RepoError, inst:
1962 except hg.RepoError, inst:
1963 u.warn("abort: ", inst, "!\n")
1963 u.warn("abort: ", inst, "!\n")
1964 except revlog.RevlogError, inst:
1965 u.warn("abort: ", inst, "!\n")
1964 except SignalInterrupt:
1966 except SignalInterrupt:
1965 u.warn("killed!\n")
1967 u.warn("killed!\n")
1966 except KeyboardInterrupt:
1968 except KeyboardInterrupt:
@@ -111,7 +111,8 b' class lazymap:'
111 def load(self, key):
111 def load(self, key):
112 if self.p.all: return
112 if self.p.all: return
113 n = self.p.data.find(key)
113 n = self.p.data.find(key)
114 if n < 0: raise KeyError("node " + hex(key))
114 if n < 0:
115 raise KeyError(key)
115 pos = n / self.p.s
116 pos = n / self.p.s
116 self.p.load(pos)
117 self.p.load(pos)
117 def __contains__(self, key):
118 def __contains__(self, key):
@@ -210,7 +211,7 b' class revlog:'
210 try:
211 try:
211 return self.nodemap[node]
212 return self.nodemap[node]
212 except KeyError:
213 except KeyError:
213 raise KeyError('%s: no node %s' % (self.indexfile, hex(node)))
214 raise RevlogError('%s: no node %s' % (self.indexfile, hex(node)))
214 def linkrev(self, node): return self.index[self.rev(node)][3]
215 def linkrev(self, node): return self.index[self.rev(node)][3]
215 def parents(self, node):
216 def parents(self, node):
216 if node == nullid: return (nullid, nullid)
217 if node == nullid: return (nullid, nullid)
@@ -290,8 +291,8 b' class revlog:'
290 for n in self.nodemap:
291 for n in self.nodemap:
291 if hex(n).startswith(id):
292 if hex(n).startswith(id):
292 c.append(n)
293 c.append(n)
293 if len(c) > 1: raise KeyError("Ambiguous identifier")
294 if len(c) > 1: raise RevlogError("Ambiguous identifier")
294 if len(c) < 1: raise KeyError("No match found")
295 if len(c) < 1: raise RevlogError("No match found")
295 return c[0]
296 return c[0]
296
297
297 return None
298 return None
@@ -353,7 +354,7 b' class revlog:'
353 text = mdiff.patches(text, bins)
354 text = mdiff.patches(text, bins)
354
355
355 if node != hash(text, p1, p2):
356 if node != hash(text, p1, p2):
356 raise IOError("integrity check failed on %s:%d"
357 raise RevlogError("integrity check failed on %s:%d"
357 % (self.datafile, rev))
358 % (self.datafile, rev))
358
359
359 self.cache = (node, rev, text)
360 self.cache = (node, rev, text)
General Comments 0
You need to be logged in to leave comments. Login now