filter-repo: avoid aborting on a second --analyze run

Users may want to run --analyze both before and after filtering in
order to both find the big objects to remove and to verify they are
gone and the overall repository size and filenames are as expected.
As such, aborting and telling the user there's a previous analysis
directory in the way is annoying; just remove it instead.

Signed-off-by: Elijah Newren <newren@gmail.com>
pull/13/head
Elijah Newren 5 years ago
parent 76147f13d4
commit 623792ee31

@ -16,6 +16,7 @@ import collections
import fnmatch
import os
import re
import shutil
import StringIO
import subprocess
import sys
@ -2475,8 +2476,7 @@ class RepoAnalyze(object):
os.mkdir(results_tmp_dir)
reportdir = os.path.join(results_tmp_dir, "analysis")
if not args.force and os.path.isdir(reportdir):
raise SystemExit("Error: {} already exists; refusing to overwrite!".
format(reportdir))
shutil.rmtree(reportdir)
os.mkdir(reportdir)
# Gather the data we need

Loading…
Cancel
Save