add filename to IOError if read of file fails.
authorVadim Gelfer <vadim.gelfer@gmail.com>
Mon, 08 May 2006 08:20:56 -0700
changeset 2220 6d3cc2a982f3
parent 2219 ec82cff7d2c4
child 2221 05b6c13f43c6
add filename to IOError if read of file fails. if file replaced with directory or symlink, IOError not fully filled out.
mercurial/util.py
--- a/mercurial/util.py
+++ b/mercurial/util.py
@@ -687,7 +687,13 @@ def opener(base, audit=True):
         os.close(fd)
         fp = posixfile(temp, "wb")
         try:
-            fp.write(posixfile(name, "rb").read())
+            try:
+                s = posixfile(name, "rb").read()
+            except IOError, inst:
+                if not getattr(inst, 'filename', None):
+                    inst.filename = name
+                raise
+            fp.write(s)
         except:
             try: os.unlink(temp)
             except: pass