Auto merge of #18828 - servo:clean, r=asajeffrey

Fix a couple bugs in `./mach clean-nightlies`

<!-- Reviewable:start -->
This change is [<img src="https://reviewable.io/review_button.svg" height="34" align="absmiddle" alt="Reviewable"/>](https://reviewable.io/reviews/servo/servo/18828)
<!-- Reviewable:end -->
This commit is contained in:
bors-servo 2017-10-13 17:51:48 -05:00 committed by GitHub
commit d0159be172

View file

@ -314,15 +314,13 @@ class MachCommands(CommandBase):
if not path.isdir(base): if not path.isdir(base):
continue continue
for name in os.listdir(base): for name in os.listdir(base):
full_path = path.join(base, name)
if name.startswith("rust-"): if name.startswith("rust-"):
name = name[len("rust-"):] name = name[len("rust-"):]
# We append `-alt` if LLVM assertions aren't enabled, if name.endswith("-alt"):
# so use just the commit hash itself. name = name[:-len("-alt")]
# This may occasionally leave an extra nightly behind if name not in to_keep:
# but won't remove too many nightlies.
if name.partition('-')[0] not in to_keep:
removing_anything = True removing_anything = True
full_path = path.join(base, name)
if force: if force:
print("Removing {}".format(full_path)) print("Removing {}".format(full_path))
try: try: