本文整理匯總了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());
}