Search in sources :

Example 1 with TagBuilder

use of org.eclipse.jgit.lib.TagBuilder in project gitiles by GerritCodeReview.

the class TimeCacheTest method tagMissingTime.

@Test
public void tagMissingTime() throws Exception {
    RevCommit commit = repo.commit().create();
    TagBuilder builder = new TagBuilder();
    builder.setObjectId(commit);
    builder.setTag("tag");
    builder.setMessage("");
    ObjectId id;
    try (ObjectInserter ins = repo.getRepository().newObjectInserter()) {
        id = ins.insert(builder);
        ins.flush();
    }
    assertThat(getTime(commit)).isEqualTo(start + 1);
    assertThat(getTime(id)).isEqualTo(start + 1);
}
Also used : ObjectInserter(org.eclipse.jgit.lib.ObjectInserter) ObjectId(org.eclipse.jgit.lib.ObjectId) TagBuilder(org.eclipse.jgit.lib.TagBuilder) RevCommit(org.eclipse.jgit.revwalk.RevCommit) Test(org.junit.Test)

Example 2 with TagBuilder

use of org.eclipse.jgit.lib.TagBuilder in project gitiles by GerritCodeReview.

the class TimeCacheTest method firstTagMissingTime.

@Test
public void firstTagMissingTime() throws Exception {
    RevCommit commit = repo.commit().create();
    repo.tick(1);
    RevTag tag = repo.tag("tag", commit);
    repo.tick(1);
    TagBuilder builder = new TagBuilder();
    builder.setObjectId(tag);
    builder.setTag("tagtag");
    builder.setMessage("");
    ObjectId tagTagId;
    try (ObjectInserter ins = repo.getRepository().newObjectInserter()) {
        tagTagId = ins.insert(builder);
        ins.flush();
    }
    assertThat(getTime(commit)).isEqualTo(start + 1);
    assertThat(getTime(tag)).isEqualTo(start + 2);
    assertThat(getTime(tagTagId)).isEqualTo(start + 2);
}
Also used : RevTag(org.eclipse.jgit.revwalk.RevTag) ObjectInserter(org.eclipse.jgit.lib.ObjectInserter) ObjectId(org.eclipse.jgit.lib.ObjectId) TagBuilder(org.eclipse.jgit.lib.TagBuilder) RevCommit(org.eclipse.jgit.revwalk.RevCommit) Test(org.junit.Test)

Example 3 with TagBuilder

use of org.eclipse.jgit.lib.TagBuilder in project egit by eclipse.

the class BranchAndResetActionTest method setup.

@Before
public void setup() throws Exception {
    repositoryFile = createProjectAndCommitToRepository();
    Repository repo = lookupRepository(repositoryFile);
    TagBuilder tag = new TagBuilder();
    tag.setTag("SomeTag");
    tag.setTagger(RawParseUtils.parsePersonIdent(TestUtil.TESTAUTHOR));
    tag.setMessage("I'm just a little tag");
    tag.setObjectId(repo.resolve(repo.getFullBranch()), Constants.OBJ_COMMIT);
    TagOperation top = new TagOperation(repo, tag, false);
    top.execute(null);
    touchAndSubmit(null);
    RepositoriesViewLabelProvider provider = GitRepositoriesViewTestUtils.createLabelProvider();
    LOCAL_BRANCHES = provider.getText(new LocalNode(new RepositoryNode(null, repo), repo));
    TAGS = provider.getText(new TagsNode(new RepositoryNode(null, repo), repo));
}
Also used : Repository(org.eclipse.jgit.lib.Repository) LocalNode(org.eclipse.egit.ui.internal.repository.tree.LocalNode) TagOperation(org.eclipse.egit.core.op.TagOperation) TagsNode(org.eclipse.egit.ui.internal.repository.tree.TagsNode) RepositoriesViewLabelProvider(org.eclipse.egit.ui.internal.repository.RepositoriesViewLabelProvider) RepositoryNode(org.eclipse.egit.ui.internal.repository.tree.RepositoryNode) TagBuilder(org.eclipse.jgit.lib.TagBuilder) Before(org.junit.Before)

Example 4 with TagBuilder

use of org.eclipse.jgit.lib.TagBuilder in project egit by eclipse.

