This commit is contained in:
mimic
2020-06-08 11:43:24 +02:00
parent e25310a882
commit 296120cf83
9 changed files with 180 additions and 1140 deletions
+8
View File
@@ -5,9 +5,17 @@
<file url="file://$PROJECT_DIR$/gumtree" charset="UTF-8" />
<file url="file://$PROJECT_DIR$/gumtree/client" charset="UTF-8" />
<file url="file://$PROJECT_DIR$/gumtree/client.diff" charset="UTF-8" />
<file url="file://$PROJECT_DIR$/gumtree/client.diff/src/main/java" charset="UTF-8" />
<file url="file://$PROJECT_DIR$/gumtree/client.diff/src/main/resources" charset="UTF-8" />
<file url="file://$PROJECT_DIR$/gumtree/client/src/main/java" charset="UTF-8" />
<file url="file://$PROJECT_DIR$/gumtree/core" charset="UTF-8" />
<file url="file://$PROJECT_DIR$/gumtree/core/src/main/java" charset="UTF-8" />
<file url="file://$PROJECT_DIR$/gumtree/gen.jdt" charset="UTF-8" />
<file url="file://$PROJECT_DIR$/gumtree/gen.jdt/src/main/java" charset="UTF-8" />
<file url="file://$PROJECT_DIR$/gumtree/gen.srcml" charset="UTF-8" />
<file url="file://$PROJECT_DIR$/gumtree/gen.srcml/src/main/java" charset="UTF-8" />
<file url="file://$PROJECT_DIR$/richedit" charset="UTF-8" />
<file url="file://$PROJECT_DIR$/richedit/src/main/java" charset="UTF-8" />
<file url="file://$PROJECT_DIR$/src/main/resources" charset="UTF-8" />
</component>
</project>
+122 -1110
View File
File diff suppressed because it is too large Load Diff
+7
View File
@@ -71,6 +71,10 @@ In order to launch FixMiner, execute [fixminer.sh](python/fixminer.sh)
* Update [config file](src/main/resources/config.yml) with corresponding user paths.
* Install the project with maven from root. (usage [pom.xml](pom.xml))
```powershell
mvn clean install
```
* Active the conda environment from shell
```powershell
source activate fixminerEnv
@@ -81,6 +85,9 @@ In order to launch FixMiner, execute [fixminer.sh](python/fixminer.sh)
bash fixminer.sh [JOB] [CONFIG_FILE]
e.g. bash fixminer.sh dataset4c /Users/projects/release/fixminer_source/src/main/resources/config.yml
#### Redis Commands
hlen diffEntry
To see number of patches / diff entries computed rich edit
#### Job Types
+6
View File
@@ -0,0 +1,6 @@
#!/bin/bash
source activate fixminerEnv
PYTHONPATH=$(pwd) python -u python/main.py -root $(pwd)/python -job $2 -prop $1
Binary file not shown.
+2
View File
@@ -17,6 +17,8 @@ def createDS():
pjList = PROJECT_LIST.split(',')
if not os.path.exists(DATASET_PATH):
os.mkdir(DATASET_PATH)
if not os.path.exists(COMMIT_DFS):
os.mkdir(COMMIT_DFS)
subjects = pd.read_csv(join(ROOT,'data', 'dataset.csv'))
@@ -135,7 +135,8 @@ public class Launcher {
}
} catch (Exception e) {
log.error(e.getMessage());
// log.error(e.getMessage());
e.printStackTrace();
// e.printStackTrace();
}
@@ -29,37 +29,36 @@ public class EnhancedASTDiff {
public static void main(String inputPath, String portInner, String dbDir, String chunkName,String srcMLPath,String parameter,String hunkLimit,String[] projectList,String patchSize,String projectType) throws Exception {
String parameters = String.format("\nInput path %s",inputPath);
String parameters = String.format("\nInput path %s", inputPath);
log.info(parameters);
CallShell cs = new CallShell();
String cmd = "bash "+dbDir + "/" + "startServer.sh" +" %s %s %s";
String cmd = "bash " + dbDir + "/" + "startServer.sh" + " %s %s %s";
cmd = String.format(cmd, dbDir,chunkName,Integer.valueOf(portInner));
cmd = String.format(cmd, dbDir, chunkName, Integer.valueOf(portInner));
cs.runShell(cmd, portInner);
JedisPool innerPool = new JedisPool(PoolBuilder.getPoolConfig(), "127.0.0.1",Integer.valueOf(portInner),20000000);
JedisPool innerPool = new JedisPool(PoolBuilder.getPoolConfig(), "127.0.0.1", Integer.valueOf(portInner), 20000000);
boolean isJava = false;
if (projectType.equals("java")){
isJava =true;
if (projectType.equals("java")) {
isJava = true;
}
File folder = new File(inputPath);
File[] listOfFiles = folder.listFiles();
if(listOfFiles == null){
if (listOfFiles == null) {
throw new Exception("No projects found, please verify the projects in the input path");
}
Stream<File> stream = Arrays.stream(listOfFiles);
List<File> folders;
if (projectList.length == 1 && projectList[0].equals("")){
if (projectList.length == 1 && projectList[0].equals("")) {
folders = stream
.filter(x -> !x.getName().startsWith("."))
.filter(x -> !x.getName().startsWith("cocci"))
.filter(x -> !x.getName().endsWith(".index"))
.collect(Collectors.toList());
}
else {
} else {
List<Predicate<File>> allPredicates = new ArrayList<Predicate<File>>();
for (String s : projectList) {
Predicate<File> predicate = x -> x.getName().endsWith(s);
@@ -69,20 +68,16 @@ public class EnhancedASTDiff {
.filter(x -> !x.getName().startsWith("."))
.filter(x -> !x.getName().startsWith("cocci"))
.filter(x -> !x.getName().endsWith(".index"))
.filter(allPredicates.stream().reduce(x->false, Predicate::or))
.filter(allPredicates.stream().reduce(x -> false, Predicate::or))
.collect(Collectors.toList());
}
String project = folder.getName();
List<MessageFile> allMessageFiles = new ArrayList<>();
for (File target : folders) {
for (File target : folders) {
List<MessageFile> msgFiles = getMessageFiles(target.toString() + "/",project,patchSize,isJava); //"/Users/anilkoyuncu/bugStudy/code/python/GumTreeInput/Apache/CAMEL/"
List<MessageFile> msgFiles = getMessageFiles(target.toString() + "/", project, patchSize, isJava); //"/Users/anilkoyuncu/bugStudy/code/python/GumTreeInput/Apache/CAMEL/"
// msgFiles = msgFiles.subList(0,3000);
if (msgFiles == null)
@@ -104,16 +99,25 @@ public class EnhancedASTDiff {
log.info("{} files to process ...", allMessageFiles.size());
}
boolean finalIsJava = isJava;
ProgressBar.wrap(allMessageFiles.stream().
parallel(),"Task").
// ProgressBar.wrap(allMessageFiles.stream().
// parallel(),"Task").
// forEach(m ->
// {
// EDiffHunkParser parser = new EDiffHunkParser();
// parser.parseFixPatterns(m.getPrevFile(),m.getRevFile(), m.getDiffEntryFile(),project,innerPool,srcMLPath,hunkLimit, finalIsJava);
// }
// );
//
// }
allMessageFiles.stream().
parallel().
forEach(m ->
{
EDiffHunkParser parser = new EDiffHunkParser();
parser.parseFixPatterns(m.getPrevFile(),m.getRevFile(), m.getDiffEntryFile(),project,innerPool,srcMLPath,hunkLimit, finalIsJava);
EDiffHunkParser parser = new EDiffHunkParser();
parser.parseFixPatterns(m.getPrevFile(), m.getRevFile(), m.getDiffEntryFile(), project, innerPool, srcMLPath, hunkLimit, finalIsJava);
}
);
}
}
+6 -6
View File
@@ -7,12 +7,12 @@ coccinelle:
dataset:
# home: /Users/anilkoyuncu/projects/fixminer/fixminer-core/python/data/gumInputLinux
inputPath : /Users/anilkoyuncu/projects/test/fixminer-data/patches
repo: /Users/anilkoyuncu/projects/test/fixminer-data/datasets
inputPath : /Users/anil.koyuncu/projects/release/fixminer-data/patches
repo: /Users/anil.koyuncu/projects/release/fixminer-data/datasets
fixminer:
projectType : java
datapath: /Users/anilkoyuncu/projects/test/fixminer-data/
datapath: /Users/anil.koyuncu/projects/release/fixminer-data/
pjName : patches
@@ -22,7 +22,7 @@ fixminer:
hunkLimit : 2
patchSize : 50
projectList : spring-shell,fuse,metadata,commons-codec,commons-collections,commons-compress,commons-configuration,commons-crypto,commons-csv
inputPath : /Users/anilkoyuncu/projects/test/fixminer-data/patches
redisPath : /Users/anilkoyuncu/projects/release/test/fixminer_source/python/data/redis
projectList : fuse
inputPath : /Users/anil.koyuncu/projects/release/fixminer-data/patches
redisPath : /Users/anil.koyuncu/projects/release/fixminer_source/python/data/redis
srcMLPath : /usr/local/bin/srcml