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