當前位置: 首頁>>代碼示例>>Java>>正文


Java DiffEntry.ChangeType方法代碼示例

本文整理匯總了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);
    }
}
 
開發者ID:kiegroup,項目名稱:appformer,代碼行數:18,代碼來源:JGitWatchEvent.java

示例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);
    }
}
 
開發者ID:nemerosa,項目名稱:ontrack,代碼行數:17,代碼來源:GitRepositoryClientImpl.java

示例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;
    }
}
 
開發者ID:morimekta,項目名稱:gittool,代碼行數:24,代碼來源:FileStatus.java

示例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);
		}

	};
}
 
開發者ID:jmfgdev,項目名稱:gitplex-mit,代碼行數:28,代碼來源:CommitOptionPanel.java

示例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;
}
 
開發者ID:fabric8io,項目名稱:fabric8-forge,代碼行數:10,代碼來源:CommitTreeInfo.java

示例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;
}
 
開發者ID:fabric8io,項目名稱:fabric8-forge,代碼行數:9,代碼來源:DiffInfo.java

示例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);
            }
        }
    }
}
 
開發者ID:naver,項目名稱:svngit,代碼行數:36,代碼來源:SVNGitMergeHandler.java

示例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;
}
 
開發者ID:ModelN,項目名稱:build-management,代碼行數:37,代碼來源:CMnGitServer.java

示例9: jgitChangeTypes

import org.eclipse.jgit.diff.DiffEntry; //導入方法依賴的package包/類
@Parameterized.Parameters
public static Iterable<DiffEntry.ChangeType> jgitChangeTypes() {
    return Arrays.asList(DiffEntry.ChangeType.values());
}
 
開發者ID:arquillian,項目名稱:smart-testing,代碼行數:5,代碼來源:ChangeTypeConsistencyTest.java

示例10: ChangeTypeConsistencyTest

import org.eclipse.jgit.diff.DiffEntry; //導入方法依賴的package包/類
public ChangeTypeConsistencyTest(DiffEntry.ChangeType diffEntryChangeType) {
    this.diffEntryChangeType = diffEntryChangeType;
}
 
開發者ID:arquillian,項目名稱:smart-testing,代碼行數:4,代碼來源:ChangeTypeConsistencyTest.java

示例11: getChangeType

import org.eclipse.jgit.diff.DiffEntry; //導入方法依賴的package包/類
public DiffEntry.ChangeType getChangeType() {
    return changeType;
}
 
開發者ID:fabric8io,項目名稱:fabric8-forge,代碼行數:4,代碼來源:CommitTreeInfo.java

示例12: setChangeType

import org.eclipse.jgit.diff.DiffEntry; //導入方法依賴的package包/類
public void setChangeType(DiffEntry.ChangeType changeType) {
    this.changeType = changeType;
}
 
開發者ID:fabric8io,項目名稱:fabric8-forge,代碼行數:4,代碼來源:CommitTreeInfo.java

示例13: getUpdates

import org.eclipse.jgit.diff.DiffEntry; //導入方法依賴的package包/類
public Map<String, DiffEntry.ChangeType> getUpdates() {
	return updates;
}
 
開發者ID:naver,項目名稱:svngit,代碼行數:4,代碼來源:TreeBuilder.java

示例14: Result

import org.eclipse.jgit.diff.DiffEntry; //導入方法依賴的package包/類
public Result(Map<String, DiffEntry.ChangeType> updates, ObjectId treeId) {
	this.updates = updates;
	this.treeId = treeId;
}
 
開發者ID:naver,項目名稱:svngit,代碼行數:5,代碼來源:TreeBuilder.java

示例15: jgitToCoderadar

import org.eclipse.jgit.diff.DiffEntry; //導入方法依賴的package包/類
public ChangeType jgitToCoderadar(DiffEntry.ChangeType changeType) {
  return ChangeType.valueOf(changeType.name());
}
 
開發者ID:reflectoring,項目名稱:coderadar,代碼行數:4,代碼來源:ChangeTypeMapper.java


注:本文中的org.eclipse.jgit.diff.DiffEntry.ChangeType方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。