mercurial/util.py
changeset 2220 6d3cc2a982f3
parent 2193 fb28ce04b349
child 2237 4a069064a39b
equal deleted inserted replaced
2219:ec82cff7d2c4 2220:6d3cc2a982f3
   685         d, fn = os.path.split(name)
   685         d, fn = os.path.split(name)
   686         fd, temp = tempfile.mkstemp(prefix='.%s-' % fn, dir=d)
   686         fd, temp = tempfile.mkstemp(prefix='.%s-' % fn, dir=d)
   687         os.close(fd)
   687         os.close(fd)
   688         fp = posixfile(temp, "wb")
   688         fp = posixfile(temp, "wb")
   689         try:
   689         try:
   690             fp.write(posixfile(name, "rb").read())
   690             try:
       
   691                 s = posixfile(name, "rb").read()
       
   692             except IOError, inst:
       
   693                 if not getattr(inst, 'filename', None):
       
   694                     inst.filename = name
       
   695                 raise
       
   696             fp.write(s)
   691         except:
   697         except:
   692             try: os.unlink(temp)
   698             try: os.unlink(temp)
   693             except: pass
   699             except: pass
   694             raise
   700             raise
   695         fp.close()
   701         fp.close()