diff -r 32fde51910c0 -r c6e6ca96a033 mercurial/util.py --- a/mercurial/util.py Wed Oct 19 00:05:08 2005 -0700 +++ b/mercurial/util.py Wed Oct 19 00:10:52 2005 -0700 @@ -310,6 +310,13 @@ os.unlink(dst) os.rename(src, dst) +def unlink(f): + """unlink and remove the directory if it is empty""" + os.unlink(f) + # try removing directories that might now be empty + try: os.removedirs(os.path.dirname(f)) + except: pass + def copyfiles(src, dst, hardlink=None): """Copy a directory tree using hardlinks if possible"""