# HG changeset patch # User Doug Simon # Date 1362217976 -14400 # Node ID 0df252296c8d846edc5e5b86f1a269f13864f94d # Parent 06ecee106195999901f54aa3410d97c1fd4da95f added fsckproject command to mx for removing directories corresponding to deleted projects. This command is also called from the ideinit command (GRAAL-90) diff -r 06ecee106195 -r 0df252296c8d mxtool/mx.py --- a/mxtool/mx.py Sat Mar 02 09:53:47 2013 +0400 +++ b/mxtool/mx.py Sat Mar 02 13:52:56 2013 +0400 @@ -2474,6 +2474,25 @@ """(re)generate Eclipse and NetBeans project configurations""" eclipseinit(args, suite) netbeansinit(args, suite) + fsckprojects([]) + +def fsckprojects(args): + """find directories corresponding to deleted Java projects and delete them""" + for suite in suites(): + projectDirs = [p.dir for p in suite.projects] + for root, dirnames, files in os.walk(suite.dir): + currentDir = join(suite.dir, root) + if currentDir in projectDirs: + # don't traverse subdirs of an existing project + dirnames[:] = [] + else: + projectConfigFiles = frozenset(['.classpath', 'nbproject']) + indicators = projectConfigFiles.intersection(files) + if len(indicators) != 0: + response = raw_input(currentDir + ' looks like a removed project -- delete it? [yn]: ') + if 'y' == response: + shutil.rmtree(currentDir) + log('Deleted ' + currentDir) def javadoc(args, parser=None, docDir='javadoc', includeDeps=True): """generate javadoc for some/all Java projects""" @@ -2926,6 +2945,7 @@ 'eclipseinit': [eclipseinit, ''], 'eclipseformat': [eclipseformat, ''], 'findclass': [findclass, ''], + 'fsckprojects': [fsckprojects, ''], 'help': [help_, '[command]'], 'ideclean': [ideclean, ''], 'ideinit': [ideinit, ''],