Example usage for org.eclipse.jgit.lib TagBuilder getMessage

List of usage examples for org.eclipse.jgit.lib TagBuilder getMessage

Introduction

In this page you can find the example usage for org.eclipse.jgit.lib TagBuilder getMessage.

Prototype

public String getMessage() 

Source Link

Document

Get the complete commit message.

Usage

From source file:org.eclipse.egit.core.test.op.TagOperationTest.java

License:Open Source License

@Test
public void addTag() throws Exception {
    assertTrue("Tags should be empty", repository1.getRepository().getTags().isEmpty());
    TagBuilder newTag = new TagBuilder();
    newTag.setTag("TheNewTag");
    newTag.setMessage("Well, I'm the tag");
    newTag.setTagger(RawParseUtils.parsePersonIdent(TestUtils.AUTHOR));
    newTag.setObjectId(repository1.getRepository().resolve("refs/heads/master"), Constants.OBJ_COMMIT);
    TagOperation top = new TagOperation(repository1.getRepository(), newTag, false);
    top.execute(new NullProgressMonitor());
    assertFalse("Tags should not be empty", repository1.getRepository().getTags().isEmpty());

    try {/*w  w w .  j av a 2s . co m*/
        top.execute(null);
        fail("Expected Exception not thrown");
    } catch (CoreException e) {
        // expected
    }

    top = new TagOperation(repository1.getRepository(), newTag, true);
    try {
        top.execute(null);
        fail("Expected Exception not thrown");
    } catch (CoreException e) {
        // expected
    }
    Ref tagRef = repository1.getRepository().getTags().get("TheNewTag");
    RevWalk walk = new RevWalk(repository1.getRepository());
    RevTag tag = walk.parseTag(repository1.getRepository().resolve(tagRef.getName()));

    newTag.setMessage("Another message");
    assertFalse("Messages should differ", tag.getFullMessage().equals(newTag.getMessage()));
    top.execute(null);
    tag = walk.parseTag(repository1.getRepository().resolve(tagRef.getName()));
    assertTrue("Messages be same", tag.getFullMessage().equals(newTag.getMessage()));
}