##// 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 from i18n import _
9 from i18n import _
10 from node import *
10 from node import *
11 import base85, cmdutil, mdiff, util, context, revlog, diffhelpers
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 import sys, tempfile, zlib
13 import sys, tempfile, zlib
14
14
15 class PatchError(Exception):
15 class PatchError(Exception):
@@ -402,11 +402,13 b' class patchfile:'
402 st = None
402 st = None
403 try:
403 try:
404 st = os.lstat(dest)
404 st = os.lstat(dest)
405 if st.st_nlink > 1:
405 except OSError, inst:
406 os.unlink(dest)
406 if inst.errno != errno.ENOENT:
407 except: pass
407 raise
408 if st and st.st_nlink > 1:
409 os.unlink(dest)
408 fp = file(dest, 'wb')
410 fp = file(dest, 'wb')
409 if st:
411 if st and st.st_nlink > 1:
410 os.chmod(dest, st.st_mode)
412 os.chmod(dest, st.st_mode)
411 fp.writelines(self.lines)
413 fp.writelines(self.lines)
412 fp.close()
414 fp.close()
General Comments 0
You need to be logged in to leave comments. Login now