From fe6bc6c74d174f000a3a663e317171d150531eb5 Mon Sep 17 00:00:00 2001 From: Opher Vishnia Date: Fri, 6 Oct 2017 00:54:21 +0300 Subject: [PATCH 1/9] Update README.md --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index 93c73b2..e640194 100644 --- a/README.md +++ b/README.md @@ -56,6 +56,6 @@ I have worked hard on this plugin on my spare time. If you feel it is useful to ## License This plugin is under the [Apache 2.0 license](http://www.apache.org/licenses/LICENSE-2.0.html). -Copyright 2013-2016, Opher Vishnia. +Copyright 2013-2018, Opher Vishnia. From 13241576577b2ab70d525ca3c5f53fad6fa30cb3 Mon Sep 17 00:00:00 2001 From: Ivan Semenov Date: Thu, 7 Dec 2017 14:09:16 +0300 Subject: [PATCH 2/9] Do not use GitVcs from GitHandler as project can be null now --- src/gitflow/GitInitLineHandler.java | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/src/gitflow/GitInitLineHandler.java b/src/gitflow/GitInitLineHandler.java index 42e3ac3..647156d 100644 --- a/src/gitflow/GitInitLineHandler.java +++ b/src/gitflow/GitInitLineHandler.java @@ -12,16 +12,20 @@ import java.io.IOException; import java.io.OutputStreamWriter; +import git4idea.GitVcs; import git4idea.commands.GitCommand; import git4idea.commands.GitLineHandler; public class GitInitLineHandler extends GitLineHandler { + @NotNull private final GitVcs myVcs; + private BufferedWriter writer; GitflowInitOptions _initOptions; public GitInitLineHandler(GitflowInitOptions initOptions, @NotNull Project project, @NotNull VirtualFile vcsRoot, @NotNull GitCommand command) { super(project, vcsRoot, command); + myVcs = GitVcs.getInstance(project); _initOptions = initOptions; } From da0614db96edb116f4ad154d922cd14ce3aedd81 Mon Sep 17 00:00:00 2001 From: Viktor Hadzhipopov Date: Mon, 11 Dec 2017 04:19:34 +0200 Subject: [PATCH 3/9] Save git flow branches in tasks, so IDEA can automatically change branches when switching between tasks. --- src/gitflow/actions/FinishFeatureAction.java | 5 +-- src/gitflow/actions/FinishHotfixAction.java | 2 +- src/gitflow/actions/GitflowAction.java | 3 +- src/gitflow/actions/StartFeatureAction.java | 18 ++++++---- src/gitflow/actions/StartHotfixAction.java | 17 ++++++--- src/gitflow/ui/GitflowCloseTaskPanel.java | 5 +-- src/gitflow/ui/GitflowOpenTaskPanel.java | 37 +++++++++++++++----- 7 files changed, 57 insertions(+), 30 deletions(-) diff --git a/src/gitflow/actions/FinishFeatureAction.java b/src/gitflow/actions/FinishFeatureAction.java index 6e0f129..0f3fce4 100644 --- a/src/gitflow/actions/FinishFeatureAction.java +++ b/src/gitflow/actions/FinishFeatureAction.java @@ -4,11 +4,8 @@ import com.intellij.openapi.progress.ProgressIndicator; import com.intellij.openapi.progress.Task; import com.intellij.openapi.project.Project; -import com.intellij.openapi.ui.Messages; -import com.intellij.openapi.vcs.VcsException; import git4idea.branch.GitBranchUtil; import git4idea.commands.GitCommandResult; -import git4idea.merge.GitMerger; import git4idea.repo.GitRepository; import gitflow.GitflowConfigUtil; import gitflow.ui.NotifyUtil; @@ -54,7 +51,7 @@ public void actionPerformed(AnActionEvent e) { } public void runAction(final Project project, final String featureName){ - super.runAction(project, null, featureName); + super.runAction(project, null, featureName, null); final GitflowErrorsListener errorLineHandler = new GitflowErrorsListener(myProject); final FinishFeatureAction that = this; diff --git a/src/gitflow/actions/FinishHotfixAction.java b/src/gitflow/actions/FinishHotfixAction.java index 14798d9..4b42daa 100644 --- a/src/gitflow/actions/FinishHotfixAction.java +++ b/src/gitflow/actions/FinishHotfixAction.java @@ -53,7 +53,7 @@ public void actionPerformed(AnActionEvent e) { } public void runAction(final Project project, final String hotfixName, final String tagMessage){ - super.runAction(project, null, hotfixName); + super.runAction(project, null, hotfixName, null); final GitflowErrorsListener errorLineHandler = new GitflowErrorsListener(myProject); diff --git a/src/gitflow/actions/GitflowAction.java b/src/gitflow/actions/GitflowAction.java index 527b97b..257a48d 100644 --- a/src/gitflow/actions/GitflowAction.java +++ b/src/gitflow/actions/GitflowAction.java @@ -16,6 +16,7 @@ import gitflow.GitflowConfigUtil; import gitflow.ui.NotifyUtil; +import javax.annotation.Nullable; import java.util.ArrayList; public class GitflowAction extends DumbAwareAction { @@ -70,7 +71,7 @@ public void setup(Project project){ currentBranchName= GitBranchUtil.getBranchNameOrRev(myRepo); } - public void runAction(Project project, final String baseBranchName, final String branchName){ + public void runAction(Project project, final String baseBranchName, final String branchName, @Nullable final Runnable callInAwtLater){ setup(project); } diff --git a/src/gitflow/actions/StartFeatureAction.java b/src/gitflow/actions/StartFeatureAction.java index 1f711cd..f537335 100644 --- a/src/gitflow/actions/StartFeatureAction.java +++ b/src/gitflow/actions/StartFeatureAction.java @@ -1,8 +1,6 @@ package gitflow.actions; -import com.intellij.dvcs.repo.Repository; import com.intellij.openapi.actionSystem.AnActionEvent; -import com.intellij.openapi.fileEditor.FileEditorManager; import com.intellij.openapi.progress.ProgressIndicator; import com.intellij.openapi.progress.Task; import com.intellij.openapi.project.Project; @@ -15,6 +13,8 @@ import gitflow.ui.GitflowStartFeatureDialog; import gitflow.ui.NotifyUtil; +import javax.annotation.Nullable; + public class StartFeatureAction extends GitflowAction { public StartFeatureAction() { @@ -36,21 +36,24 @@ public void actionPerformed(AnActionEvent e) { final String featureName = dialog.getNewBranchName(); final String baseBranchName = dialog.getBaseBranchName(); - this.runAction(e.getProject(), baseBranchName, featureName); + this.runAction(e.getProject(), baseBranchName, featureName, null); } - public void runAction(Project project, final String baseBranchName, final String featureName){ - super.runAction(project, baseBranchName, featureName); + public void runAction(Project project, final String baseBranchName, final String featureName, @Nullable final Runnable callInAwtLater){ + super.runAction(project, baseBranchName, featureName, callInAwtLater); new Task.Backgroundable(myProject, "Starting feature " + featureName, false) { @Override public void run(@NotNull ProgressIndicator indicator) { - createFeatureBranch(baseBranchName, featureName); + final GitCommandResult commandResult = createFeatureBranch(baseBranchName, featureName); + if (callInAwtLater != null && commandResult.success()) { + callInAwtLater.run(); + } } }.queue(); } - private void createFeatureBranch(String baseBranchName, String featureName) { + private GitCommandResult createFeatureBranch(String baseBranchName, String featureName) { GitflowErrorsListener errorListener = new GitflowErrorsListener(myProject); GitCommandResult result = myGitflow.startFeature(myRepo, featureName, baseBranchName, errorListener); @@ -63,5 +66,6 @@ private void createFeatureBranch(String baseBranchName, String featureName) { myRepo.update(); virtualFileMananger.asyncRefresh(null); //update editors + return result; } } \ No newline at end of file diff --git a/src/gitflow/actions/StartHotfixAction.java b/src/gitflow/actions/StartHotfixAction.java index aca33fd..f67112c 100644 --- a/src/gitflow/actions/StartHotfixAction.java +++ b/src/gitflow/actions/StartHotfixAction.java @@ -13,6 +13,8 @@ import gitflow.ui.GitflowStartHotfixDialog; import gitflow.ui.NotifyUtil; +import javax.annotation.Nullable; + public class StartHotfixAction extends GitflowAction { @@ -36,21 +38,24 @@ public void actionPerformed(AnActionEvent e) { final String hotfixName = dialog.getNewBranchName(); final String baseBranchName = dialog.getBaseBranchName(); - this.runAction(e.getProject(), baseBranchName, hotfixName); + this.runAction(e.getProject(), baseBranchName, hotfixName, null); } - public void runAction(Project project, final String baseBranchName, final String hotfixName){ - super.runAction(project, baseBranchName, hotfixName); + public void runAction(Project project, final String baseBranchName, final String hotfixName, @Nullable final Runnable callInAwtLater){ + super.runAction(project, baseBranchName, hotfixName, callInAwtLater); new Task.Backgroundable(myProject, "Starting hotfix " + hotfixName, false) { @Override public void run(@NotNull ProgressIndicator indicator) { - createHotfixBranch(baseBranchName, hotfixName); + final GitCommandResult commandResult = createHotfixBranch(baseBranchName, hotfixName); + if (callInAwtLater != null && commandResult.success()) { + callInAwtLater.run(); + } } }.queue(); } - private void createHotfixBranch(String baseBranchName, String hotfixBranchName) { + private GitCommandResult createHotfixBranch(String baseBranchName, String hotfixBranchName) { GitflowErrorsListener errorListener = new GitflowErrorsListener(myProject); GitCommandResult result = myGitflow.startHotfix(myRepo, hotfixBranchName, baseBranchName, errorListener); @@ -63,5 +68,7 @@ private void createHotfixBranch(String baseBranchName, String hotfixBranchName) } myRepo.update(); + + return result; } } \ No newline at end of file diff --git a/src/gitflow/ui/GitflowCloseTaskPanel.java b/src/gitflow/ui/GitflowCloseTaskPanel.java index 3781b67..b5b065e 100644 --- a/src/gitflow/ui/GitflowCloseTaskPanel.java +++ b/src/gitflow/ui/GitflowCloseTaskPanel.java @@ -2,7 +2,6 @@ import com.intellij.openapi.components.ServiceManager; import com.intellij.openapi.project.Project; -import com.intellij.openapi.ui.Messages; import com.intellij.openapi.vcs.VcsTaskHandler; import com.intellij.tasks.Task; import com.intellij.tasks.TaskManager; @@ -12,8 +11,6 @@ import gitflow.*; import gitflow.actions.FinishFeatureAction; import gitflow.actions.FinishHotfixAction; -import gitflow.actions.GitflowAction; -import gitflow.actions.StartFeatureAction; import org.jetbrains.annotations.NotNull; import javax.swing.*; @@ -106,7 +103,7 @@ public void commit() { } else if (finishHotfixCheckbox.isSelected()){ FinishHotfixAction action = new FinishHotfixAction(myRepo); - action.runAction(myProject, taskBranchName, tagMessageTextField.getText()); + action.runAction(myProject, taskBranchName, tagMessageTextField.getText(), null); } } } diff --git a/src/gitflow/ui/GitflowOpenTaskPanel.java b/src/gitflow/ui/GitflowOpenTaskPanel.java index 2dbc78d..7e4bdd3 100644 --- a/src/gitflow/ui/GitflowOpenTaskPanel.java +++ b/src/gitflow/ui/GitflowOpenTaskPanel.java @@ -3,6 +3,7 @@ import com.intellij.openapi.components.ServiceManager; import com.intellij.openapi.project.Project; import com.intellij.openapi.vcs.VcsTaskHandler; +import com.intellij.tasks.LocalTask; import com.intellij.tasks.Task; import com.intellij.tasks.TaskManager; import com.intellij.tasks.impl.TaskManagerImpl; @@ -21,6 +22,9 @@ import javax.swing.*; import java.awt.event.ItemEvent; import java.awt.event.ItemListener; +import java.util.Collections; + +import static com.intellij.openapi.vcs.VcsTaskHandler.*; public class GitflowOpenTaskPanel extends TaskDialogPanel implements ItemListener { private JRadioButton noActionRadioButton; @@ -37,6 +41,7 @@ public class GitflowOpenTaskPanel extends TaskDialogPanel implements ItemListene private GitflowBranchUtil gitflowBranchUtil; private TaskManagerImpl myTaskManager; private VcsTaskHandler myVcsTaskHandler; + private LocalTask myPreviousTask; private Task currentTask; private GitflowState gitflowState; @@ -48,6 +53,7 @@ public GitflowOpenTaskPanel(Project project, Task task, GitRepository repo){ myRepo = repo; myTaskManager = (TaskManagerImpl) TaskManager.getManager(project); + myPreviousTask = myTaskManager.getActiveTask(); VcsTaskHandler[] vcsTaskHAndlers = VcsTaskHandler.getAllHandlers(project); if (vcsTaskHAndlers.length > 0){ //todo handle case of multiple vcs handlers @@ -100,19 +106,34 @@ public void commit() { final GitflowBranchUtil.ComboEntry selectedFeatureBaseBranch = (GitflowBranchUtil.ComboEntry) featureBaseBranch.getModel().getSelectedItem(); final GitflowBranchUtil.ComboEntry selectedHotfixBaseBranch = (GitflowBranchUtil.ComboEntry) hotfixBaseBranch.getModel().getSelectedItem(); - GitflowAction action; - if (startFeatureRadioButton.isSelected()) { - action = new StartFeatureAction(myRepo); - action.runAction(myProject, selectedFeatureBaseBranch.getBranchName(), featureName.getText()); - gitflowState.setTaskBranch(currentTask, GitflowConfigUtil.getFeaturePrefix(myProject, myRepo) + featureName.getText()); + final String branchName = GitflowConfigUtil.getFeaturePrefix(myProject, myRepo) + featureName.getText(); + runAction(new StartFeatureAction(myRepo), selectedFeatureBaseBranch.getBranchName(), branchName); } else if (startHotfixRadioButton.isSelected()) { - action = new StartHotfixAction(myRepo); - action.runAction(myProject, selectedHotfixBaseBranch.getBranchName(), hotfixName.getText()); - gitflowState.setTaskBranch(currentTask, GitflowConfigUtil.getHotfixPrefix(myProject, myRepo) + hotfixName.getText()); + final String branchName = GitflowConfigUtil.getHotfixPrefix(myProject, myRepo) + hotfixName.getText(); + runAction(new StartHotfixAction(myRepo), selectedHotfixBaseBranch.getBranchName(), branchName); + } + } + + private void runAction(GitflowAction action, String baseBranchName, final String branchName) { + final TaskInfo[] current = myVcsTaskHandler.getCurrentTasks(); + + if (myPreviousTask != null && myPreviousTask.getBranches(false).isEmpty()) { + TaskManagerImpl.addBranches(myPreviousTask, current, false); } + action.runAction(myProject, baseBranchName, branchName, new Runnable() { + @Override + public void run() { + final TaskInfo[] next = {new TaskInfo(branchName, Collections.singleton(myRepo.getPresentableUrl()))}; + final LocalTask localTask = myTaskManager.getActiveTask(); + + TaskManagerImpl.addBranches(localTask, next, false); + + gitflowState.setTaskBranch(currentTask, branchName); + } + }); } @Override From 9b8e9cc439ea6947ea87c08238cbc0434a6e0572 Mon Sep 17 00:00:00 2001 From: Nikolay Siniakevich Date: Mon, 12 Mar 2018 19:18:18 +0300 Subject: [PATCH 4/9] Support Idea 2018.1 version --- META-INF/plugin.xml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/META-INF/plugin.xml b/META-INF/plugin.xml index 4171998..ee39d3c 100644 --- a/META-INF/plugin.xml +++ b/META-INF/plugin.xml @@ -10,7 +10,7 @@ com.intellij.tasks Git4Idea - + Date: Sat, 24 Mar 2018 19:36:39 +0100 Subject: [PATCH 5/9] Comment code, do improvements, fix bug double feature/hotfix prefix #124 --- src/gitflow/actions/GitflowAction.java | 2 +- src/gitflow/actions/StartFeatureAction.java | 2 +- src/gitflow/actions/StartHotfixAction.java | 2 +- src/gitflow/ui/GitflowOpenTaskPanel.java | 23 +++++++++++++-------- 4 files changed, 17 insertions(+), 12 deletions(-) diff --git a/src/gitflow/actions/GitflowAction.java b/src/gitflow/actions/GitflowAction.java index 257a48d..73f607e 100644 --- a/src/gitflow/actions/GitflowAction.java +++ b/src/gitflow/actions/GitflowAction.java @@ -16,7 +16,7 @@ import gitflow.GitflowConfigUtil; import gitflow.ui.NotifyUtil; -import javax.annotation.Nullable; +import org.jetbrains.annotations.Nullable; import java.util.ArrayList; public class GitflowAction extends DumbAwareAction { diff --git a/src/gitflow/actions/StartFeatureAction.java b/src/gitflow/actions/StartFeatureAction.java index f537335..14e019d 100644 --- a/src/gitflow/actions/StartFeatureAction.java +++ b/src/gitflow/actions/StartFeatureAction.java @@ -13,7 +13,7 @@ import gitflow.ui.GitflowStartFeatureDialog; import gitflow.ui.NotifyUtil; -import javax.annotation.Nullable; +import org.jetbrains.annotations.Nullable; public class StartFeatureAction extends GitflowAction { diff --git a/src/gitflow/actions/StartHotfixAction.java b/src/gitflow/actions/StartHotfixAction.java index f67112c..e7ae47c 100644 --- a/src/gitflow/actions/StartHotfixAction.java +++ b/src/gitflow/actions/StartHotfixAction.java @@ -13,7 +13,7 @@ import gitflow.ui.GitflowStartHotfixDialog; import gitflow.ui.NotifyUtil; -import javax.annotation.Nullable; +import org.jetbrains.annotations.Nullable; public class StartHotfixAction extends GitflowAction { diff --git a/src/gitflow/ui/GitflowOpenTaskPanel.java b/src/gitflow/ui/GitflowOpenTaskPanel.java index 7e4bdd3..b1c0af6 100644 --- a/src/gitflow/ui/GitflowOpenTaskPanel.java +++ b/src/gitflow/ui/GitflowOpenTaskPanel.java @@ -108,30 +108,35 @@ public void commit() { if (startFeatureRadioButton.isSelected()) { final String branchName = GitflowConfigUtil.getFeaturePrefix(myProject, myRepo) + featureName.getText(); - runAction(new StartFeatureAction(myRepo), selectedFeatureBaseBranch.getBranchName(), branchName); + attachTaskAndRunAction(new StartFeatureAction(myRepo), selectedFeatureBaseBranch.getBranchName(), featureName.getText(), branchName); } else if (startHotfixRadioButton.isSelected()) { final String branchName = GitflowConfigUtil.getHotfixPrefix(myProject, myRepo) + hotfixName.getText(); - runAction(new StartHotfixAction(myRepo), selectedHotfixBaseBranch.getBranchName(), branchName); + attachTaskAndRunAction(new StartHotfixAction(myRepo), selectedHotfixBaseBranch.getBranchName(), hotfixName.getText(), branchName); } } - private void runAction(GitflowAction action, String baseBranchName, final String branchName) { + /** + * @param action instance of GitflowAction + * @param baseBranchName Branch name of the branch the new one is based on + * @param branchName Branch name without feature/hotfix prefix, because the prefix is also set in checkout + * @param fullBranchName Branch name with feature/hotfix prefix for saving to task + */ + private void attachTaskAndRunAction(GitflowAction action, String baseBranchName, final String branchName, final String fullBranchName) { final TaskInfo[] current = myVcsTaskHandler.getCurrentTasks(); - if (myPreviousTask != null && myPreviousTask.getBranches(false).isEmpty()) { - TaskManagerImpl.addBranches(myPreviousTask, current, false); - } - + //Create new branch / checkout branch action.runAction(myProject, baseBranchName, branchName, new Runnable() { @Override public void run() { - final TaskInfo[] next = {new TaskInfo(branchName, Collections.singleton(myRepo.getPresentableUrl()))}; + final TaskInfo[] next = {new TaskInfo(fullBranchName, Collections.singleton(myRepo.getPresentableUrl()))}; final LocalTask localTask = myTaskManager.getActiveTask(); + //Add branch to task TaskManagerImpl.addBranches(localTask, next, false); - gitflowState.setTaskBranch(currentTask, branchName); + //maps branch to task + gitflowState.setTaskBranch(currentTask, fullBranchName); } }); } From 1bd986268d2e5e0af394f2fa24cab59f6e08d6fe Mon Sep 17 00:00:00 2001 From: OpherV Date: Sun, 25 Mar 2018 15:43:07 +0300 Subject: [PATCH 6/9] fix #180, error on closing non-gitflow active task --- src/gitflow/ui/GitflowCloseTaskPanel.java | 19 +++++++++++-------- 1 file changed, 11 insertions(+), 8 deletions(-) diff --git a/src/gitflow/ui/GitflowCloseTaskPanel.java b/src/gitflow/ui/GitflowCloseTaskPanel.java index b5b065e..8eb7e03 100644 --- a/src/gitflow/ui/GitflowCloseTaskPanel.java +++ b/src/gitflow/ui/GitflowCloseTaskPanel.java @@ -95,15 +95,18 @@ public JComponent getPanel() { @Override public void commit() { String taskFullBranchName = gitflowState.getTaskBranch(myTask); - String taskBranchName = gitflowBranchUtil.stripFullBranchName(taskFullBranchName); - if (finishFeatureCheckbox.isSelected()){ - FinishFeatureAction action = new FinishFeatureAction(myRepo); - action.runAction(myProject, taskBranchName); - } - else if (finishHotfixCheckbox.isSelected()){ - FinishHotfixAction action = new FinishHotfixAction(myRepo); - action.runAction(myProject, taskBranchName, tagMessageTextField.getText(), null); + // test if current task is a gitflow task + if (taskFullBranchName != null) { + String taskBranchName = gitflowBranchUtil.stripFullBranchName(taskFullBranchName); + + if (finishFeatureCheckbox.isSelected()) { + FinishFeatureAction action = new FinishFeatureAction(myRepo); + action.runAction(myProject, taskBranchName); + } else if (finishHotfixCheckbox.isSelected()) { + FinishHotfixAction action = new FinishHotfixAction(myRepo); + action.runAction(myProject, taskBranchName, tagMessageTextField.getText(), null); + } } } } From 7a2e652ff80e85670ebd53ff43770760c152e424 Mon Sep 17 00:00:00 2001 From: OpherV Date: Sun, 25 Mar 2018 16:19:54 +0300 Subject: [PATCH 7/9] Fix issue where closing a hotfix from the task close menu will not work --- src/gitflow/ui/GitflowCloseTaskPanel.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/gitflow/ui/GitflowCloseTaskPanel.java b/src/gitflow/ui/GitflowCloseTaskPanel.java index 8eb7e03..7c3967b 100644 --- a/src/gitflow/ui/GitflowCloseTaskPanel.java +++ b/src/gitflow/ui/GitflowCloseTaskPanel.java @@ -105,7 +105,7 @@ public void commit() { action.runAction(myProject, taskBranchName); } else if (finishHotfixCheckbox.isSelected()) { FinishHotfixAction action = new FinishHotfixAction(myRepo); - action.runAction(myProject, taskBranchName, tagMessageTextField.getText(), null); + action.runAction(myProject, taskBranchName, tagMessageTextField.getText()); } } } From a90f141f6cfb59d786460f3822d92ac4ba8186e7 Mon Sep 17 00:00:00 2001 From: OpherV Date: Sun, 25 Mar 2018 16:20:20 +0300 Subject: [PATCH 8/9] Refactoring for some nicer code --- src/gitflow/GitflowBranchUtil.java | 12 ++++++------ src/gitflow/ui/GitflowOpenTaskPanel.java | 9 ++++----- 2 files changed, 10 insertions(+), 11 deletions(-) diff --git a/src/gitflow/GitflowBranchUtil.java b/src/gitflow/GitflowBranchUtil.java index 1ed8b0b..7f45be5 100644 --- a/src/gitflow/GitflowBranchUtil.java +++ b/src/gitflow/GitflowBranchUtil.java @@ -211,15 +211,15 @@ public ComboBoxModel createBranchComboModel(String defaultBranch) { /** * Strip a full branch name from its gitflow prefix - * @param taskFullBranchName full name of the branch (e.g. 'feature/hello'); + * @param fullBranchName full name of the branch (e.g. 'feature/hello'); * @return the branch name, prefix free (e.g. 'hello') */ - public String stripFullBranchName(String taskFullBranchName) { - if (taskFullBranchName.startsWith(prefixFeature)){ - return taskFullBranchName.substring(prefixFeature.length(), taskFullBranchName.length()); + public String stripFullBranchName(String fullBranchName) { + if (fullBranchName.startsWith(prefixFeature)){ + return fullBranchName.substring(prefixFeature.length(), fullBranchName.length()); } - else if (taskFullBranchName.startsWith(prefixHotfix)){ - return taskFullBranchName.substring(prefixHotfix.length(), taskFullBranchName.length()); + else if (fullBranchName.startsWith(prefixHotfix)){ + return fullBranchName.substring(prefixHotfix.length(), fullBranchName.length()); } else{ return null; diff --git a/src/gitflow/ui/GitflowOpenTaskPanel.java b/src/gitflow/ui/GitflowOpenTaskPanel.java index b1c0af6..6864231 100644 --- a/src/gitflow/ui/GitflowOpenTaskPanel.java +++ b/src/gitflow/ui/GitflowOpenTaskPanel.java @@ -108,22 +108,21 @@ public void commit() { if (startFeatureRadioButton.isSelected()) { final String branchName = GitflowConfigUtil.getFeaturePrefix(myProject, myRepo) + featureName.getText(); - attachTaskAndRunAction(new StartFeatureAction(myRepo), selectedFeatureBaseBranch.getBranchName(), featureName.getText(), branchName); + attachTaskAndRunAction(new StartFeatureAction(myRepo), selectedFeatureBaseBranch.getBranchName(), branchName); } else if (startHotfixRadioButton.isSelected()) { final String branchName = GitflowConfigUtil.getHotfixPrefix(myProject, myRepo) + hotfixName.getText(); - attachTaskAndRunAction(new StartHotfixAction(myRepo), selectedHotfixBaseBranch.getBranchName(), hotfixName.getText(), branchName); + attachTaskAndRunAction(new StartHotfixAction(myRepo), selectedHotfixBaseBranch.getBranchName(), branchName); } } /** * @param action instance of GitflowAction * @param baseBranchName Branch name of the branch the new one is based on - * @param branchName Branch name without feature/hotfix prefix, because the prefix is also set in checkout * @param fullBranchName Branch name with feature/hotfix prefix for saving to task */ - private void attachTaskAndRunAction(GitflowAction action, String baseBranchName, final String branchName, final String fullBranchName) { - final TaskInfo[] current = myVcsTaskHandler.getCurrentTasks(); + private void attachTaskAndRunAction(GitflowAction action, String baseBranchName, final String fullBranchName) { + final String branchName = gitflowBranchUtil.stripFullBranchName(fullBranchName); //Create new branch / checkout branch action.runAction(myProject, baseBranchName, branchName, new Runnable() { From 6adaccf74b88d60a320302016f48d7002b385585 Mon Sep 17 00:00:00 2001 From: OpherV Date: Sun, 25 Mar 2018 16:26:40 +0300 Subject: [PATCH 9/9] Bump version to 0.6.4 --- META-INF/plugin.xml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/META-INF/plugin.xml b/META-INF/plugin.xml index ee39d3c..86dea8a 100644 --- a/META-INF/plugin.xml +++ b/META-INF/plugin.xml @@ -2,7 +2,7 @@ Git Flow Integration Gitflow Git Flow Integration - 0.6.3 + 0.6.4 VCS Integration Opher Vishnia