Search in sources :

Example 1 with RepositoryNode

use of org.eclipse.egit.ui.internal.repository.tree.RepositoryNode 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 RepositoryNode

use of org.eclipse.egit.ui.internal.repository.tree.RepositoryNode 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 RepositoryNode

use of org.eclipse.egit.ui.internal.repository.tree.RepositoryNode in project egit by eclipse.

the class FetchAndMergeActionTest method setup.

@Before
public void setup() throws Exception {
    repositoryFile = createProjectAndCommitToRepository();
    childRepositoryFile = createChildRepository(repositoryFile);
    RepositoriesViewLabelProvider provider = GitRepositoriesViewTestUtils.createLabelProvider();
    Repository repo = lookupRepository(childRepositoryFile);
    REMOTE_BRANCHES = provider.getText(new RemoteTrackingNode(new RepositoryNode(null, repo), repo));
    LOCAL_BRANCHES = provider.getText(new LocalNode(new RepositoryNode(null, repo), repo));
    ObjectId id = repo.resolve(repo.getFullBranch());
    initialCommitId = id.name();
}
Also used : Repository(org.eclipse.jgit.lib.Repository) RemoteTrackingNode(org.eclipse.egit.ui.internal.repository.tree.RemoteTrackingNode) LocalNode(org.eclipse.egit.ui.internal.repository.tree.LocalNode) ObjectId(org.eclipse.jgit.lib.ObjectId) RepositoriesViewLabelProvider(org.eclipse.egit.ui.internal.repository.RepositoriesViewLabelProvider) RepositoryNode(org.eclipse.egit.ui.internal.repository.tree.RepositoryNode) Before(org.junit.Before)

Example 4 with RepositoryNode

use of org.eclipse.egit.ui.internal.repository.tree.RepositoryNode in project egit by eclipse.

the class GitRepositoriesViewTestUtils method getLocalBranchesItem.

public SWTBotTreeItem getLocalBranchesItem(SWTBotTree tree, File repo) throws Exception {
    Repository repository = lookupRepository(repo);
    RepositoryNode root = new RepositoryNode(null, repository);
    BranchesNode branches = new BranchesNode(root, repository);
    LocalNode localBranches = new LocalNode(branches, repository);
    String rootText = labelProvider.getStyledText(root).getString();
    SWTBotTreeItem rootItem = tree.getTreeItem(rootText);
    SWTBotTreeItem branchesItem = TestUtil.expandAndWait(rootItem).getNode(labelProvider.getStyledText(branches).getString());
    SWTBotTreeItem localItem = TestUtil.expandAndWait(branchesItem).getNode(labelProvider.getStyledText(localBranches).getString());
    return localItem;
}
Also used : Repository(org.eclipse.jgit.lib.Repository) LocalNode(org.eclipse.egit.ui.internal.repository.tree.LocalNode) SWTBotTreeItem(org.eclipse.swtbot.swt.finder.widgets.SWTBotTreeItem) RepositoryNode(org.eclipse.egit.ui.internal.repository.tree.RepositoryNode) BranchesNode(org.eclipse.egit.ui.internal.repository.tree.BranchesNode)

Example 5 with RepositoryNode

use of org.eclipse.egit.ui.internal.repository.tree.RepositoryNode in project egit by eclipse.

the class GitRepositoriesViewTestUtils method getRemotesItem.

public SWTBotTreeItem getRemotesItem(SWTBotTree tree, File repositoryFile) throws Exception {
    Repository repository = lookupRepository(repositoryFile);
    RepositoryNode root = new RepositoryNode(null, repository);
    RemotesNode remotes = new RemotesNode(root, repository);
    String rootText = labelProvider.getStyledText(root).getString();
    SWTBotTreeItem rootItem = tree.getTreeItem(rootText);
    SWTBotTreeItem remotesItem = TestUtil.expandAndWait(rootItem).getNode(labelProvider.getStyledText(remotes).getString());
    return remotesItem;
}
Also used : Repository(org.eclipse.jgit.lib.Repository) SWTBotTreeItem(org.eclipse.swtbot.swt.finder.widgets.SWTBotTreeItem) RemotesNode(org.eclipse.egit.ui.internal.repository.tree.RemotesNode) RepositoryNode(org.eclipse.egit.ui.internal.repository.tree.RepositoryNode)

Aggregations

RepositoryNode (org.eclipse.egit.ui.internal.repository.tree.RepositoryNode)27 Repository (org.eclipse.jgit.lib.Repository)18 File (java.io.File)7 SWTBotTreeItem (org.eclipse.swtbot.swt.finder.widgets.SWTBotTreeItem)7 IOException (java.io.IOException)6 ArrayList (java.util.ArrayList)6 LocalNode (org.eclipse.egit.ui.internal.repository.tree.LocalNode)4 TagsNode (org.eclipse.egit.ui.internal.repository.tree.TagsNode)4 Before (org.junit.Before)4 URISyntaxException (java.net.URISyntaxException)3 RepositoriesViewLabelProvider (org.eclipse.egit.ui.internal.repository.RepositoriesViewLabelProvider)3 BranchesNode (org.eclipse.egit.ui.internal.repository.tree.BranchesNode)3 RefNode (org.eclipse.egit.ui.internal.repository.tree.RefNode)3 RemoteTrackingNode (org.eclipse.egit.ui.internal.repository.tree.RemoteTrackingNode)3 RepositoryTreeNode (org.eclipse.egit.ui.internal.repository.tree.RepositoryTreeNode)3 IStructuredSelection (org.eclipse.jface.viewers.IStructuredSelection)3 List (java.util.List)2 ExecutionException (org.eclipse.core.commands.ExecutionException)2 IProject (org.eclipse.core.resources.IProject)2 IResource (org.eclipse.core.resources.IResource)2