##// END OF EJS Templates
[PATCH] raise exceptions with Exception subclasses...
Bart Trojanowski -
r1073:7b35a980 default
parent child Browse files
Show More
@@ -86,7 +86,7 b' class templater:'
86 86 if m:
87 87 self.map[m.group(1)] = os.path.join(self.base, m.group(2))
88 88 else:
89 raise "unknown map entry '%s'" % l
89 raise LookupError("unknown map entry '%s'" % l)
90 90
91 91 def __call__(self, t, **map):
92 92 m = self.defaults.copy()
@@ -32,7 +32,7 b' def decompress(bin):'
32 32 if t == '\0': return bin
33 33 if t == 'x': return zlib.decompress(bin)
34 34 if t == 'u': return bin[1:]
35 raise "unknown compression type %s" % t
35 raise RevlogError("unknown compression type %s" % t)
36 36
37 37 def hash(text, p1, p2):
38 38 l = [p1, p2]
@@ -120,6 +120,8 b' class lazymap:'
120 120 def __setitem__(self, key, val):
121 121 self.p.map[key] = val
122 122
123 class RevlogError(Exception): pass
124
123 125 class revlog:
124 126 def __init__(self, opener, indexfile, datafile):
125 127 self.indexfile = indexfile
@@ -505,7 +507,7 b' class revlog:'
505 507 if node in self.nodemap:
506 508 # this can happen if two branches make the same change
507 509 if unique:
508 raise "already have %s" % hex(node[:4])
510 raise RevlogError("already have %s" % hex(node[:4]))
509 511 chain = node
510 512 continue
511 513 delta = chunk[80:]
@@ -514,7 +516,7 b' class revlog:'
514 516 # retrieve the parent revision of the delta chain
515 517 chain = p1
516 518 if not chain in self.nodemap:
517 raise "unknown base %s" % short(chain[:4])
519 raise RevlogError("unknown base %s" % short(chain[:4]))
518 520
519 521 # full versions are inserted when the needed deltas become
520 522 # comparable to the uncompressed text or when the previous
@@ -533,7 +535,7 b' class revlog:'
533 535 text = self.patches(text, [delta])
534 536 chk = self.addrevision(text, transaction, link, p1, p2)
535 537 if chk != node:
536 raise "consistency error adding group"
538 raise RevlogError("consistency error adding group")
537 539 measure = len(text)
538 540 else:
539 541 e = (end, len(cdelta), self.base(t), link, p1, p2, node)
@@ -20,7 +20,7 b' class transaction:'
20 20
21 21 # abort here if the journal already exists
22 22 if os.path.exists(journal):
23 raise "journal already exists - run hg recover"
23 raise AssertionError("journal already exists - run hg recover")
24 24
25 25 self.report = report
26 26 self.opener = opener
General Comments 0
You need to be logged in to leave comments. Login now