# HG changeset patch # User Bryan O'Sullivan # Date 2005-09-23 06:31:44 # Node ID b3d44e9b30921b4317ec825b8b86ea11f0198839 # Parent b47f96a178a3d9437a1367e6813967e8ed1ecf6f Make revlog constructor more discerning in its treatment of errors. diff --git a/mercurial/revlog.py b/mercurial/revlog.py --- a/mercurial/revlog.py +++ b/mercurial/revlog.py @@ -10,9 +10,9 @@ This software may be used and distribute of the GNU General Public License, incorporated herein by reference. """ -import zlib, struct, sha, binascii, heapq -import mdiff from node import * +from demandload import demandload +demandload(globals(), "binascii errno heapq mdiff sha struct urllib2 zlib") def hash(text, p1, p2): """generate a hash from the given text and its parent hashes @@ -179,7 +179,11 @@ class revlog: try: i = self.opener(self.indexfile).read() - except IOError: + except urllib2.URLError: + raise + except IOError, inst: + if inst.errno != errno.ENOENT: + raise i = "" if len(i) > 10000: