Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -15,18 +15,24 @@
*/
package git4idea.actions;

import consulo.ide.ServiceManager;
import consulo.annotation.component.ActionImpl;
import consulo.git.localize.GitLocalize;
import consulo.versionControlSystem.log.Hash;
import git4idea.branch.GitBrancher;
import git4idea.repo.GitRepository;
import jakarta.annotation.Nonnull;

import java.util.Collections;
import java.util.List;

@ActionImpl(id = "Git.CheckoutRevision")
public class GitCheckoutRevisionAction extends GitLogSingleCommitAction {
public GitCheckoutRevisionAction() {
getTemplatePresentation().setTextValue(GitLocalize.actionCheckoutRevisionText());
}

@Override
protected void actionPerformed(@Nonnull GitRepository repository, @Nonnull Hash commit) {
GitBrancher brancher = ServiceManager.getService(repository.getProject(), GitBrancher.class);
brancher.checkout(commit.asString(), false, Collections.singletonList(repository), null);
GitBrancher brancher = repository.getProject().getInstance(GitBrancher.class);
brancher.checkout(commit.asString(), false, List.of(repository), null);
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -17,23 +17,34 @@

import java.util.Collections;

import consulo.annotation.component.ActionImpl;
import consulo.component.ComponentManager;
import consulo.git.localize.GitLocalize;
import consulo.project.Project;
import consulo.versionControlSystem.log.Hash;
import consulo.ide.ServiceManager;
import git4idea.branch.GitBranchUtil;
import git4idea.branch.GitBrancher;
import git4idea.repo.GitRepository;
import jakarta.annotation.Nonnull;

@ActionImpl(id = "Git.CreateNewBranch")
public class GitCreateNewBranchAction extends GitLogSingleCommitAction {
public GitCreateNewBranchAction() {
getTemplatePresentation().setTextValue(GitLocalize.actionCreateNewBranchText());
getTemplatePresentation().setDescriptionValue(GitLocalize.actionCreateNewBranchDescription());
}

@Override
protected void actionPerformed(@Nonnull GitRepository repository, @Nonnull Hash commit) {
Project project = repository.getProject();
String reference = commit.asString();
final String name =
GitBranchUtil.getNewBranchNameFromUser(project, Collections.singleton(repository), "Checkout New Branch From " + reference);
String name = GitBranchUtil.getNewBranchNameFromUser(
project,
Collections.singleton(repository),
GitLocalize.dialogCheckoutNewBranchFrom0Title(reference).get()
);
if (name != null) {
GitBrancher brancher = ServiceManager.getService(project, GitBrancher.class);
GitBrancher brancher = project.getInstance(GitBrancher.class);
brancher.checkoutNewBranchStartingFrom(name, reference, Collections.singletonList(repository), null);
}
}
Expand Down
10 changes: 10 additions & 0 deletions plugin/src/main/java/git4idea/actions/GitCreateTagAction.java
Original file line number Diff line number Diff line change
Expand Up @@ -15,13 +15,23 @@
*/
package git4idea.actions;

import consulo.annotation.component.ActionImpl;
import consulo.git.localize.GitLocalize;
import consulo.ui.annotation.RequiredUIAccess;
import jakarta.annotation.Nonnull;
import consulo.versionControlSystem.log.Hash;
import git4idea.history.wholeTree.GitCreateNewTag;
import git4idea.repo.GitRepository;

@ActionImpl(id = "Git.CreateNewTag")
public class GitCreateTagAction extends GitLogSingleCommitAction {
public GitCreateTagAction() {
getTemplatePresentation().setTextValue(GitLocalize.actionCreateNewTagText());
getTemplatePresentation().setDescriptionValue(GitLocalize.actionCreateNewTagDescription());
}

@Override
@RequiredUIAccess
protected void actionPerformed(@Nonnull GitRepository repository, @Nonnull Hash commit) {
String reference = commit.asString();
new GitCreateNewTag(repository.getProject(), repository, reference, null).execute();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,6 @@
*/
package git4idea.actions;

import consulo.ide.ServiceManager;
import consulo.project.Project;
import consulo.versionControlSystem.distributed.action.VcsLogSingleCommitAction;
import consulo.versionControlSystem.distributed.repository.AbstractRepositoryManager;
Expand Down
47 changes: 47 additions & 0 deletions plugin/src/main/java/git4idea/actions/LogContextMenuGroup.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,47 @@
/*
* Copyright 2013-2025 consulo.io
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package git4idea.actions;

import consulo.annotation.component.ActionImpl;
import consulo.annotation.component.ActionParentRef;
import consulo.annotation.component.ActionRef;
import consulo.application.dumb.DumbAware;
import consulo.git.localize.GitLocalize;
import consulo.ui.ex.action.AnSeparator;
import consulo.ui.ex.action.DefaultActionGroup;
import git4idea.reset.GitResetAction;

/**
* @author UNV
* @since 2025-08-28
*/
@ActionImpl(
id = "Git.Log.ContextMenu",
children = {
@ActionRef(type = AnSeparator.class),
@ActionRef(type = GitCheckoutRevisionAction.class),
@ActionRef(type = GitCreateNewBranchAction.class),
@ActionRef(type = GitCreateTagAction.class),
@ActionRef(type = AnSeparator.class),
@ActionRef(type = GitResetAction.class)
},
parents = @ActionParentRef(@ActionRef(id = "Vcs.Log.ContextMenu"))
)
public class LogContextMenuGroup extends DefaultActionGroup implements DumbAware {
public LogContextMenuGroup() {
super(GitLocalize.groupLogContextMenuText(), false);
}
}
39 changes: 39 additions & 0 deletions plugin/src/main/java/git4idea/actions/LogToolbarGroup.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
/*
* Copyright 2013-2025 consulo.io
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package git4idea.actions;

import consulo.annotation.component.ActionImpl;
import consulo.annotation.component.ActionParentRef;
import consulo.annotation.component.ActionRef;
import consulo.application.dumb.DumbAware;
import consulo.git.localize.GitLocalize;
import consulo.ui.ex.action.DefaultActionGroup;
import git4idea.branch.DeepCompareAction;

/**
* @author UNV
* @since 2025-08-28
*/
@ActionImpl(
id = "Git.Log.Toolbar",
children = @ActionRef(type = DeepCompareAction.class),
parents = @ActionParentRef(@ActionRef(id = "Vcs.Log.Toolbar"))
)
public class LogToolbarGroup extends DefaultActionGroup implements DumbAware {
public LogToolbarGroup() {
super(GitLocalize.groupLogToolbarText(), false);
}
}
Loading
Loading