当前位置: 首页>>代码示例>>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;未经允许,请勿转载。