From 22b285695a2980824c15363ef5fec709ebc3d434 Mon Sep 17 00:00:00 2001 From: "Shawn O. Pearce" Date: Mon, 23 Aug 2010 09:46:14 -0700 Subject: [PATCH] Rename Commit, Tag to CommitBuilder, TagBuilder Since these types no longer support reading, calling them a Builder is a better description of what they do. They help the caller to build a commit or a tag object. Change-Id: I53cae5a800a66ea1721b0fe5e702599df31da05d Signed-off-by: Shawn O. Pearce --- .../eclipse/jgit/junit/TestRepository.java | 13 ++++---- .../src/org/eclipse/jgit/pgm/Tag.java | 4 ++- .../jgit/pgm/debug/RebuildCommitGraph.java | 4 +-- .../eclipse/jgit/lib/ReflogConfigTest.java | 2 +- .../eclipse/jgit/merge/CherryPickTest.java | 4 +-- .../eclipse/jgit/merge/SimpleMergeTest.java | 4 +-- .../jgit/revwalk/RevCommitParseTest.java | 4 +-- .../eclipse/jgit/revwalk/RevTagParseTest.java | 4 +-- .../jgit/storage/file/T0003_Basic.java | 30 +++++++++---------- .../org/eclipse/jgit/api/CommitCommand.java | 6 ++-- .../lib/{Commit.java => CommitBuilder.java} | 4 +-- .../org/eclipse/jgit/lib/ObjectInserter.java | 4 +-- .../org/eclipse/jgit/lib/ObjectWriter.java | 4 +-- .../src/org/eclipse/jgit/lib/Repository.java | 4 +-- .../jgit/lib/{Tag.java => TagBuilder.java} | 2 +- 15 files changed, 49 insertions(+), 44 deletions(-) rename org.eclipse.jgit/src/org/eclipse/jgit/lib/{Commit.java => CommitBuilder.java} (99%) rename org.eclipse.jgit/src/org/eclipse/jgit/lib/{Tag.java => TagBuilder.java} (99%) diff --git a/org.eclipse.jgit.junit/src/org/eclipse/jgit/junit/TestRepository.java b/org.eclipse.jgit.junit/src/org/eclipse/jgit/junit/TestRepository.java index 9df4072b0..6e1f1db39 100644 --- a/org.eclipse.jgit.junit/src/org/eclipse/jgit/junit/TestRepository.java +++ b/org.eclipse.jgit.junit/src/org/eclipse/jgit/junit/TestRepository.java @@ -70,7 +70,6 @@ import org.eclipse.jgit.errors.MissingObjectException; import org.eclipse.jgit.errors.ObjectWritingException; import org.eclipse.jgit.lib.AnyObjectId; -import org.eclipse.jgit.lib.Commit; import org.eclipse.jgit.lib.Constants; import org.eclipse.jgit.lib.FileMode; import org.eclipse.jgit.lib.NullProgressMonitor; @@ -82,7 +81,7 @@ import org.eclipse.jgit.lib.RefUpdate; import org.eclipse.jgit.lib.RefWriter; import org.eclipse.jgit.lib.Repository; -import org.eclipse.jgit.lib.Tag; +import org.eclipse.jgit.lib.TagBuilder; import org.eclipse.jgit.revwalk.ObjectWalk; import org.eclipse.jgit.revwalk.RevBlob; import org.eclipse.jgit.revwalk.RevCommit; @@ -359,7 +358,9 @@ public RevCommit commit(final int secDelta, final RevTree tree, final RevCommit... parents) throws Exception { tick(secDelta); - final Commit c = new Commit(); + final org.eclipse.jgit.lib.CommitBuilder c; + + c = new org.eclipse.jgit.lib.CommitBuilder(); c.setTreeId(tree); c.setParentIds(parents); c.setAuthor(new PersonIdent(author, new Date(now))); @@ -397,7 +398,7 @@ public CommitBuilder commit() { * @throws Exception */ public RevTag tag(final String name, final RevObject dst) throws Exception { - final Tag t = new Tag(); + final TagBuilder t = new TagBuilder(); t.setObjectId(dst); t.setTag(name); t.setTagger(new PersonIdent(committer, new Date(now))); @@ -810,7 +811,9 @@ public RevCommit create() throws Exception { if (self == null) { TestRepository.this.tick(tick); - final Commit c = new Commit(); + final org.eclipse.jgit.lib.CommitBuilder c; + + c = new org.eclipse.jgit.lib.CommitBuilder(); c.setParentIds(parents); c.setAuthor(new PersonIdent(author, new Date(now))); c.setCommitter(new PersonIdent(committer, new Date(now))); diff --git a/org.eclipse.jgit.pgm/src/org/eclipse/jgit/pgm/Tag.java b/org.eclipse.jgit.pgm/src/org/eclipse/jgit/pgm/Tag.java index df986a88b..0ab19b6bb 100644 --- a/org.eclipse.jgit.pgm/src/org/eclipse/jgit/pgm/Tag.java +++ b/org.eclipse.jgit.pgm/src/org/eclipse/jgit/pgm/Tag.java @@ -93,7 +93,9 @@ protected void run() throws Exception { final ObjectInserter inserter = db.newObjectInserter(); final ObjectId id; try { - org.eclipse.jgit.lib.Tag tag = new org.eclipse.jgit.lib.Tag(); + final org.eclipse.jgit.lib.TagBuilder tag; + + tag = new org.eclipse.jgit.lib.TagBuilder(); tag.setObjectId(object, ldr.getType()); tag.setTagger(new PersonIdent(db)); tag.setMessage(message.replaceAll("\r", "")); diff --git a/org.eclipse.jgit.pgm/src/org/eclipse/jgit/pgm/debug/RebuildCommitGraph.java b/org.eclipse.jgit.pgm/src/org/eclipse/jgit/pgm/debug/RebuildCommitGraph.java index e0a743356..ab4412871 100644 --- a/org.eclipse.jgit.pgm/src/org/eclipse/jgit/pgm/debug/RebuildCommitGraph.java +++ b/org.eclipse.jgit.pgm/src/org/eclipse/jgit/pgm/debug/RebuildCommitGraph.java @@ -58,7 +58,7 @@ import org.eclipse.jgit.errors.MissingObjectException; import org.eclipse.jgit.errors.ObjectWritingException; -import org.eclipse.jgit.lib.Commit; +import org.eclipse.jgit.lib.CommitBuilder; import org.eclipse.jgit.lib.Constants; import org.eclipse.jgit.lib.ObjectId; import org.eclipse.jgit.lib.ObjectIdRef; @@ -191,7 +191,7 @@ private void recreateCommitGraph() throws IOException { } } - final Commit newc = new Commit(); + final CommitBuilder newc = new CommitBuilder(); newc.setTreeId(emptyTree); newc.setAuthor(new PersonIdent(me, new Date(t.commitTime))); newc.setCommitter(newc.getAuthor()); diff --git a/org.eclipse.jgit.test/tst/org/eclipse/jgit/lib/ReflogConfigTest.java b/org.eclipse.jgit.test/tst/org/eclipse/jgit/lib/ReflogConfigTest.java index 5001b8fc7..ebe2db111 100644 --- a/org.eclipse.jgit.test/tst/org/eclipse/jgit/lib/ReflogConfigTest.java +++ b/org.eclipse.jgit.test/tst/org/eclipse/jgit/lib/ReflogConfigTest.java @@ -104,7 +104,7 @@ private void addFileToTree(final Tree t, String filename, String content) private void commit(final Tree t, String commitMsg, PersonIdent author, PersonIdent committer) throws IOException { - final Commit commit = new Commit(); + final CommitBuilder commit = new CommitBuilder(); commit.setAuthor(author); commit.setCommitter(committer); commit.setMessage(commitMsg); diff --git a/org.eclipse.jgit.test/tst/org/eclipse/jgit/merge/CherryPickTest.java b/org.eclipse.jgit.test/tst/org/eclipse/jgit/merge/CherryPickTest.java index 977c9216e..876b98636 100644 --- a/org.eclipse.jgit.test/tst/org/eclipse/jgit/merge/CherryPickTest.java +++ b/org.eclipse.jgit.test/tst/org/eclipse/jgit/merge/CherryPickTest.java @@ -50,7 +50,7 @@ import org.eclipse.jgit.dircache.DirCache; import org.eclipse.jgit.dircache.DirCacheBuilder; import org.eclipse.jgit.dircache.DirCacheEntry; -import org.eclipse.jgit.lib.Commit; +import org.eclipse.jgit.lib.CommitBuilder; import org.eclipse.jgit.lib.Constants; import org.eclipse.jgit.lib.FileMode; import org.eclipse.jgit.lib.ObjectId; @@ -131,7 +131,7 @@ private void assertCorrectId(final DirCache treeT, final TreeWalk tw) { private ObjectId commit(final ObjectInserter odi, final DirCache treeB, final ObjectId[] parentIds) throws Exception { - final Commit c = new Commit(); + final CommitBuilder c = new CommitBuilder(); c.setTreeId(treeB.writeTree(odi)); c.setAuthor(new PersonIdent("A U Thor", "a.u.thor", 1L, 0)); c.setCommitter(c.getAuthor()); diff --git a/org.eclipse.jgit.test/tst/org/eclipse/jgit/merge/SimpleMergeTest.java b/org.eclipse.jgit.test/tst/org/eclipse/jgit/merge/SimpleMergeTest.java index 88959c792..5e7bcee1e 100644 --- a/org.eclipse.jgit.test/tst/org/eclipse/jgit/merge/SimpleMergeTest.java +++ b/org.eclipse.jgit.test/tst/org/eclipse/jgit/merge/SimpleMergeTest.java @@ -52,7 +52,7 @@ import org.eclipse.jgit.dircache.DirCache; import org.eclipse.jgit.dircache.DirCacheBuilder; import org.eclipse.jgit.dircache.DirCacheEntry; -import org.eclipse.jgit.lib.Commit; +import org.eclipse.jgit.lib.CommitBuilder; import org.eclipse.jgit.lib.Constants; import org.eclipse.jgit.lib.FileMode; import org.eclipse.jgit.lib.ObjectId; @@ -367,7 +367,7 @@ private void assertCorrectId(final DirCache treeT, final TreeWalk tw) { private ObjectId commit(final ObjectInserter odi, final DirCache treeB, final ObjectId[] parentIds) throws Exception { - final Commit c = new Commit(); + final CommitBuilder c = new CommitBuilder(); c.setTreeId(treeB.writeTree(odi)); c.setAuthor(new PersonIdent("A U Thor", "a.u.thor", 1L, 0)); c.setCommitter(c.getAuthor()); diff --git a/org.eclipse.jgit.test/tst/org/eclipse/jgit/revwalk/RevCommitParseTest.java b/org.eclipse.jgit.test/tst/org/eclipse/jgit/revwalk/RevCommitParseTest.java index 935437337..36730c153 100644 --- a/org.eclipse.jgit.test/tst/org/eclipse/jgit/revwalk/RevCommitParseTest.java +++ b/org.eclipse.jgit.test/tst/org/eclipse/jgit/revwalk/RevCommitParseTest.java @@ -46,7 +46,7 @@ import java.io.ByteArrayOutputStream; import java.io.UnsupportedEncodingException; -import org.eclipse.jgit.lib.Commit; +import org.eclipse.jgit.lib.CommitBuilder; import org.eclipse.jgit.lib.Constants; import org.eclipse.jgit.lib.ObjectId; import org.eclipse.jgit.lib.ObjectInserter; @@ -321,7 +321,7 @@ public void testParse_GitStyleMessage() throws Exception { public void testParse_PublicParseMethod() throws UnsupportedEncodingException { ObjectInserter.Formatter fmt = new ObjectInserter.Formatter(); - Commit src = new Commit(); + CommitBuilder src = new CommitBuilder(); src.setTreeId(fmt.idFor(Constants.OBJ_TREE, new byte[] {})); src.setAuthor(author); src.setCommitter(committer); diff --git a/org.eclipse.jgit.test/tst/org/eclipse/jgit/revwalk/RevTagParseTest.java b/org.eclipse.jgit.test/tst/org/eclipse/jgit/revwalk/RevTagParseTest.java index af70eb5a0..727c48e8e 100644 --- a/org.eclipse.jgit.test/tst/org/eclipse/jgit/revwalk/RevTagParseTest.java +++ b/org.eclipse.jgit.test/tst/org/eclipse/jgit/revwalk/RevTagParseTest.java @@ -51,7 +51,7 @@ import org.eclipse.jgit.lib.ObjectInserter; import org.eclipse.jgit.lib.PersonIdent; import org.eclipse.jgit.lib.RepositoryTestCase; -import org.eclipse.jgit.lib.Tag; +import org.eclipse.jgit.lib.TagBuilder; public class RevTagParseTest extends RepositoryTestCase { public void testTagBlob() throws Exception { @@ -400,7 +400,7 @@ public void testParse_GitStyleMessage() throws Exception { public void testParse_PublicParseMethod() throws CorruptObjectException { ObjectInserter.Formatter fmt = new ObjectInserter.Formatter(); - Tag src = new Tag(); + TagBuilder src = new TagBuilder(); src.setObjectId(fmt.idFor(Constants.OBJ_TREE, new byte[] {}), Constants.OBJ_TREE); src.setTagger(committer); diff --git a/org.eclipse.jgit.test/tst/org/eclipse/jgit/storage/file/T0003_Basic.java b/org.eclipse.jgit.test/tst/org/eclipse/jgit/storage/file/T0003_Basic.java index 1c7d3b681..cd802d41e 100644 --- a/org.eclipse.jgit.test/tst/org/eclipse/jgit/storage/file/T0003_Basic.java +++ b/org.eclipse.jgit.test/tst/org/eclipse/jgit/storage/file/T0003_Basic.java @@ -60,7 +60,7 @@ import org.eclipse.jgit.errors.IncorrectObjectTypeException; import org.eclipse.jgit.errors.MissingObjectException; import org.eclipse.jgit.lib.AnyObjectId; -import org.eclipse.jgit.lib.Commit; +import org.eclipse.jgit.lib.CommitBuilder; import org.eclipse.jgit.lib.Config; import org.eclipse.jgit.lib.Constants; import org.eclipse.jgit.lib.FileTreeEntry; @@ -72,7 +72,7 @@ import org.eclipse.jgit.lib.RefUpdate; import org.eclipse.jgit.lib.Repository; import org.eclipse.jgit.lib.SampleDataRepositoryTestCase; -import org.eclipse.jgit.lib.Tag; +import org.eclipse.jgit.lib.TagBuilder; import org.eclipse.jgit.lib.Tree; import org.eclipse.jgit.lib.TreeEntry; import org.eclipse.jgit.lib.WriteTree; @@ -383,7 +383,7 @@ public void test009_CreateCommitOldFormat() throws IOException { assertEquals(ObjectId.fromString("00b1f73724f493096d1ffa0b0f1f1482dbb8c936"), t.getTreeId()); - final Commit c = new Commit(); + final CommitBuilder c = new CommitBuilder(); c.setAuthor(new PersonIdent(author, 1154236443000L, -4 * 60)); c.setCommitter(new PersonIdent(committer, 1154236443000L, -4 * 60)); c.setMessage("A Commit\n"); @@ -440,7 +440,7 @@ public void test012_SubtreeExternalSorting() throws IOException { public void test020_createBlobTag() throws IOException { final ObjectId emptyId = new ObjectWriter(db).writeBlob(new byte[0]); - final Tag t = new Tag(); + final TagBuilder t = new TagBuilder(); t.setObjectId(emptyId, Constants.OBJ_BLOB); t.setTag("test020"); t.setTagger(new PersonIdent(author, 1154236443000L, -4 * 60)); @@ -460,7 +460,7 @@ public void test021_createTreeTag() throws IOException { final Tree almostEmptyTree = new Tree(db); almostEmptyTree.addEntry(new FileTreeEntry(almostEmptyTree, emptyId, "empty".getBytes(), false)); final ObjectId almostEmptyTreeId = new ObjectWriter(db).writeTree(almostEmptyTree); - final Tag t = new Tag(); + final TagBuilder t = new TagBuilder(); t.setObjectId(almostEmptyTreeId, Constants.OBJ_TREE); t.setTag("test021"); t.setTagger(new PersonIdent(author, 1154236443000L, -4 * 60)); @@ -480,13 +480,13 @@ public void test022_createCommitTag() throws IOException { final Tree almostEmptyTree = new Tree(db); almostEmptyTree.addEntry(new FileTreeEntry(almostEmptyTree, emptyId, "empty".getBytes(), false)); final ObjectId almostEmptyTreeId = new ObjectWriter(db).writeTree(almostEmptyTree); - final Commit almostEmptyCommit = new Commit(); + final CommitBuilder almostEmptyCommit = new CommitBuilder(); almostEmptyCommit.setAuthor(new PersonIdent(author, 1154236443000L, -2 * 60)); // not exactly the same almostEmptyCommit.setCommitter(new PersonIdent(author, 1154236443000L, -2 * 60)); almostEmptyCommit.setMessage("test022\n"); almostEmptyCommit.setTreeId(almostEmptyTreeId); ObjectId almostEmptyCommitId = insertCommit(almostEmptyCommit); - final Tag t = new Tag(); + final TagBuilder t = new TagBuilder(); t.setObjectId(almostEmptyCommitId,Constants.OBJ_COMMIT); t.setTag("test022"); t.setTagger(new PersonIdent(author, 1154236443000L, -4 * 60)); @@ -506,7 +506,7 @@ public void test023_createCommitNonAnullii() throws IOException { final Tree almostEmptyTree = new Tree(db); almostEmptyTree.addEntry(new FileTreeEntry(almostEmptyTree, emptyId, "empty".getBytes(), false)); final ObjectId almostEmptyTreeId = new ObjectWriter(db).writeTree(almostEmptyTree); - Commit commit = new Commit(); + CommitBuilder commit = new CommitBuilder(); commit.setTreeId(almostEmptyTreeId); commit.setAuthor(new PersonIdent("Joe H\u00e4cker","joe@example.com",4294967295000L,60)); commit.setCommitter(new PersonIdent("Joe Hacker","joe2@example.com",4294967295000L,60)); @@ -524,7 +524,7 @@ public void test024_createCommitNonAscii() throws IOException { final Tree almostEmptyTree = new Tree(db); almostEmptyTree.addEntry(new FileTreeEntry(almostEmptyTree, emptyId, "empty".getBytes(), false)); final ObjectId almostEmptyTreeId = new ObjectWriter(db).writeTree(almostEmptyTree); - Commit commit = new Commit(); + CommitBuilder commit = new CommitBuilder(); commit.setTreeId(almostEmptyTreeId); commit.setAuthor(new PersonIdent("Joe H\u00e4cker","joe@example.com",4294967295000L,60)); commit.setCommitter(new PersonIdent("Joe Hacker","joe2@example.com",4294967295000L,60)); @@ -551,7 +551,7 @@ public void test026_CreateCommitMultipleparents() throws IOException { assertEquals(ObjectId.fromString("00b1f73724f493096d1ffa0b0f1f1482dbb8c936"), t.getTreeId()); - final Commit c1 = new Commit(); + final CommitBuilder c1 = new CommitBuilder(); c1.setAuthor(new PersonIdent(author, 1154236443000L, -4 * 60)); c1.setCommitter(new PersonIdent(committer, 1154236443000L, -4 * 60)); c1.setMessage("A Commit\n"); @@ -562,7 +562,7 @@ public void test026_CreateCommitMultipleparents() throws IOException { "803aec4aba175e8ab1d666873c984c0308179099"); assertEquals(cmtid1, c1.getCommitId()); - final Commit c2 = new Commit(); + final CommitBuilder c2 = new CommitBuilder(); c2.setAuthor(new PersonIdent(author, 1154236443000L, -4 * 60)); c2.setCommitter(new PersonIdent(committer, 1154236443000L, -4 * 60)); c2.setMessage("A Commit 2\n"); @@ -583,7 +583,7 @@ public void test026_CreateCommitMultipleparents() throws IOException { assertEquals(1, rm2.getParentCount()); assertEquals(c1.getCommitId(), rm2.getParent(0)); - final Commit c3 = new Commit(); + final CommitBuilder c3 = new CommitBuilder(); c3.setAuthor(new PersonIdent(author, 1154236443000L, -4 * 60)); c3.setCommitter(new PersonIdent(committer, 1154236443000L, -4 * 60)); c3.setMessage("A Commit 3\n"); @@ -605,7 +605,7 @@ public void test026_CreateCommitMultipleparents() throws IOException { assertEquals(c1.getCommitId(), rm3.getParent(0)); assertEquals(c2.getCommitId(), rm3.getParent(1)); - final Commit c4 = new Commit(); + final CommitBuilder c4 = new CommitBuilder(); c4.setAuthor(new PersonIdent(author, 1154236443000L, -4 * 60)); c4.setCommitter(new PersonIdent(committer, 1154236443000L, -4 * 60)); c4.setMessage("A Commit 4\n"); @@ -693,7 +693,7 @@ public void test30_stripWorkDir() { } - private ObjectId insertCommit(final Commit commit) throws IOException, + private ObjectId insertCommit(final CommitBuilder commit) throws IOException, UnsupportedEncodingException { ObjectInserter oi = db.newObjectInserter(); try { @@ -717,7 +717,7 @@ private RevCommit parseCommit(AnyObjectId id) } } - private ObjectId insertTag(final Tag tag) throws IOException, + private ObjectId insertTag(final TagBuilder tag) throws IOException, UnsupportedEncodingException { ObjectInserter oi = db.newObjectInserter(); try { diff --git a/org.eclipse.jgit/src/org/eclipse/jgit/api/CommitCommand.java b/org.eclipse.jgit/src/org/eclipse/jgit/api/CommitCommand.java index da6ac0a43..a88899cc5 100644 --- a/org.eclipse.jgit/src/org/eclipse/jgit/api/CommitCommand.java +++ b/org.eclipse.jgit/src/org/eclipse/jgit/api/CommitCommand.java @@ -50,7 +50,7 @@ import org.eclipse.jgit.JGitText; import org.eclipse.jgit.dircache.DirCache; import org.eclipse.jgit.errors.UnmergedPathException; -import org.eclipse.jgit.lib.Commit; +import org.eclipse.jgit.lib.CommitBuilder; import org.eclipse.jgit.lib.Constants; import org.eclipse.jgit.lib.ObjectId; import org.eclipse.jgit.lib.ObjectInserter; @@ -100,7 +100,7 @@ protected CommitCommand(Repository repo) { * class should only be used for one invocation of the command (means: one * call to {@link #call()}) * - * @return a {@link Commit} object representing the successful commit + * @return a {@link RevCommit} object representing the successful commit. * @throws NoHeadException * when called on a git repo without a HEAD reference * @throws NoMessageException @@ -162,7 +162,7 @@ public RevCommit call() throws NoHeadException, NoMessageException, ObjectId indexTreeId = index.writeTree(odi); // Create a Commit object, populate it and write it - Commit commit = new Commit(); + CommitBuilder commit = new CommitBuilder(); commit.setCommitter(committer); commit.setAuthor(author); commit.setMessage(message); diff --git a/org.eclipse.jgit/src/org/eclipse/jgit/lib/Commit.java b/org.eclipse.jgit/src/org/eclipse/jgit/lib/CommitBuilder.java similarity index 99% rename from org.eclipse.jgit/src/org/eclipse/jgit/lib/Commit.java rename to org.eclipse.jgit/src/org/eclipse/jgit/lib/CommitBuilder.java index 8fc46c915..8457d4549 100644 --- a/org.eclipse.jgit/src/org/eclipse/jgit/lib/Commit.java +++ b/org.eclipse.jgit/src/org/eclipse/jgit/lib/CommitBuilder.java @@ -59,7 +59,7 @@ * and obtain a {@link org.eclipse.jgit.revwalk.RevCommit} instance by calling * {@link org.eclipse.jgit.revwalk.RevWalk#parseCommit(AnyObjectId)}. */ -public class Commit { +public class CommitBuilder { private static final ObjectId[] EMPTY_OBJECTID_LIST = new ObjectId[0]; private ObjectId commitId; @@ -77,7 +77,7 @@ public class Commit { private Charset encoding; /** Initialize an empty commit. */ - public Commit() { + public CommitBuilder() { parentIds = EMPTY_OBJECTID_LIST; encoding = Constants.CHARSET; } diff --git a/org.eclipse.jgit/src/org/eclipse/jgit/lib/ObjectInserter.java b/org.eclipse.jgit/src/org/eclipse/jgit/lib/ObjectInserter.java index 369dd6e4c..94d792858 100644 --- a/org.eclipse.jgit/src/org/eclipse/jgit/lib/ObjectInserter.java +++ b/org.eclipse.jgit/src/org/eclipse/jgit/lib/ObjectInserter.java @@ -303,7 +303,7 @@ public final byte[] format(Tree tree) throws IOException { * @throws UnsupportedEncodingException * the commit's chosen encoding isn't supported on this JVM. */ - public final byte[] format(Commit commit) + public final byte[] format(CommitBuilder commit) throws UnsupportedEncodingException { Charset encoding = commit.getEncoding(); ByteArrayOutputStream os = new ByteArrayOutputStream(); @@ -362,7 +362,7 @@ public final byte[] format(Commit commit) * the tag object to format * @return canonical encoding of the tag object. */ - public final byte[] format(Tag tag) { + public final byte[] format(TagBuilder tag) { ByteArrayOutputStream os = new ByteArrayOutputStream(); OutputStreamWriter w = new OutputStreamWriter(os, Constants.CHARSET); try { diff --git a/org.eclipse.jgit/src/org/eclipse/jgit/lib/ObjectWriter.java b/org.eclipse.jgit/src/org/eclipse/jgit/lib/ObjectWriter.java index ce91efb8e..5cb4b2168 100644 --- a/org.eclipse.jgit/src/org/eclipse/jgit/lib/ObjectWriter.java +++ b/org.eclipse.jgit/src/org/eclipse/jgit/lib/ObjectWriter.java @@ -172,7 +172,7 @@ public ObjectId writeCanonicalTree(byte[] treeData) throws IOException { * @return SHA-1 of the commit * @throws IOException */ - public ObjectId writeCommit(Commit commit) throws IOException { + public ObjectId writeCommit(CommitBuilder commit) throws IOException { try { ObjectId id = inserter.insert(OBJ_COMMIT, inserter.format(commit)); inserter.flush(); @@ -190,7 +190,7 @@ public ObjectId writeCommit(Commit commit) throws IOException { * @return SHA-1 of the tag * @throws IOException */ - public ObjectId writeTag(Tag tag) throws IOException { + public ObjectId writeTag(TagBuilder tag) throws IOException { try { ObjectId id = inserter.insert(OBJ_TAG, inserter.format(tag)); inserter.flush(); diff --git a/org.eclipse.jgit/src/org/eclipse/jgit/lib/Repository.java b/org.eclipse.jgit/src/org/eclipse/jgit/lib/Repository.java index 2742cd4e5..c910889f6 100644 --- a/org.eclipse.jgit/src/org/eclipse/jgit/lib/Repository.java +++ b/org.eclipse.jgit/src/org/eclipse/jgit/lib/Repository.java @@ -1091,7 +1091,7 @@ public void writeMergeCommitMsg(String msg) throws IOException { * file operations triggering a merge will store the IDs of all heads which * should be merged together with HEAD. * - * @return a list of {@link Commit}s which IDs are listed in the MERGE_HEAD + * @return a list of commits which IDs are listed in the MERGE_HEAD * file or {@code null} if this file doesn't exist. Also if the file * exists but is empty {@code null} will be returned * @throws IOException @@ -1130,7 +1130,7 @@ public List readMergeHeads() throws IOException, NoWorkTreeException { * the file will be deleted * * @param heads - * a list of {@link Commit}s which IDs should be written to + * a list of commits which IDs should be written to * $GIT_DIR/MERGE_HEAD or null to delete the file * @throws IOException */ diff --git a/org.eclipse.jgit/src/org/eclipse/jgit/lib/Tag.java b/org.eclipse.jgit/src/org/eclipse/jgit/lib/TagBuilder.java similarity index 99% rename from org.eclipse.jgit/src/org/eclipse/jgit/lib/Tag.java rename to org.eclipse.jgit/src/org/eclipse/jgit/lib/TagBuilder.java index fda6b1cb1..6cd0e9e88 100644 --- a/org.eclipse.jgit/src/org/eclipse/jgit/lib/Tag.java +++ b/org.eclipse.jgit/src/org/eclipse/jgit/lib/TagBuilder.java @@ -57,7 +57,7 @@ * and obtain a {@link org.eclipse.jgit.revwalk.RevTag} instance by calling * {@link org.eclipse.jgit.revwalk.RevWalk#parseTag(AnyObjectId)}. */ -public class Tag { +public class TagBuilder { private ObjectId tagId; private ObjectId object;