builder.author(author.getName().orNull()); builder.authorEmail(author.getEmail().orNull()); builder.authorTimestamp(author.getTimestamp()); builder.authorTimeZoneOffset(author.getTimeZoneOffset()); builder.committer(committer.getName().orNull());
builder.committerTimestamp(timestamp); builder.committerTimeZoneOffset(platform.timeZoneOffset(timestamp)); builder.authorTimestamp(until.getAuthor().getTimestamp());
builder.committer(authorName); builder.committerEmail(authorEmail); builder.authorTimestamp(timestamp); builder.author(authorName); builder.authorEmail(authorEmail);
public static List<RevCommit> createCommits(final int numCommits, @Nullable Platform platform) { LinkedList<RevCommit> commits = new LinkedList<>(); // much faster way of creating several fake commits than running CommitOp N times RevCommitBuilder builder = RevCommit.builder().platform(platform); long timeStamp = System.currentTimeMillis(); builder.author("gabe").authorEmail("gabe@example.com").committer("me") .committerEmail("me@too.com").committerTimestamp(timeStamp) .committerTimeZoneOffset(-1).authorTimestamp(timeStamp).authorTimeZoneOffset(-3) .treeId(RevTree.EMPTY_TREE_ID); ObjectId parent = null; for (int i = 1; i <= numCommits; i++) { ++timeStamp; builder.authorTimestamp(timeStamp).committerTimestamp(timeStamp); List<ObjectId> parents = parent == null ? null : ImmutableList.of(parent); RevCommit commit = builder.parentIds(parents).message("commit " + i).build(); commits.addFirst(commit); parent = commit.getId(); } return commits; } }
private RevCommitBuilder testCommit(ObjectId treeId, String author, String authorEmail, long authorTimestamp, String committer, String committerEmail, long committerTimestamp, String message, ObjectId... parentIds) { RevCommitBuilder b = RevCommit.builder(); b.treeId(treeId); b.author(author); b.authorEmail(authorEmail); b.committer(committer); b.committerEmail(committerEmail); b.message(message); b.authorTimestamp(authorTimestamp); b.committerTimestamp(committerTimestamp); if (parentIds != null) { b.parentIds(Lists.newArrayList(parentIds)); } return b; }
.authorTimestamp(authorTimeStamp)//
@Test public void testPassingNullToSetParentIds() throws Exception { RevCommitBuilder b = RevCommit.builder(); b.author("groldan"); b.authorEmail("groldan@boundlessgeo.com"); b.committer("jdeolive"); b.committerEmail("jdeolive@boundlessgeo.com"); b.message("cool this works"); b.authorTimestamp(1000L); ObjectId treeId = hashString("fake tree content"); b.treeId(treeId); b.parentIds(null); assertEquals(ImmutableList.of(), b.build().getParentIds()); }
@Test public void testNoMessage() throws Exception { RevCommitBuilder b = RevCommit.builder(); b.author("groldan"); b.authorEmail("groldan@boundlessgeo.com"); b.committer("jdeolive"); b.committerEmail("jdeolive@boundlessgeo.com"); b.message(null); b.authorTimestamp(1000L); ObjectId treeId = hashString("fake tree content"); b.treeId(treeId); ObjectId parentId1 = hashString("fake parent content 1"); ObjectId parentId2 = hashString("fake parent content 2"); List<ObjectId> parentIds = ImmutableList.of(parentId1, parentId2); b.parentIds(parentIds); assertEquals(null, b.message()); RevCommit commit2 = b.build(); assertEquals("", commit2.getMessage()); }
String authorEmail = "groldan@boundlessgeo.com"; builder.authorEmail(authorEmail); builder.authorTimestamp(currentTime); builder.authorTimeZoneOffset(timeZoneOffset); String committer = "mleslie";
@Test public void testCommitBuilder() throws Exception { RevCommitBuilder b = RevCommit.builder(); b.author("groldan"); b.authorEmail("groldan@boundlessgeo.com"); b.committer("jdeolive"); b.committerEmail("jdeolive@boundlessgeo.com"); b.message("cool this works"); b.authorTimestamp(1000L); ObjectId treeId = hashString("fake tree content"); b.treeId(treeId); ObjectId parentId1 = hashString("fake parent content 1"); ObjectId parentId2 = hashString("fake parent content 2"); List<ObjectId> parentIds = ImmutableList.of(parentId1, parentId2); b.parentIds(parentIds); RevCommit commit1 = b.build(); RevCommitBuilder builder = RevCommit.builder().init(commit1); assertEquals("groldan", builder.author()); assertEquals("jdeolive", builder.committer()); assertEquals("groldan@boundlessgeo.com", builder.authorEmail()); assertEquals("jdeolive@boundlessgeo.com", builder.committerEmail()); assertEquals(commit1.getMessage(), builder.message()); assertEquals(commit1.getParentIds(), builder.parentIds()); assertEquals(commit1.getTreeId(), builder.treeId()); assertEquals(commit1.getAuthor().getTimestamp(), builder.authorTimestamp().longValue()); RevCommit commit2 = builder.build(); assertEquals(commit1, commit2); }
b.committerTimestamp(1000L); b.committerTimeZoneOffset(10); b.authorTimestamp(500L); b.authorTimeZoneOffset(-5);
cb.treeId(masterCommit3.getTreeId()); long now = System.currentTimeMillis(); cb.authorTimestamp(now); cb.committerTimestamp(now); mergeCommit = cb.build();