This commit is contained in:
Faik Uygur
2006-04-11 14:11:02 +00:00
parent 6817c61368
commit dc6e267bd1
+6 -2
View File
@@ -411,8 +411,12 @@ class Remove(AtomicOperation):
else: else:
if os.path.isfile(fpath) or os.path.islink(fpath): if os.path.isfile(fpath) or os.path.islink(fpath):
os.unlink(fpath) os.unlink(fpath)
elif os.path.isdir(fpath) and os.listdir(fpath)==[]: dpath = os.path.dirname(fpath)
os.rmdir(fpath) # remove directory if there is nothing under it while dpath != '/' and not os.listdir(dpath):
os.rmdir(dpath)
dpath = os.path.dirname(dpath)
elif os.path.isdir(fpath) and not os.listdir(fpath):
os.rmdir(fpath)
else: else:
ctx.ui.warning(_('Not removing non-file, non-link %s') % fpath, True) ctx.ui.warning(_('Not removing non-file, non-link %s') % fpath, True)