Java Code Examples for org.eclipse.jgit.diff.DiffEntry#ChangeType
The following examples show how to use
org.eclipse.jgit.diff.DiffEntry#ChangeType .
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: Commit.java From SZZUnleashed with MIT License | 6 votes |
/** * Helper method to convert a Commit object to a JSON object. * * @return a JSONObject containing the commit. Omits the RevCommit. */ public JSONObject toJson() { JSONObject tree = new JSONObject(); JSONObject diffing = new JSONObject(); for (Map.Entry<String, DiffLines> diff : diffWithParent.entrySet()) { String file = diff.getKey(); JSONArray lines = new JSONArray(); DiffLines line = diff.getValue(); lines.add(line.getJSON()); diffing.put(file, lines); } tree.put("diff", diffing); JSONObject changes = new JSONObject(); for (Map.Entry<String, DiffEntry.ChangeType> changeType : changeTypes.entrySet()) { changes.put(changeType.getKey(), changeType.getValue().toString()); } tree.put("changes", changes); return tree; }
Example 2
Source File: GitParser.java From SZZUnleashed with MIT License | 6 votes |
/** * With each revision, check all files and build their line mapping graphs for each changed line. * * @param commits list of commits that should be traced. * @return the map containing annotation graphs for each file change by a commit. */ private AnnotationMap<String, List<FileAnnotationGraph>> buildLineMappingGraph( List<Commit> commits) throws IOException, GitAPIException { AnnotationMap<String, List<FileAnnotationGraph>> fileGraph = new AnnotationMap<>(); for (Commit commit : commits) { List<FileAnnotationGraph> graphs = new LinkedList<>(); for (Map.Entry<String, DiffEntry.ChangeType> file : commit.changeTypes.entrySet()) { FileAnnotationGraph tracedCommits = traceFileChanges(file.getKey(), commit, this.depth); graphs.add(tracedCommits); } fileGraph.put(commit.getHashString(), graphs); } return fileGraph; }
Example 3
Source File: CommitOptionPanel.java From onedev with MIT License | 5 votes |
private BlobChange getChange(TreeWalk treeWalk, RevCommit oldCommit, RevCommit newCommit) { DiffEntry.ChangeType changeType = DiffEntry.ChangeType.MODIFY; BlobIdent oldBlobIdent; if (!treeWalk.getObjectId(0).equals(ObjectId.zeroId())) { oldBlobIdent = new BlobIdent(oldCommit.name(), treeWalk.getPathString(), treeWalk.getRawMode(0)); } else { oldBlobIdent = new BlobIdent(oldCommit.name(), null, FileMode.TREE.getBits()); changeType = DiffEntry.ChangeType.ADD; } BlobIdent newBlobIdent; if (!treeWalk.getObjectId(1).equals(ObjectId.zeroId())) { newBlobIdent = new BlobIdent(newCommit.name(), treeWalk.getPathString(), treeWalk.getRawMode(1)); } else { newBlobIdent = new BlobIdent(newCommit.name(), null, FileMode.TREE.getBits()); changeType = DiffEntry.ChangeType.DELETE; } return new BlobChange(changeType, oldBlobIdent, newBlobIdent, WhitespaceOption.DEFAULT) { @Override public Blob getBlob(BlobIdent blobIdent) { return context.getProject().getBlob(blobIdent, true); } }; }
Example 4
Source File: CommitTreeInfo.java From fabric8-forge with Apache License 2.0 | 5 votes |
public CommitTreeInfo(String path, String name, long size, int mode, String id, String commitId, DiffEntry.ChangeType changeType) { this.path = path; this.name = name; this.size = size; this.mode = mode; this.id = id; this.commitId = commitId; this.changeType = changeType; }
Example 5
Source File: DiffInfo.java From fabric8-forge with Apache License 2.0 | 5 votes |
public DiffInfo(DiffEntry.ChangeType changeType, String newPath, int newMode, String oldPath, int oldMode, String diff) { this.changeType = changeType; this.newPath = newPath; this.newMode = newMode; this.oldPath = oldPath; this.oldMode = oldMode; this.diff = diff; }
Example 6
Source File: ChangeTypeConsistencyTest.java From smart-testing with Apache License 2.0 | 4 votes |
@Parameterized.Parameters public static Iterable<DiffEntry.ChangeType> jgitChangeTypes() { return Arrays.asList(DiffEntry.ChangeType.values()); }
Example 7
Source File: ChangeTypeConsistencyTest.java From smart-testing with Apache License 2.0 | 4 votes |
public ChangeTypeConsistencyTest(DiffEntry.ChangeType diffEntryChangeType) { this.diffEntryChangeType = diffEntryChangeType; }
Example 8
Source File: CommitTreeInfo.java From fabric8-forge with Apache License 2.0 | 4 votes |
public DiffEntry.ChangeType getChangeType() { return changeType; }
Example 9
Source File: CommitTreeInfo.java From fabric8-forge with Apache License 2.0 | 4 votes |
public void setChangeType(DiffEntry.ChangeType changeType) { this.changeType = changeType; }
Example 10
Source File: DiffInfo.java From fabric8-forge with Apache License 2.0 | 4 votes |
public DiffEntry.ChangeType getChangeType() { return changeType; }
Example 11
Source File: ChangeTypeMapper.java From coderadar with MIT License | 4 votes |
public static ChangeType jgitToCoderadar(DiffEntry.ChangeType changeType) { return ChangeType.valueOf(changeType.name()); }
Example 12
Source File: ChangeTypeMapper.java From coderadar with MIT License | 4 votes |
public static DiffEntry.ChangeType coderadarToJgit(ChangeType changeType) { return DiffEntry.ChangeType.valueOf(changeType.name()); }