Show More
@@ -105,7 +105,7 b' def setflags(f, l, x):' | |||||
105 | fp = open(f) |
|
105 | fp = open(f) | |
106 | data = fp.read() |
|
106 | data = fp.read() | |
107 | fp.close() |
|
107 | fp.close() | |
108 |
|
|
108 | unlink(f) | |
109 | try: |
|
109 | try: | |
110 | os.symlink(data, f) |
|
110 | os.symlink(data, f) | |
111 | except OSError: |
|
111 | except OSError: | |
@@ -118,7 +118,7 b' def setflags(f, l, x):' | |||||
118 | if stat.S_ISLNK(s): |
|
118 | if stat.S_ISLNK(s): | |
119 | # switch link to file |
|
119 | # switch link to file | |
120 | data = os.readlink(f) |
|
120 | data = os.readlink(f) | |
121 |
|
|
121 | unlink(f) | |
122 | fp = open(f, "w") |
|
122 | fp = open(f, "w") | |
123 | fp.write(data) |
|
123 | fp.write(data) | |
124 | fp.close() |
|
124 | fp.close() | |
@@ -187,9 +187,9 b' def checkexec(path):' | |||||
187 | # check-exec is exec and check-no-exec is not exec |
|
187 | # check-exec is exec and check-no-exec is not exec | |
188 | return True |
|
188 | return True | |
189 | # checknoexec exists but is exec - delete it |
|
189 | # checknoexec exists but is exec - delete it | |
190 |
|
|
190 | unlink(checknoexec) | |
191 | # checkisexec exists but is not exec - delete it |
|
191 | # checkisexec exists but is not exec - delete it | |
192 |
|
|
192 | unlink(checkisexec) | |
193 |
|
193 | |||
194 | # check using one file, leave it as checkisexec |
|
194 | # check using one file, leave it as checkisexec | |
195 | checkdir = cachedir |
|
195 | checkdir = cachedir | |
@@ -210,7 +210,7 b' def checkexec(path):' | |||||
210 | return True |
|
210 | return True | |
211 | finally: |
|
211 | finally: | |
212 | if fn is not None: |
|
212 | if fn is not None: | |
213 |
|
|
213 | unlink(fn) | |
214 | except (IOError, OSError): |
|
214 | except (IOError, OSError): | |
215 | # we don't care, the user probably won't be able to commit anyway |
|
215 | # we don't care, the user probably won't be able to commit anyway | |
216 | return False |
|
216 | return False | |
@@ -248,12 +248,12 b' def checklink(path):' | |||||
248 | try: |
|
248 | try: | |
249 | os.symlink(target, name) |
|
249 | os.symlink(target, name) | |
250 | if cachedir is None: |
|
250 | if cachedir is None: | |
251 |
|
|
251 | unlink(name) | |
252 | else: |
|
252 | else: | |
253 | try: |
|
253 | try: | |
254 | os.rename(name, checklink) |
|
254 | os.rename(name, checklink) | |
255 | except OSError: |
|
255 | except OSError: | |
256 |
|
|
256 | unlink(name) | |
257 | return True |
|
257 | return True | |
258 | except OSError as inst: |
|
258 | except OSError as inst: | |
259 | # link creation might race, try again |
|
259 | # link creation might race, try again | |
@@ -268,7 +268,7 b' def checklink(path):' | |||||
268 | except OSError as inst: |
|
268 | except OSError as inst: | |
269 | # sshfs might report failure while successfully creating the link |
|
269 | # sshfs might report failure while successfully creating the link | |
270 | if inst[0] == errno.EIO and os.path.exists(name): |
|
270 | if inst[0] == errno.EIO and os.path.exists(name): | |
271 |
|
|
271 | unlink(name) | |
272 | return False |
|
272 | return False | |
273 |
|
273 | |||
274 | def checkosfilename(path): |
|
274 | def checkosfilename(path): | |
@@ -539,7 +539,7 b' def makedir(path, notindexed):' | |||||
539 | def unlinkpath(f, ignoremissing=False): |
|
539 | def unlinkpath(f, ignoremissing=False): | |
540 | """unlink and remove the directory if it is empty""" |
|
540 | """unlink and remove the directory if it is empty""" | |
541 | try: |
|
541 | try: | |
542 |
|
|
542 | unlink(f) | |
543 | except OSError as e: |
|
543 | except OSError as e: | |
544 | if not (ignoremissing and e.errno == errno.ENOENT): |
|
544 | if not (ignoremissing and e.errno == errno.ENOENT): | |
545 | raise |
|
545 | raise |
General Comments 0
You need to be logged in to leave comments.
Login now