Class GitUtils
java.lang.Object
edu.handong.csee.isel.bic.szz.util.GitUtils
public class GitUtils
extends java.lang.Object
The
collects of functions necessary to execute AG_SZZ
GitUtils class collects of functions necessary to execute AG_SZZ
- Author:
- SJ, JY
-
Field Summary
Fields Modifier and Type Field Description static org.eclipse.jgit.diff.DiffAlgorithmdiffAlgorithmstatic org.eclipse.jgit.diff.RawTextComparatordiffComparator -
Constructor Summary
Constructors Constructor Description GitUtils() -
Method Summary
Modifier and Type Method Description static RevsWithPathcollectRevsWithSpecificPath(java.util.List<PathRevision> pathRevisions, java.util.List<java.lang.String> targetPaths)Collect commit list related specific pathstatic java.util.List<PathRevision>configurePathRevisionList(org.eclipse.jgit.lib.Repository repo, java.util.List<org.eclipse.jgit.revwalk.RevCommit> commits)Get the path where change exists for all commit lists.static java.util.List<org.eclipse.jgit.diff.DiffEntry>diff(org.eclipse.jgit.lib.Repository repo, org.eclipse.jgit.revwalk.RevTree parentTree, org.eclipse.jgit.revwalk.RevTree childTree)Conduct diff using diffAlgorithm that is MYERS Algorithm and diffComparator that is white space ignore all.static java.lang.StringfetchBlob(org.eclipse.jgit.lib.Repository repo, java.lang.String revSpec, java.lang.String path)static java.lang.StringfetchBlob(org.eclipse.jgit.lib.Repository repo, org.eclipse.jgit.revwalk.RevCommit commit, java.lang.String path)get the file content using path info and commit infostatic java.util.ArrayList<org.eclipse.jgit.revwalk.RevCommit>getBFCList(java.util.List<java.lang.String> issueKeys, java.util.List<org.eclipse.jgit.revwalk.RevCommit> revs)static org.eclipse.jgit.diff.EditListgetEditListFromDiff(java.lang.String file1, java.lang.String file2)static java.util.List<org.eclipse.jgit.revwalk.RevCommit>getRevs(org.eclipse.jgit.api.Git git)static java.util.List<java.lang.String>getTargetPaths(org.eclipse.jgit.lib.Repository repo, java.util.List<org.eclipse.jgit.revwalk.RevCommit> BFCList)collect target path from bug fixing commit list.
only java file path and file with change.
-
Field Details
-
diffAlgorithm
public static org.eclipse.jgit.diff.DiffAlgorithm diffAlgorithm -
diffComparator
public static org.eclipse.jgit.diff.RawTextComparator diffComparator
-
-
Constructor Details
-
GitUtils
public GitUtils()
-
-
Method Details
-
getEditListFromDiff
public static org.eclipse.jgit.diff.EditList getEditListFromDiff(java.lang.String file1, java.lang.String file2) -
diff
public static java.util.List<org.eclipse.jgit.diff.DiffEntry> diff(org.eclipse.jgit.lib.Repository repo, org.eclipse.jgit.revwalk.RevTree parentTree, org.eclipse.jgit.revwalk.RevTree childTree) throws java.io.IOExceptionConduct diff using diffAlgorithm that is MYERS Algorithm and diffComparator that is white space ignore all.- Parameters:
repo- Github repositoryparentTree- parent commit treechildTree- child commit tree- Returns:
- diffs file path with change
- Throws:
java.io.IOException- repository open faild
-
configurePathRevisionList
public static java.util.List<PathRevision> configurePathRevisionList(org.eclipse.jgit.lib.Repository repo, java.util.List<org.eclipse.jgit.revwalk.RevCommit> commits) throws java.io.IOExceptionGet the path where change exists for all commit lists.- Parameters:
repo- Github repositorycommits- all commit list from input github project- Returns:
- paths java file path with change
- Throws:
java.io.IOException- IOException
-
collectRevsWithSpecificPath
public static RevsWithPath collectRevsWithSpecificPath(java.util.List<PathRevision> pathRevisions, java.util.List<java.lang.String> targetPaths)Collect commit list related specific path- Parameters:
pathRevisions- information commit and pathtargetPaths- target Paths- Returns:
- revsWithPath revs With Path
-
fetchBlob
public static java.lang.String fetchBlob(org.eclipse.jgit.lib.Repository repo, org.eclipse.jgit.revwalk.RevCommit commit, java.lang.String path) throws org.eclipse.jgit.errors.LargeObjectException, org.eclipse.jgit.errors.MissingObjectException, java.io.IOExceptionget the file content using path info and commit info- Parameters:
repo- Github repositorycommit- commitpath- target path- Returns:
- string All file content
- Throws:
org.eclipse.jgit.errors.LargeObjectException- LargeObjectExceptionorg.eclipse.jgit.errors.MissingObjectException- MissingObjectExceptionjava.io.IOException- IOException
-
fetchBlob
public static java.lang.String fetchBlob(org.eclipse.jgit.lib.Repository repo, java.lang.String revSpec, java.lang.String path) throws org.eclipse.jgit.errors.RevisionSyntaxException, org.eclipse.jgit.errors.AmbiguousObjectException, org.eclipse.jgit.errors.IncorrectObjectTypeException, java.io.IOException- Throws:
org.eclipse.jgit.errors.RevisionSyntaxExceptionorg.eclipse.jgit.errors.AmbiguousObjectExceptionorg.eclipse.jgit.errors.IncorrectObjectTypeExceptionjava.io.IOException
-
getRevs
public static java.util.List<org.eclipse.jgit.revwalk.RevCommit> getRevs(org.eclipse.jgit.api.Git git) throws org.eclipse.jgit.api.errors.NoHeadException, org.eclipse.jgit.api.errors.GitAPIException- Throws:
org.eclipse.jgit.api.errors.NoHeadExceptionorg.eclipse.jgit.api.errors.GitAPIException
-
getBFCList
public static java.util.ArrayList<org.eclipse.jgit.revwalk.RevCommit> getBFCList(java.util.List<java.lang.String> issueKeys, java.util.List<org.eclipse.jgit.revwalk.RevCommit> revs) -
getTargetPaths
public static java.util.List<java.lang.String> getTargetPaths(org.eclipse.jgit.lib.Repository repo, java.util.List<org.eclipse.jgit.revwalk.RevCommit> BFCList) throws java.io.IOExceptioncollect target path from bug fixing commit list.
only java file path and file with change.- Parameters:
repo- Github repositoryBFCList- bug fixing list- Returns:
- targetPaths path from bfc list
- Throws:
java.io.IOException- IOException
-