Search in sources :

Example 1 with TagOperation

use of org.eclipse.egit.core.op.TagOperation 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 2 with TagOperation

use of org.eclipse.egit.core.op.TagOperation 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 3 with TagOperation

use of org.eclipse.egit.core.op.TagOperation 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)

Example 4 with TagOperation

use of org.eclipse.egit.core.op.TagOperation in project egit by eclipse.

the class ReleaseStartOperationTest method createTag.

protected void createTag(RevCommit head, String name, String message, Repository repository) throws CoreException {
    TagBuilder tag = new TagBuilder();
    tag.setTag(name);
    tag.setMessage(message);
    tag.setObjectId(head);
    new TagOperation(repository, tag, false).execute(null);
}
Also used : TagOperation(org.eclipse.egit.core.op.TagOperation) TagBuilder(org.eclipse.jgit.lib.TagBuilder)

Example 5 with TagOperation

use of org.eclipse.egit.core.op.TagOperation in project egit by eclipse.

the class CreateTagHandler method execute.

@Override
public Object execute(ExecutionEvent event) throws ExecutionException {
    List<RepositoryCommit> commits = getCommits(event);
    if (commits.size() == 1) {
        RepositoryCommit commit = commits.get(0);
        Repository repository = commit.getRepository();
        CreateTagDialog dialog = new CreateTagDialog(HandlerUtil.getActiveShellChecked(event), commit.getRevCommit().getId(), repository);
        if (dialog.open() != Window.OK)
            return null;
        final TagBuilder tag = new TagBuilder();
        PersonIdent personIdent = new PersonIdent(repository);
        String tagName = dialog.getTagName();
        tag.setTag(tagName);
        tag.setTagger(personIdent);
        tag.setMessage(dialog.getTagMessage());
        tag.setObjectId(commit.getRevCommit());
        try {
            new TagOperation(repository, tag, dialog.shouldOverWriteTag()).execute(new NullProgressMonitor());
        } catch (CoreException e) {
            throw new ExecutionException(e.getMessage(), e);
        }
        if (dialog.shouldStartPushWizard())
            PushTagsWizard.openWizardDialog(repository, tagName);
    }
    return null;
}
Also used : NullProgressMonitor(org.eclipse.core.runtime.NullProgressMonitor) Repository(org.eclipse.jgit.lib.Repository) CoreException(org.eclipse.core.runtime.CoreException) CreateTagDialog(org.eclipse.egit.ui.internal.dialogs.CreateTagDialog) PersonIdent(org.eclipse.jgit.lib.PersonIdent) TagOperation(org.eclipse.egit.core.op.TagOperation) ExecutionException(org.eclipse.core.commands.ExecutionException) RepositoryCommit(org.eclipse.egit.ui.internal.commit.RepositoryCommit) TagBuilder(org.eclipse.jgit.lib.TagBuilder)

Aggregations

TagOperation (org.eclipse.egit.core.op.TagOperation)10 TagBuilder (org.eclipse.jgit.lib.TagBuilder)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 Before (org.junit.Before)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 IOException (java.io.IOException)1 IProgressMonitor (org.eclipse.core.runtime.IProgressMonitor)1 IJobChangeEvent (org.eclipse.core.runtime.jobs.IJobChangeEvent)1 Job (org.eclipse.core.runtime.jobs.Job)1 JobChangeAdapter (org.eclipse.core.runtime.jobs.JobChangeAdapter)1 RepositoryCommit (org.eclipse.egit.ui.internal.commit.RepositoryCommit)1 LocalNode (org.eclipse.egit.ui.internal.repository.tree.LocalNode)1 ObjectId (org.eclipse.jgit.lib.ObjectId)1