the class CompareActionsTest method setup.

@Before
public void setup() throws Exception {
    repositoryFile = createProjectAndCommitToRepository();
    Repository repo = lookupRepository(repositoryFile);
    disablePerspectiveSwitchPrompt();
    setEnabledModelProvider(ModelProvider.RESOURCE_MODEL_PROVIDER_ID);
    TagBuilder tag = new TagBuilder();
    tag.setTag("SomeTag");
    tag.setTagger(RawParseUtils.parsePersonIdent(TestUtil.TESTAUTHOR));
    tag.setMessage("I'm just a little tag");
    tag.setObjectId(repo.resolve(repo.getFullBranch()), Constants.OBJ_COMMIT);
    commitOfTag = tag.getObjectId();
    TagOperation top = new TagOperation(repo, tag, false);
    top.execute(null);
    touchAndSubmit(null);
    RepositoriesViewLabelProvider provider = GitRepositoriesViewTestUtils.createLabelProvider();
    // LOCAL_BRANCHES = provider.getText(new LocalNode(new RepositoryNode(
    // null, repo), repo));
    TAGS = provider.getText(new TagsNode(new RepositoryNode(null, repo), repo));
}
Also used : Repository(org.eclipse.jgit.lib.Repository) TagOperation(org.eclipse.egit.core.op.TagOperation) TagsNode(org.eclipse.egit.ui.internal.repository.tree.TagsNode) RepositoriesViewLabelProvider(org.eclipse.egit.ui.internal.repository.RepositoriesViewLabelProvider) RepositoryNode(org.eclipse.egit.ui.internal.repository.tree.RepositoryNode) TagBuilder(org.eclipse.jgit.lib.TagBuilder) Before(org.junit.Before)

Example 5 with TagBuilder

use of org.eclipse.jgit.lib.TagBuilder in project egit by eclipse.

the class TagActionTest method setup.

@Before
public void setup() throws Exception {
    repositoryFile = createProjectAndCommitToRepository();
    Repository repo = lookupRepository(repositoryFile);
    TagBuilder tag = new TagBuilder();
    tag.setTag("SomeTag");
    tag.setTagger(RawParseUtils.parsePersonIdent(TestUtil.TESTAUTHOR));
    tag.setMessage("I'm just a little tag");
    tag.setObjectId(repo.resolve(repo.getFullBranch()), Constants.OBJ_COMMIT);
    TagOperation top = new TagOperation(repo, tag, false);
    top.execute(null);
    touchAndSubmit(null);
}
Also used : Repository(org.eclipse.jgit.lib.Repository) TagOperation(org.eclipse.egit.core.op.TagOperation) TagBuilder(org.eclipse.jgit.lib.TagBuilder) Before(org.junit.Before)

Aggregations

TagBuilder (org.eclipse.jgit.lib.TagBuilder)12 TagOperation (org.eclipse.egit.core.op.TagOperation)10 Repository (org.eclipse.jgit.lib.Repository)6 PersonIdent (org.eclipse.jgit.lib.PersonIdent)5 CoreException (org.eclipse.core.runtime.CoreException)4 NullProgressMonitor (org.eclipse.core.runtime.NullProgressMonitor)3 CreateTagDialog (org.eclipse.egit.ui.internal.dialogs.CreateTagDialog)3 ObjectId (org.eclipse.jgit.lib.ObjectId)3 Before (org.junit.Before)3 Test (org.junit.Test)3 ExecutionException (org.eclipse.core.commands.ExecutionException)2 RepositoriesViewLabelProvider (org.eclipse.egit.ui.internal.repository.RepositoriesViewLabelProvider)2 RepositoryNode (org.eclipse.egit.ui.internal.repository.tree.RepositoryNode)2 TagsNode (org.eclipse.egit.ui.internal.repository.tree.TagsNode)2 ObjectInserter (org.eclipse.jgit.lib.ObjectInserter)2 RevCommit (org.eclipse.jgit.revwalk.RevCommit)2 RevTag (org.eclipse.jgit.revwalk.RevTag)2 IOException (java.io.IOException)1 IProgressMonitor (org.eclipse.core.runtime.IProgressMonitor)1 IJobChangeEvent (org.eclipse.core.runtime.jobs.IJobChangeEvent)1