Correct CommitBuilder, TagBuilder method to be build()
The correct names for these is build(), as that is what a Java developer will expect given the "builder" pattern. Bug: 323541 Change-Id: I35042bdc95a955beeaee29e54bde10e4240b2a71 Signed-off-by: Shawn O. Pearce <spearce@spearce.org> Reviewed-by: Chris Aniszczyk <caniszczyk@gmail.com>
This commit is contained in:
parent
37001ddc8d
commit
f996fb1796
|
@ -338,7 +338,7 @@ public void testParse_PublicParseMethod()
|
||||||
src.setCommitter(committer);
|
src.setCommitter(committer);
|
||||||
src.setMessage("Test commit\n\nThis is a test.\n");
|
src.setMessage("Test commit\n\nThis is a test.\n");
|
||||||
|
|
||||||
RevCommit p = RevCommit.parse(src.format());
|
RevCommit p = RevCommit.parse(src.build());
|
||||||
assertEquals(src.getTreeId(), p.getTree());
|
assertEquals(src.getTreeId(), p.getTree());
|
||||||
assertEquals(0, p.getParentCount());
|
assertEquals(0, p.getParentCount());
|
||||||
assertEquals(author, p.getAuthorIdent());
|
assertEquals(author, p.getAuthorIdent());
|
||||||
|
|
|
@ -407,7 +407,7 @@ public void testParse_PublicParseMethod() throws CorruptObjectException {
|
||||||
src.setTag("a.test");
|
src.setTag("a.test");
|
||||||
src.setMessage("Test tag\n\nThis is a test.\n");
|
src.setMessage("Test tag\n\nThis is a test.\n");
|
||||||
|
|
||||||
RevTag p = RevTag.parse(src.format());
|
RevTag p = RevTag.parse(src.build());
|
||||||
assertEquals(src.getObjectId(), p.getObject());
|
assertEquals(src.getObjectId(), p.getObject());
|
||||||
assertEquals(committer, p.getTaggerIdent());
|
assertEquals(committer, p.getTaggerIdent());
|
||||||
assertEquals("a.test", p.getTagName());
|
assertEquals("a.test", p.getTagName());
|
||||||
|
|
|
@ -288,8 +288,8 @@ public Charset getEncoding() {
|
||||||
* the encoding specified by {@link #getEncoding()} is not
|
* the encoding specified by {@link #getEncoding()} is not
|
||||||
* supported by this Java runtime.
|
* supported by this Java runtime.
|
||||||
*/
|
*/
|
||||||
public byte[] format() throws UnsupportedEncodingException {
|
public byte[] build() throws UnsupportedEncodingException {
|
||||||
return format(new ObjectInserter.Formatter());
|
return build(new ObjectInserter.Formatter());
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -308,7 +308,7 @@ public byte[] format() throws UnsupportedEncodingException {
|
||||||
* the encoding specified by {@link #getEncoding()} is not
|
* the encoding specified by {@link #getEncoding()} is not
|
||||||
* supported by this Java runtime.
|
* supported by this Java runtime.
|
||||||
*/
|
*/
|
||||||
public byte[] format(ObjectInserter oi) throws UnsupportedEncodingException {
|
public byte[] build(ObjectInserter oi) throws UnsupportedEncodingException {
|
||||||
ByteArrayOutputStream os = new ByteArrayOutputStream();
|
ByteArrayOutputStream os = new ByteArrayOutputStream();
|
||||||
OutputStreamWriter w = new OutputStreamWriter(os, getEncoding());
|
OutputStreamWriter w = new OutputStreamWriter(os, getEncoding());
|
||||||
try {
|
try {
|
||||||
|
|
|
@ -189,7 +189,7 @@ public ObjectId idFor(int objectType, long length, InputStream in)
|
||||||
* the object could not be stored.
|
* the object could not be stored.
|
||||||
*/
|
*/
|
||||||
public final ObjectId insert(CommitBuilder builder) throws IOException {
|
public final ObjectId insert(CommitBuilder builder) throws IOException {
|
||||||
return insert(Constants.OBJ_COMMIT, builder.format(this));
|
return insert(Constants.OBJ_COMMIT, builder.build(this));
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -205,7 +205,7 @@ public final ObjectId insert(CommitBuilder builder) throws IOException {
|
||||||
* the object could not be stored.
|
* the object could not be stored.
|
||||||
*/
|
*/
|
||||||
public final ObjectId insert(TagBuilder builder) throws IOException {
|
public final ObjectId insert(TagBuilder builder) throws IOException {
|
||||||
return insert(Constants.OBJ_TAG, builder.format(this));
|
return insert(Constants.OBJ_TAG, builder.build(this));
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
|
@ -182,8 +182,8 @@ public void setMessage(final String newMessage) {
|
||||||
* @return this object in the canonical annotated tag format, suitable for
|
* @return this object in the canonical annotated tag format, suitable for
|
||||||
* storage in a repository.
|
* storage in a repository.
|
||||||
*/
|
*/
|
||||||
public byte[] format() {
|
public byte[] build() {
|
||||||
return format(new ObjectInserter.Formatter());
|
return build(new ObjectInserter.Formatter());
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -199,7 +199,7 @@ public byte[] format() {
|
||||||
* @return this object in the canonical annotated tag format, suitable for
|
* @return this object in the canonical annotated tag format, suitable for
|
||||||
* storage in a repository.
|
* storage in a repository.
|
||||||
*/
|
*/
|
||||||
public byte[] format(ObjectInserter oi) {
|
public byte[] build(ObjectInserter oi) {
|
||||||
ByteArrayOutputStream os = new ByteArrayOutputStream();
|
ByteArrayOutputStream os = new ByteArrayOutputStream();
|
||||||
OutputStreamWriter w = new OutputStreamWriter(os, Constants.CHARSET);
|
OutputStreamWriter w = new OutputStreamWriter(os, Constants.CHARSET);
|
||||||
try {
|
try {
|
||||||
|
|
Loading…
Reference in New Issue