up up and away...
This commit is contained in:
@@ -411,14 +411,17 @@ 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)
|
||||||
dpath = os.path.dirname(fpath)
|
elif os.path.isdir(fpath) and not os.listdir(fpath):
|
||||||
while dpath != '/' and not os.listdir(dpath):
|
os.rmdir(fpath)
|
||||||
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)
|
||||||
|
return
|
||||||
|
|
||||||
|
# remove emptied directories
|
||||||
|
dpath = os.path.dirname(fpath)
|
||||||
|
while dpath != '/' and not os.listdir(dpath):
|
||||||
|
os.rmdir(dpath)
|
||||||
|
dpath = os.path.dirname(dpath)
|
||||||
|
|
||||||
remove_file = staticmethod(remove_file)
|
remove_file = staticmethod(remove_file)
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user