List of usage examples for org.eclipse.jgit.storage.pack PackConfig DEFAULT_BIG_FILE_THRESHOLD
int DEFAULT_BIG_FILE_THRESHOLD
To view the source code for org.eclipse.jgit.storage.pack PackConfig DEFAULT_BIG_FILE_THRESHOLD.
Click Source Link
From source file:jbenchmarker.trace.git.GitWalker.java
License:Open Source License
/** * For all registred parent combinaison place git repository in merged state * it finds file from id in next commit and it compares with file in * repository In phase 3/*w w w. ja v a2 s .c o m*/ * * @throws Exception */ public void mesuresDiff() throws Exception { // int commit = 0; ProgressBar progress = new ProgressBar(idCommitParentsToFiles.keySet().size()); /* double commitPercent = idCommitParentsToFiles.keySet().size() / 100.0; double nextStep = commitPercent;*/ for (String idcommitParent : idCommitParentsToFiles.keySet()) { logger.log(Level.INFO, "Treat Commit {0}", idcommitParent); /* * place git repository in merged state with parents */ gitPositionMerge(commitParent.getAll(idcommitParent)); /* * Foreach file must be compared in this state */ for (Couple c : idCommitParentsToFiles.getAll(idcommitParent)) { RawText stateAfterMerge = EmptyFile; RawText stateAfterCommit = EmptyFile; /* * get file in this repository */ File f = new File(gitDir + "/" + c.getFileName()); if (f.exists()) { // if file is existing after merge launchAndWait("sed /^[<=>][<=>][<=>][<=>]/d -i " + f.getPath()); stateAfterMerge = new RawText(f); } else { logger.log(Level.WARNING, "File{0} not found !", f.getPath()); } /* * get file from git with id. */ try { ObjectLoader ldr = source.open(c.fileName, c.getId()); ldr.getType(); stateAfterCommit = new RawText(ldr.getBytes(PackConfig.DEFAULT_BIG_FILE_THRESHOLD)); } catch (LargeObjectException.ExceedsLimit overLimit) {// File is overlimits => binary logger.log(Level.WARNING, "File {0} overlimits !", c.getFileName()); continue; } catch (LargeObjectException.ExceedsByteArrayLimit overLimit) {// File is overlimits => binary logger.log(Level.WARNING, "File {0} exceed limits!", c.getFileName()); continue; } catch (Exception ex) { // if another exception like inexitant considere 0 file. logger.log(Level.WARNING, "File {0} not found in after commit !", c.getFileName()); } /* * make a diff with this file */ EditList editList = diffAlgorithm.diff(RawTextComparator.DEFAULT, stateAfterMerge, stateAfterCommit); BlockLine editCount = files.get(c.fileName); editCount.incrementPass(); for (Edit ed : editList) {// Count line replace is two time counted editCount.addLine(ed.getEndA() - ed.getBeginA() + ed.getEndB() - ed.getBeginB()); } //Count the block size editCount.addBlock(editList.size()); } logger.info("Next"); // commit++; if (progressBar) { progress.progress(1); } } }