# HG changeset patch # User Adrian Buehlmann # Date 1293993281 -3600 # Node ID 6bf39d88c8574aa4eb3676808e82f1c17225b7c1 # Parent 0935ff767285a4a1eb8c141c05bb99884c09a0db rename util.unlink to unlinkpath diff -r 0935ff767285 -r 6bf39d88c857 hgext/mq.py --- a/hgext/mq.py Wed Jan 05 15:56:03 2011 +0100 +++ b/hgext/mq.py Sun Jan 02 19:34:41 2011 +0100 @@ -1146,7 +1146,7 @@ for f in all_files: if f not in repo.dirstate: try: - util.unlink(repo.wjoin(f)) + util.unlinkpath(repo.wjoin(f)) except OSError, inst: if inst.errno != errno.ENOENT: raise @@ -1240,7 +1240,7 @@ raise util.Abort(_("deletions found between repo revs")) for f in a: try: - util.unlink(repo.wjoin(f)) + util.unlinkpath(repo.wjoin(f)) except OSError, e: if e.errno != errno.ENOENT: raise diff -r 0935ff767285 -r 6bf39d88c857 hgext/rebase.py --- a/hgext/rebase.py Wed Jan 05 15:56:03 2011 +0100 +++ b/hgext/rebase.py Sun Jan 02 19:34:41 2011 +0100 @@ -215,7 +215,7 @@ clearstatus(repo) ui.note(_("rebase completed\n")) if os.path.exists(repo.sjoin('undo')): - util.unlink(repo.sjoin('undo')) + util.unlinkpath(repo.sjoin('undo')) if skipped: ui.note(_("%d revisions have been skipped\n") % len(skipped)) finally: @@ -393,7 +393,7 @@ def clearstatus(repo): 'Remove the status files' if os.path.exists(repo.join("rebasestate")): - util.unlink(repo.join("rebasestate")) + util.unlinkpath(repo.join("rebasestate")) def restorestatus(repo): 'Restore a previously stored status' diff -r 0935ff767285 -r 6bf39d88c857 mercurial/commands.py --- a/mercurial/commands.py Wed Jan 05 15:56:03 2011 +0100 +++ b/mercurial/commands.py Sun Jan 02 19:34:41 2011 +0100 @@ -3250,7 +3250,7 @@ continue audit_path(f) try: - util.unlink(repo.wjoin(f)) + util.unlinkpath(repo.wjoin(f)) except OSError: pass repo.dirstate.remove(f) diff -r 0935ff767285 -r 6bf39d88c857 mercurial/context.py --- a/mercurial/context.py Wed Jan 05 15:56:03 2011 +0100 +++ b/mercurial/context.py Sun Jan 02 19:34:41 2011 +0100 @@ -829,7 +829,7 @@ if unlink: for f in list: try: - util.unlink(self._repo.wjoin(f)) + util.unlinkpath(self._repo.wjoin(f)) except OSError, inst: if inst.errno != errno.ENOENT: raise diff -r 0935ff767285 -r 6bf39d88c857 mercurial/merge.py --- a/mercurial/merge.py Wed Jan 05 15:56:03 2011 +0100 +++ b/mercurial/merge.py Sun Jan 02 19:34:41 2011 +0100 @@ -312,7 +312,7 @@ if f == '.hgsubstate': # subrepo states need updating subrepo.submerge(repo, wctx, mctx, wctx) try: - util.unlink(repo.wjoin(f)) + util.unlinkpath(repo.wjoin(f)) except OSError, inst: if inst.errno != errno.ENOENT: repo.ui.warn(_("update failed to remove %s: %s!\n") % @@ -350,7 +350,7 @@ repo.ui.note(_("moving %s to %s\n") % (f, fd)) t = wctx.filectx(f).data() repo.wwrite(fd, t, flags) - util.unlink(repo.wjoin(f)) + util.unlinkpath(repo.wjoin(f)) if f2: repo.ui.note(_("getting %s to %s\n") % (f2, fd)) t = mctx.filectx(f2).data() diff -r 0935ff767285 -r 6bf39d88c857 mercurial/util.py --- a/mercurial/util.py Wed Jan 05 15:56:03 2011 +0100 +++ b/mercurial/util.py Sun Jan 02 19:34:41 2011 +0100 @@ -431,7 +431,7 @@ return check -def unlink(f): +def unlinkpath(f): """unlink and remove the directory if it is empty""" os.unlink(f) # try removing directories that might now be empty diff -r 0935ff767285 -r 6bf39d88c857 mercurial/windows.py --- a/mercurial/windows.py Wed Jan 05 15:56:03 2011 +0100 +++ b/mercurial/windows.py Sun Jan 02 19:34:41 2011 +0100 @@ -276,7 +276,7 @@ break head, tail = os.path.split(head) -def unlink(f): +def unlinkpath(f): """unlink and remove the directory if it is empty""" os.unlink(f) # try removing directories that might now be empty