##// END OF EJS Templates
Only set mode of new patch if the target file was removed before....
Thomas Arendsen Hein -
r5477:bff41174 default
parent child Browse files
Show More
@@ -9,7 +9,7 b''
9 9 from i18n import _
10 10 from node import *
11 11 import base85, cmdutil, mdiff, util, context, revlog, diffhelpers
12 import cStringIO, email.Parser, os, popen2, re, sha
12 import cStringIO, email.Parser, os, popen2, re, sha, errno
13 13 import sys, tempfile, zlib
14 14
15 15 class PatchError(Exception):
@@ -402,11 +402,13 b' class patchfile:'
402 402 st = None
403 403 try:
404 404 st = os.lstat(dest)
405 if st.st_nlink > 1:
406 os.unlink(dest)
407 except: pass
405 except OSError, inst:
406 if inst.errno != errno.ENOENT:
407 raise
408 if st and st.st_nlink > 1:
409 os.unlink(dest)
408 410 fp = file(dest, 'wb')
409 if st:
411 if st and st.st_nlink > 1:
410 412 os.chmod(dest, st.st_mode)
411 413 fp.writelines(self.lines)
412 414 fp.close()
General Comments 0
You need to be logged in to leave comments. Login now