##// END OF EJS Templates
rename util.unlink to unlinkpath
Adrian Buehlmann -
r13235:6bf39d88 default
parent child Browse files
Show More
@@ -1146,7 +1146,7 b' class queue(object):'
1146 for f in all_files:
1146 for f in all_files:
1147 if f not in repo.dirstate:
1147 if f not in repo.dirstate:
1148 try:
1148 try:
1149 util.unlink(repo.wjoin(f))
1149 util.unlinkpath(repo.wjoin(f))
1150 except OSError, inst:
1150 except OSError, inst:
1151 if inst.errno != errno.ENOENT:
1151 if inst.errno != errno.ENOENT:
1152 raise
1152 raise
@@ -1240,7 +1240,7 b' class queue(object):'
1240 raise util.Abort(_("deletions found between repo revs"))
1240 raise util.Abort(_("deletions found between repo revs"))
1241 for f in a:
1241 for f in a:
1242 try:
1242 try:
1243 util.unlink(repo.wjoin(f))
1243 util.unlinkpath(repo.wjoin(f))
1244 except OSError, e:
1244 except OSError, e:
1245 if e.errno != errno.ENOENT:
1245 if e.errno != errno.ENOENT:
1246 raise
1246 raise
@@ -215,7 +215,7 b' def rebase(ui, repo, **opts):'
215 clearstatus(repo)
215 clearstatus(repo)
216 ui.note(_("rebase completed\n"))
216 ui.note(_("rebase completed\n"))
217 if os.path.exists(repo.sjoin('undo')):
217 if os.path.exists(repo.sjoin('undo')):
218 util.unlink(repo.sjoin('undo'))
218 util.unlinkpath(repo.sjoin('undo'))
219 if skipped:
219 if skipped:
220 ui.note(_("%d revisions have been skipped\n") % len(skipped))
220 ui.note(_("%d revisions have been skipped\n") % len(skipped))
221 finally:
221 finally:
@@ -393,7 +393,7 b' def storestatus(repo, originalwd, target'
393 def clearstatus(repo):
393 def clearstatus(repo):
394 'Remove the status files'
394 'Remove the status files'
395 if os.path.exists(repo.join("rebasestate")):
395 if os.path.exists(repo.join("rebasestate")):
396 util.unlink(repo.join("rebasestate"))
396 util.unlinkpath(repo.join("rebasestate"))
397
397
398 def restorestatus(repo):
398 def restorestatus(repo):
399 'Restore a previously stored status'
399 'Restore a previously stored status'
@@ -3250,7 +3250,7 b' def revert(ui, repo, *pats, **opts):'
3250 continue
3250 continue
3251 audit_path(f)
3251 audit_path(f)
3252 try:
3252 try:
3253 util.unlink(repo.wjoin(f))
3253 util.unlinkpath(repo.wjoin(f))
3254 except OSError:
3254 except OSError:
3255 pass
3255 pass
3256 repo.dirstate.remove(f)
3256 repo.dirstate.remove(f)
@@ -829,7 +829,7 b' class workingctx(changectx):'
829 if unlink:
829 if unlink:
830 for f in list:
830 for f in list:
831 try:
831 try:
832 util.unlink(self._repo.wjoin(f))
832 util.unlinkpath(self._repo.wjoin(f))
833 except OSError, inst:
833 except OSError, inst:
834 if inst.errno != errno.ENOENT:
834 if inst.errno != errno.ENOENT:
835 raise
835 raise
@@ -312,7 +312,7 b' def applyupdates(repo, action, wctx, mct'
312 if f == '.hgsubstate': # subrepo states need updating
312 if f == '.hgsubstate': # subrepo states need updating
313 subrepo.submerge(repo, wctx, mctx, wctx)
313 subrepo.submerge(repo, wctx, mctx, wctx)
314 try:
314 try:
315 util.unlink(repo.wjoin(f))
315 util.unlinkpath(repo.wjoin(f))
316 except OSError, inst:
316 except OSError, inst:
317 if inst.errno != errno.ENOENT:
317 if inst.errno != errno.ENOENT:
318 repo.ui.warn(_("update failed to remove %s: %s!\n") %
318 repo.ui.warn(_("update failed to remove %s: %s!\n") %
@@ -350,7 +350,7 b' def applyupdates(repo, action, wctx, mct'
350 repo.ui.note(_("moving %s to %s\n") % (f, fd))
350 repo.ui.note(_("moving %s to %s\n") % (f, fd))
351 t = wctx.filectx(f).data()
351 t = wctx.filectx(f).data()
352 repo.wwrite(fd, t, flags)
352 repo.wwrite(fd, t, flags)
353 util.unlink(repo.wjoin(f))
353 util.unlinkpath(repo.wjoin(f))
354 if f2:
354 if f2:
355 repo.ui.note(_("getting %s to %s\n") % (f2, fd))
355 repo.ui.note(_("getting %s to %s\n") % (f2, fd))
356 t = mctx.filectx(f2).data()
356 t = mctx.filectx(f2).data()
@@ -431,7 +431,7 b' def checksignature(func):'
431
431
432 return check
432 return check
433
433
434 def unlink(f):
434 def unlinkpath(f):
435 """unlink and remove the directory if it is empty"""
435 """unlink and remove the directory if it is empty"""
436 os.unlink(f)
436 os.unlink(f)
437 # try removing directories that might now be empty
437 # try removing directories that might now be empty
@@ -276,7 +276,7 b' def _removedirs(name):'
276 break
276 break
277 head, tail = os.path.split(head)
277 head, tail = os.path.split(head)
278
278
279 def unlink(f):
279 def unlinkpath(f):
280 """unlink and remove the directory if it is empty"""
280 """unlink and remove the directory if it is empty"""
281 os.unlink(f)
281 os.unlink(f)
282 # try removing directories that might now be empty
282 # try removing directories that might now be empty
General Comments 0
You need to be logged in to leave comments. Login now