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


Java ObjectId.equals方法代碼示例

本文整理匯總了Java中org.eclipse.jgit.lib.ObjectId.equals方法的典型用法代碼示例。如果您正苦於以下問題:Java ObjectId.equals方法的具體用法?Java ObjectId.equals怎麽用?Java ObjectId.equals使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在org.eclipse.jgit.lib.ObjectId的用法示例。


在下文中一共展示了ObjectId.equals方法的4個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。

示例1: processCommit

import org.eclipse.jgit.lib.ObjectId; //導入方法依賴的package包/類
/**
 * 
 * @param lastCommitId
 * @param treeId
 * @param repo
 * @param lastTreeId
 * @return
 * @throws IOException 
 */
public static ObjectId processCommit(ObjectId lastCommitId, ObjectId treeId, Repository repo, ObjectId lastTreeId) throws IOException {

    CommitBuilder commitBuilder = new CommitBuilder();

    ObjectId commitId = null;

    if (lastCommitId == null) {
        commitId = Commands.commit(commitBuilder, treeId, repo);
        System.out.println("Initial Commit: " + commitId);
    } else {
        if (lastTreeId.equals(treeId)) {
            // Do nothing, because there is no changes in the tree
            System.out.println("Did nothing, because there is no changes in the commited tree!\n");
        } else {
            commitBuilder.setParentId(lastCommitId);
            commitId = Commands.commit(commitBuilder, treeId, repo);
            System.out.println("Current Commit: " + commitId);
        }
    }

    return commitId;
}
 
開發者ID:alexmy21,項目名稱:gmds,代碼行數:32,代碼來源:Commands.java

示例2: getGitlinkStatus

import org.eclipse.jgit.lib.ObjectId; //導入方法依賴的package包/類
private GitStatus.Status getGitlinkStatus (int mode1, ObjectId id1, int mode2, ObjectId id2) {
    if (mode1 == FileMode.TYPE_GITLINK || mode2 == FileMode.TYPE_GITLINK) {
        if (mode1 == FileMode.TYPE_MISSING) {
            return GitStatus.Status.STATUS_REMOVED;
        } else if (mode2 == FileMode.TYPE_MISSING) {
            return GitStatus.Status.STATUS_ADDED;
        } else if (!id1.equals(id2)) {
            return GitStatus.Status.STATUS_MODIFIED;
        }
    }
    return GitStatus.Status.STATUS_NORMAL;
}
 
開發者ID:apache,項目名稱:incubator-netbeans,代碼行數:13,代碼來源:StatusCommand.java

示例3: testWithCache

import org.eclipse.jgit.lib.ObjectId; //導入方法依賴的package包/類
@Test
public void testWithCache() throws Exception {
	addFileAndCommit("initial", "", "initial commit");
	git.checkout().setName("feature1").setCreateBranch(true).call();
	addFileAndCommit("feature1", "", "add feature1");
	git.checkout().setName("master").call();
	addFileAndCommit("master", "", "add master");
	git.merge().include(git.getRepository().resolve("feature1")).setCommit(true).call();
	
	final ObjectId oldId = git.getRepository().resolve("master");
	final LastCommitsOfChildren oldLastCommits = new LastCommitsOfChildren(git.getRepository(), oldId);
	Cache cache = new Cache() {

		@Override
		public Map<String, Value> getLastCommitsOfChildren(ObjectId commitId) {
			if (commitId.equals(oldId))
				return oldLastCommits;
			else
				return null;
		}
		
	};
	assertEquals(oldLastCommits, new LastCommitsOfChildren(git.getRepository(), oldId, cache));
	
	git.checkout().setName("feature2").setCreateBranch(true).call();
	addFileAndCommit("initial", "hello", "modify initial");
	git.checkout().setName("master").call();
	git.merge().include(git.getRepository().resolve("feature2")).setCommit(true).call();

	ObjectId newId = git.getRepository().resolve("master");
	assertEquals(new LastCommitsOfChildren(git.getRepository(), newId), new LastCommitsOfChildren(git.getRepository(), newId, cache));
}
 
開發者ID:jmfgdev,項目名稱:gitplex-mit,代碼行數:33,代碼來源:LastCommitsOfChildrenTest.java

示例4: getRawText

import org.eclipse.jgit.lib.ObjectId; //導入方法依賴的package包/類
public static RawText getRawText (ObjectId id, ObjectDatabase db) throws IOException {
    if (id.equals(ObjectId.zeroId())) {
        return RawText.EMPTY_TEXT;
    }
    return new RawText(db.open(id, Constants.OBJ_BLOB).getCachedBytes());
}
 
開發者ID:apache,項目名稱:incubator-netbeans,代碼行數:7,代碼來源:Utils.java


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