# HG changeset patch # User Bryan O'Sullivan # Date 1127486485 25200 # Node ID 04ed65045bccb08d426859d8fe54910466bf96a7 # Parent 085e3fc189b6800e34ca82b13c8a9955a9b385e7# Parent 76b2c7096d08d1c5bc6102e9bb7b20275e31b3a1 Merge with myself. diff --git a/mercurial/commands.py b/mercurial/commands.py --- a/mercurial/commands.py +++ b/mercurial/commands.py @@ -2160,6 +2160,8 @@ def dispatch(args): u.warn("abort: %s\n" % inst) elif hasattr(inst, "reason"): u.warn("abort: error: %s\n" % inst.reason[1]) + elif getattr(inst, "strerror", None): + u.warn("abort: %s\n" % inst.strerror) elif hasattr(inst, "args") and inst[0] == errno.EPIPE: if u.debugflag: u.warn("broken pipe\n") diff --git a/mercurial/revlog.py b/mercurial/revlog.py --- a/mercurial/revlog.py +++ b/mercurial/revlog.py @@ -12,7 +12,7 @@ of the GNU General Public License, incor from node import * from demandload import demandload -demandload(globals(), "binascii errno heapq mdiff sha struct urllib2 zlib") +demandload(globals(), "binascii errno heapq mdiff sha struct zlib") def hash(text, p1, p2): """generate a hash from the given text and its parent hashes @@ -179,8 +179,6 @@ class revlog: try: i = self.opener(self.indexfile).read() - except urllib2.URLError: - raise except IOError, inst: if inst.errno != errno.ENOENT: raise diff --git a/mercurial/statichttprepo.py b/mercurial/statichttprepo.py --- a/mercurial/statichttprepo.py +++ b/mercurial/statichttprepo.py @@ -7,15 +7,23 @@ # This software may be used and distributed according to the terms # of the GNU General Public License, incorporated herein by reference. -import os, urllib -import localrepo, httprangereader, filelog, manifest, changelog +from demandload import demandload +demandload(globals(), "changelog filelog httprangereader") +demandload(globals(), "localrepo manifest os urllib urllib2") + +class rangereader(httprangereader.httprangereader): + def read(self, size=None): + try: + return httprangereader.httprangereader.read(self, size) + except urllib2.URLError, inst: + raise IOError(None, str(inst)) def opener(base): """return a function that opens files over http""" p = base def o(path, mode="r"): f = os.path.join(p, urllib.quote(path)) - return httprangereader.httprangereader(f) + return rangereader(f) return o class statichttprepository(localrepo.localrepository):