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
9 changes: 7 additions & 2 deletions plugin/src/main/java/consulo/git/GitVcsFactory.java
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
import consulo.git.localize.GitLocalize;
import consulo.localize.LocalizeValue;
import consulo.project.Project;
import consulo.project.ui.notification.NotificationService;
import consulo.versionControlSystem.AbstractVcs;
import consulo.versionControlSystem.VcsFactory;
import git4idea.GitVcs;
Expand Down Expand Up @@ -35,6 +36,7 @@ public class GitVcsFactory implements VcsFactory {
private final Provider<GitVcsApplicationSettings> myGitVcsApplicationSettings;
private final Provider<GitVcsSettings> myGitVcsSettings;
private final Provider<GitExecutableManager> myGitExecutableManager;
private final Provider<NotificationService> myNotificationService;

@Inject
public GitVcsFactory(
Expand All @@ -46,7 +48,8 @@ public GitVcsFactory(
@Nonnull Provider<GitRollbackEnvironment> gitRollbackEnvironment,
@Nonnull Provider<GitVcsApplicationSettings> gitSettings,
@Nonnull Provider<GitVcsSettings> gitProjectSettings,
@Nonnull Provider<GitExecutableManager> gitExecutableManager
@Nonnull Provider<GitExecutableManager> gitExecutableManager,
@Nonnull Provider<NotificationService> notificationService
) {
myProject = project;
myGit = git;
Expand All @@ -57,6 +60,7 @@ public GitVcsFactory(
myGitVcsApplicationSettings = gitSettings;
myGitVcsSettings = gitProjectSettings;
myGitExecutableManager = gitExecutableManager;
myNotificationService = notificationService;
}

@Nonnull
Expand Down Expand Up @@ -90,7 +94,8 @@ public AbstractVcs<?> createVcs() {
myGitRollbackEnvironment.get(),
myGitVcsApplicationSettings.get(),
myGitVcsSettings.get(),
myGitExecutableManager.get()
myGitExecutableManager.get(),
myNotificationService.get()
);
}
}
14 changes: 7 additions & 7 deletions plugin/src/main/java/consulo/git/config/GitVcsPanel.java
Original file line number Diff line number Diff line change
Expand Up @@ -15,13 +15,13 @@
*/
package consulo.git.config;

import consulo.application.AllIcons;
import consulo.application.progress.Task;
import consulo.disposer.Disposable;
import consulo.fileChooser.FileChooserDescriptorFactory;
import consulo.fileChooser.FileChooserTextBoxBuilder;
import consulo.git.localize.GitLocalize;
import consulo.localize.LocalizeValue;
import consulo.platform.base.icon.PlatformIconGroup;
import consulo.process.cmd.ParametersListUtil;
import consulo.project.Project;
import consulo.ui.*;
Expand All @@ -33,8 +33,8 @@
import consulo.ui.layout.VerticalLayout;
import consulo.ui.util.LabeledBuilder;
import consulo.util.collection.ContainerUtil;
import consulo.versionControlSystem.distributed.DvcsBundle;
import consulo.versionControlSystem.distributed.branch.DvcsSyncSettings;
import consulo.versionControlSystem.distributed.localize.DistributedVcsLocalize;
import git4idea.GitVcs;
import git4idea.config.*;
import git4idea.repo.GitRepositoryManager;
Expand Down Expand Up @@ -80,7 +80,7 @@ public GitVcsPanel(@Nonnull Project project, @Nonnull Disposable uiDisposable) {

myAutoUpdateIfPushRejected = CheckBox.create(GitLocalize.settingsAutoUpdateOnPushRejected());
myEnableForcePush = CheckBox.create(LocalizeValue.localizeTODO("Allow &force push"));
mySyncControl = CheckBox.create(DvcsBundle.message("sync.setting"));
mySyncControl = CheckBox.create(DistributedVcsLocalize.syncSetting());
myAutoCommitOnCherryPick = CheckBox.create(GitLocalize.settingsCommitAutomaticallyOnCherryPick());
myWarnAboutCrlf = CheckBox.create(GitLocalize.settingsCrlf());
myWarnAboutDetachedHead = CheckBox.create(GitLocalize.settingsDetachedHead());
Expand All @@ -101,12 +101,12 @@ public GitVcsPanel(@Nonnull Project project, @Nonnull Disposable uiDisposable) {

Button testButton = Button.create(GitLocalize.cloneTest());
testButton.addClickListener(e -> testConnection());
final GitRepositoryManager repositoryManager = GitRepositoryManager.getInstance(project);
GitRepositoryManager repositoryManager = GitRepositoryManager.getInstance(project);
mySyncControl.setVisible(repositoryManager.moreThanOneRoot());

myProtectedBranchesLabel = Label.create(GitLocalize.settingsProtectedBranched());
myProtectedBranchesButton = TextBoxWithExpandAction.create(
AllIcons.Actions.ShowViewer,
PlatformIconGroup.actionsShow(),
"Protected Branches",
ParametersListUtil.COLON_LINE_PARSER,
ParametersListUtil.COLON_LINE_JOINER
Expand Down Expand Up @@ -137,7 +137,7 @@ public GitVcsPanel(@Nonnull Project project, @Nonnull Disposable uiDisposable) {
*/
@RequiredUIAccess
private void testConnection() {
final String executable = getCurrentExecutablePath();
String executable = getCurrentExecutablePath();
if (myAppSettings != null) {
myAppSettings.setPathToGit(executable);
}
Expand All @@ -149,7 +149,7 @@ private void testConnection() {
GitLocalize.cloneDialogCheckingGitVersion(),
true,
indicator -> {
final GitVersion version;
GitVersion version;
try {
version = GitVersion.identifyVersion(executable);
}
Expand Down
122 changes: 64 additions & 58 deletions plugin/src/main/java/git4idea/GitTag.java
Original file line number Diff line number Diff line change
Expand Up @@ -21,77 +21,83 @@
import git4idea.commands.GitCommand;
import git4idea.commands.GitSimpleHandler;
import jakarta.annotation.Nonnull;
import org.jetbrains.annotations.NonNls;

import jakarta.annotation.Nullable;

import java.util.ArrayList;
import java.util.Collection;
import java.util.List;

/**
* The tag reference object
*/
public class GitTag extends GitReference {
/**
* Prefix for tags ({@value})
*/
@NonNls public static final String REFS_TAGS_PREFIX = "refs/tags/";

/**
* The constructor
*
* @param name the used name
*/
public GitTag(@Nonnull String name) {
super(name);
}
/**
* Prefix for tags ({@value})
*/
public static final String REFS_TAGS_PREFIX = "refs/tags/";

/**
* {@inheritDoc}
*/
@Nonnull
public String getFullName() {
return REFS_TAGS_PREFIX + myName;
}
/**
* The constructor
*
* @param name the used name
*/
public GitTag(@Nonnull String name) {
super(name);
}

/**
* List tags for the git root
*
* @param project the context
* @param root the git root
* @param tags the tag list
* @param containingCommit
* @throws VcsException if there is a problem with running git
*/
public static void listAsStrings(final Project project, final VirtualFile root, final Collection<String> tags,
@Nullable final String containingCommit) throws VcsException {
GitSimpleHandler handler = new GitSimpleHandler(project, root, GitCommand.TAG);
handler.setSilent(true);
handler.addParameters("-l");
if (containingCommit != null) {
handler.addParameters("--contains");
handler.addParameters(containingCommit);
/**
* {@inheritDoc}
*/
@Nonnull
@Override
public String getFullName() {
return REFS_TAGS_PREFIX + myName;
}
for (String line : handler.run().split("\n")) {
if (line.length() == 0) {
continue;
}
tags.add(new String(line));

/**
* List tags for the git root
*
* @param project the context
* @param root the git root
* @param tags the tag list
* @param containingCommit
* @throws VcsException if there is a problem with running git
*/
public static void listAsStrings(
Project project,
VirtualFile root,
Collection<String> tags,
@Nullable String containingCommit
) throws VcsException {
GitSimpleHandler handler = new GitSimpleHandler(project, root, GitCommand.TAG);
handler.setSilent(true);
handler.addParameters("-l");
if (containingCommit != null) {
handler.addParameters("--contains");
handler.addParameters(containingCommit);
}
for (String line : handler.run().split("\n")) {
if (line.length() == 0) {
continue;
}
tags.add(new String(line));
}
}
}

/**
* List tags for the git root
*
* @param project the context
* @param root the git root
* @param tags the tag list
* @throws VcsException if there is a problem with running git
*/
public static void list(final Project project, final VirtualFile root, final Collection<? super GitTag> tags) throws VcsException {
ArrayList<String> temp = new ArrayList<String>();
listAsStrings(project, root, temp, null);
for (String t : temp) {
tags.add(new GitTag(t));
/**
* List tags for the git root
*
* @param project the context
* @param root the git root
* @param tags the tag list
* @throws VcsException if there is a problem with running git
*/
public static void list(Project project, VirtualFile root, Collection<? super GitTag> tags) throws VcsException {
List<String> temp = new ArrayList<>();
listAsStrings(project, root, temp, null);
for (String t : temp) {
tags.add(new GitTag(t));
}
}
}
}
Loading
Loading