[PATCH] convert raise "..." to raise Exception ("...")
Bart Trojanowski
bart at jukie.net
Mon Aug 22 21:48:31 CDT 2005
* Matt Mackall <mpm at selenic.com> [050822 21:25]:
> If you change revlog.py:35 to:
>
> raise Exception("unknown compression type %s" % t)
>
> ..we'll see which file and revision broken. Then send me a copy and
> I'll try to dissect it. It's probably a single bit error in the index,
> so be sure to send both files.
I don't understand python all that well, and I don't know if raising a
string is ever ok. The patch below may be complete garbage.
diff -r f859e9cba1b9 mercurial/hgweb.py
--- a/mercurial/hgweb.py Mon Aug 22 08:22:29 2005
+++ b/mercurial/hgweb.py Mon Aug 22 22:43:25 2005
@@ -81,7 +81,7 @@
if m:
self.map[m.group(1)] = os.path.join(self.base, m.group(2))
else:
- raise "unknown map entry '%s'" % l
+ raise Exception("unknown map entry '%s'" % l)
def __call__(self, t, **map):
m = self.defaults.copy()
diff -r f859e9cba1b9 mercurial/revlog.py
--- a/mercurial/revlog.py Mon Aug 22 08:22:29 2005
+++ b/mercurial/revlog.py Mon Aug 22 22:43:25 2005
@@ -32,7 +32,7 @@
if t == '\0': return bin
if t == 'x': return zlib.decompress(bin)
if t == 'u': return bin[1:]
- raise "unknown compression type %s" % t
+ raise Exception("unknown compression type %s" % t)
def hash(text, p1, p2):
l = [p1, p2]
@@ -505,7 +505,7 @@
if node in self.nodemap:
# this can happen if two branches make the same change
if unique:
- raise "already have %s" % hex(node[:4])
+ raise Exception("already have %s" % hex(node[:4]))
chain = node
continue
delta = chunk[80:]
@@ -514,7 +514,7 @@
# retrieve the parent revision of the delta chain
chain = p1
if not chain in self.nodemap:
- raise "unknown base %s" % short(chain[:4])
+ raise Exception("unknown base %s" % short(chain[:4]))
# full versions are inserted when the needed deltas become
# comparable to the uncompressed text or when the previous
@@ -533,7 +533,7 @@
text = self.patches(text, [delta])
chk = self.addrevision(text, transaction, link, p1, p2)
if chk != node:
- raise "consistency error adding group"
+ raise Exception("consistency error adding group")
measure = len(text)
else:
e = (end, len(cdelta), self.base(t), link, p1, p2, node)
diff -r f859e9cba1b9 mercurial/transaction.py
--- a/mercurial/transaction.py Mon Aug 22 08:22:29 2005
+++ b/mercurial/transaction.py Mon Aug 22 22:43:25 2005
@@ -20,7 +20,7 @@
# abort here if the journal already exists
if os.path.exists(journal):
- raise "journal already exists - run hg recover"
+ raise Exception("journal already exists - run hg recover")
self.report = report
self.opener = opener
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 189 bytes
Desc: Digital signature
Url : http://www.selenic.com/pipermail/mercurial/attachments/20050822/83e90d7c/attachment.pgp
More information about the Mercurial
mailing list