本文整理汇总了Java中org.eclipse.jgit.diff.DiffEntry.ChangeType方法的典型用法代码示例。如果您正苦于以下问题:Java DiffEntry.ChangeType方法的具体用法?Java DiffEntry.ChangeType怎么用?Java DiffEntry.ChangeType使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类org.eclipse.jgit.diff.DiffEntry
的用法示例。
在下文中一共展示了DiffEntry.ChangeType方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: kind
import org.eclipse.jgit.diff.DiffEntry; //导入方法依赖的package包/类
@Override
public WatchEvent.Kind kind() {
DiffEntry.ChangeType changeType = DiffEntry.ChangeType.valueOf(this.changeType);
switch (changeType) {
case ADD:
case COPY:
return StandardWatchEventKind.ENTRY_CREATE;
case DELETE:
return StandardWatchEventKind.ENTRY_DELETE;
case MODIFY:
return StandardWatchEventKind.ENTRY_MODIFY;
case RENAME:
return StandardWatchEventKind.ENTRY_RENAME;
default:
throw new RuntimeException("Unsupported change type: " + changeType);
}
}
示例2: toChangeType
import org.eclipse.jgit.diff.DiffEntry; //导入方法依赖的package包/类
protected GitChangeType toChangeType(DiffEntry.ChangeType changeType) {
switch (changeType) {
case ADD:
return GitChangeType.ADD;
case COPY:
return GitChangeType.COPY;
case DELETE:
return GitChangeType.DELETE;
case MODIFY:
return GitChangeType.MODIFY;
case RENAME:
return GitChangeType.RENAME;
default:
throw new IllegalArgumentException("Unknown diff change type: " + changeType);
}
}
示例3: getOverallChange
import org.eclipse.jgit.diff.DiffEntry; //导入方法依赖的package包/类
public DiffEntry.ChangeType getOverallChange() {
if (staged == null) {
return unstaged.getChangeType();
} else if (unstaged == null) {
return staged.getChangeType();
} else {
if (unstaged.getChangeType() == DiffEntry.ChangeType.DELETE) {
return DiffEntry.ChangeType.DELETE;
}
if (staged.getChangeType() == DiffEntry.ChangeType.ADD) {
return DiffEntry.ChangeType.ADD;
}
if (getNewestPath().equals(getOldestPath())) {
return DiffEntry.ChangeType.MODIFY;
}
// With if the file was copies at least *once*, then it is copied.
if (staged.getChangeType() == DiffEntry.ChangeType.COPY ||
unstaged.getChangeType() == DiffEntry.ChangeType.COPY) {
return DiffEntry.ChangeType.COPY;
}
return DiffEntry.ChangeType.RENAME;
}
}
示例4: getChange
import org.eclipse.jgit.diff.DiffEntry; //导入方法依赖的package包/类
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);
}
};
}
示例5: CommitTreeInfo
import org.eclipse.jgit.diff.DiffEntry; //导入方法依赖的package包/类
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;
}
示例6: DiffInfo
import org.eclipse.jgit.diff.DiffEntry; //导入方法依赖的package包/类
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;
}
示例7: doResources
import org.eclipse.jgit.diff.DiffEntry; //导入方法依赖的package包/类
private void doResources(FSRevisionRoot root, StringBuffer buffer) throws SVNException {
Map sentPaths = new HashMap();
for (String path : updates.keySet()) {
DiffEntry.ChangeType type = updates.get(path);
boolean sendSelf = false;
boolean sendParent = false;
if (type == DiffEntry.ChangeType.DELETE) {
sendSelf = false;
sendParent = true;
} else if (type == DiffEntry.ChangeType.ADD || type == DiffEntry.ChangeType.MODIFY) {
sendSelf = true;
sendParent = true;
} else {
sendSelf = true;
sendParent = false;
}
if (sendSelf) {
if (!sentPaths.containsKey(path)) {
SVNNodeKind pathKind = root.checkNodeKind(path);
sendResponse(root, path, pathKind == SVNNodeKind.DIR, buffer);
sentPaths.put(path, path);
}
}
if (sendParent) {
String parentPath = SVNPathUtil.removeTail(path);
if (!sentPaths.containsKey(parentPath)) {
sendResponse(root, parentPath, true, buffer);
sentPaths.put(parentPath, parentPath);
}
}
}
}
示例8: convert
import org.eclipse.jgit.diff.DiffEntry; //导入方法依赖的package包/类
/**
* Construct a generic file object from the attributes of a git DiffEntry.
*
* @param diff DiffEntry data object
* @return CMnFile data object
*/
private CMnFile convert(DiffEntry diff) {
String filename = diff.getNewPath();
CMnFile.Operation op = null;
DiffEntry.ChangeType changeType = diff.getChangeType();
if (changeType == DiffEntry.ChangeType.ADD){
op = CMnFile.Operation.ADD;
} else if (changeType == DiffEntry.ChangeType.DELETE){
op = CMnFile.Operation.DELETE;
} else if (changeType == DiffEntry.ChangeType.RENAME){
op = CMnFile.Operation.RENAME;
} else {
op = CMnFile.Operation.EDIT;
}
CMnFile file = new CMnFile(filename, op);
// Convert the file diff to a string
try {
OutputStream out = new ByteArrayOutputStream();
DiffFormatter df = new DiffFormatter(out);
df.setRepository(repository.getRepository());
df.setDiffComparator(diffComparator);
df.setDetectRenames(true);
df.format(diff);
df.flush();
file.setDiff(out.toString());
} catch (IOException ioex) {
}
return file;
}
示例9: jgitChangeTypes
import org.eclipse.jgit.diff.DiffEntry; //导入方法依赖的package包/类
@Parameterized.Parameters
public static Iterable<DiffEntry.ChangeType> jgitChangeTypes() {
return Arrays.asList(DiffEntry.ChangeType.values());
}
示例10: ChangeTypeConsistencyTest
import org.eclipse.jgit.diff.DiffEntry; //导入方法依赖的package包/类
public ChangeTypeConsistencyTest(DiffEntry.ChangeType diffEntryChangeType) {
this.diffEntryChangeType = diffEntryChangeType;
}
示例11: getChangeType
import org.eclipse.jgit.diff.DiffEntry; //导入方法依赖的package包/类
public DiffEntry.ChangeType getChangeType() {
return changeType;
}
示例12: setChangeType
import org.eclipse.jgit.diff.DiffEntry; //导入方法依赖的package包/类
public void setChangeType(DiffEntry.ChangeType changeType) {
this.changeType = changeType;
}
示例13: getUpdates
import org.eclipse.jgit.diff.DiffEntry; //导入方法依赖的package包/类
public Map<String, DiffEntry.ChangeType> getUpdates() {
return updates;
}
示例14: Result
import org.eclipse.jgit.diff.DiffEntry; //导入方法依赖的package包/类
public Result(Map<String, DiffEntry.ChangeType> updates, ObjectId treeId) {
this.updates = updates;
this.treeId = treeId;
}
示例15: jgitToCoderadar
import org.eclipse.jgit.diff.DiffEntry; //导入方法依赖的package包/类
public ChangeType jgitToCoderadar(DiffEntry.ChangeType changeType) {
return ChangeType.valueOf(changeType.name());
}