From 534cd3046b8e44cf1cab1890dff1a9aee8d3628f Mon Sep 17 00:00:00 2001 From: UK992 Date: Sat, 22 Apr 2017 21:35:04 +0200 Subject: [PATCH 1/2] Auto clean old nightlies on Travis --- .travis.yml | 2 ++ 1 file changed, 2 insertions(+) diff --git a/.travis.yml b/.travis.yml index c9652e696a2..d6dc6cc89b4 100644 --- a/.travis.yml +++ b/.travis.yml @@ -28,6 +28,8 @@ matrix: - .cargo - .servo - $HOME/.ccache + before_cache: + - ./mach clean-nightlies --keep 2 --force env: CCACHE=/usr/bin/ccache addons: apt: From c5f13063a52f4ca415f90f3f259072af368ba79c Mon Sep 17 00:00:00 2001 From: UK992 Date: Sat, 22 Apr 2017 22:50:52 +0200 Subject: [PATCH 2/2] Optimize `clean-nightlies` --- python/servo/bootstrap_commands.py | 13 ++++--------- 1 file changed, 4 insertions(+), 9 deletions(-) diff --git a/python/servo/bootstrap_commands.py b/python/servo/bootstrap_commands.py index 28b5d4fa673..b12d8082d88 100644 --- a/python/servo/bootstrap_commands.py +++ b/python/servo/bootstrap_commands.py @@ -306,19 +306,14 @@ class MachCommands(CommandBase): for tool in ["rust", "cargo"]: commit_file = '{}-commit-hash'.format(tool) cmd = subprocess.Popen( - ['git', 'log', '--pretty=format:%H', '-n', keep, commit_file], + ['git', 'log', '--oneline', '--no-color', '-n', keep, '--patch', commit_file], stdout=subprocess.PIPE, universal_newlines=True ) stdout, _ = cmd.communicate() - for commit in stdout.splitlines(): - cmd = subprocess.Popen( - ['git', 'show', '{}:{}'.format(commit, commit_file)], - stdout=subprocess.PIPE, - universal_newlines=True - ) - commit_hash, _ = cmd.communicate() - to_keep[tool].add(commit_hash.rstrip()) + for line in stdout.splitlines(): + if line.startswith("+") and not line.startswith("+++"): + to_keep[tool].add(line[1:]) removing_anything = False for tool in ["rust", "cargo"]: