changeset 2220:6d3cc2a982f3

add filename to IOError if read of file fails. if file replaced with directory or symlink, IOError not fully filled out.
author Vadim Gelfer <vadim.gelfer@gmail.com>
date Mon, 08 May 2006 08:20:56 -0700
parents ec82cff7d2c4
children 05b6c13f43c6
files mercurial/util.py
diffstat 1 files changed, 7 insertions(+), 1 deletions(-) [+]
line wrap: on
line diff
--- a/mercurial/util.py	Mon May 08 08:04:46 2006 -0700
+++ b/mercurial/util.py	Mon May 08 08:20:56 2006 -0700
@@ -687,7 +687,13 @@
         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