本文整理汇总了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;
}
示例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;
}
示例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));
}
示例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());
}