From 4c08c750986cb8881311d718155f194a3e366c17 Mon Sep 17 00:00:00 2001 From: FranckMethia Date: Wed, 13 Jun 2018 15:20:31 -0400 Subject: [PATCH 1/6] Update plugin.xml For work with the last version (2018.2) of IntelliJ --- META-INF/plugin.xml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/META-INF/plugin.xml b/META-INF/plugin.xml index e53ccbf..6d6cf00 100644 --- a/META-INF/plugin.xml +++ b/META-INF/plugin.xml @@ -2,7 +2,7 @@ Git Flow Integration Gitflow Git Flow Integration - 0.6.5.1 + 0.6.5.2 VCS Integration Opher Vishnia @@ -10,7 +10,7 @@ com.intellij.tasks Git4Idea - + Date: Fri, 21 Sep 2018 22:57:32 +0300 Subject: [PATCH 2/6] GitflowLineHandler: remove redundancy --- src/gitflow/actions/GitflowLineHandler.java | 5 ----- 1 file changed, 5 deletions(-) diff --git a/src/gitflow/actions/GitflowLineHandler.java b/src/gitflow/actions/GitflowLineHandler.java index 6dd2e2e..ce1411c 100644 --- a/src/gitflow/actions/GitflowLineHandler.java +++ b/src/gitflow/actions/GitflowLineHandler.java @@ -3,7 +3,6 @@ import com.intellij.openapi.project.Project; import com.intellij.openapi.util.Key; import git4idea.commands.GitLineHandlerListener; -import org.apache.commons.lang.StringUtils; import java.util.ArrayList; @@ -24,8 +23,4 @@ public void processTerminated(int exitCode) {} @Override public void startFailed(Throwable exception) {} - - public String getErrors(){ - return StringUtils.join(myErrors, ","); - } } \ No newline at end of file From 6e48ae7aa6c153aae32d4f5d644797824c2390ff Mon Sep 17 00:00:00 2001 From: Opher Vishnia Date: Fri, 21 Sep 2018 23:03:23 +0300 Subject: [PATCH 3/6] plugin.xml: change build to 182 --- META-INF/plugin.xml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/META-INF/plugin.xml b/META-INF/plugin.xml index 6d6cf00..0e5aede 100644 --- a/META-INF/plugin.xml +++ b/META-INF/plugin.xml @@ -2,7 +2,7 @@ Git Flow Integration Gitflow Git Flow Integration - 0.6.5.2 + 0.6.5.1 VCS Integration Opher Vishnia @@ -10,7 +10,7 @@ com.intellij.tasks Git4Idea - + Date: Fri, 21 Sep 2018 23:05:23 +0300 Subject: [PATCH 4/6] Fix #197 NullPointerException on close active task --- src/gitflow/DefaultOptions.java | 18 ++++++++++++++++++ src/gitflow/GitflowConfigurable.java | 9 ++++++++- src/gitflow/GitflowOptionsFactory.java | 4 ++-- src/gitflow/actions/FinishHotfixAction.java | 16 +++------------- src/gitflow/actions/FinishReleaseAction.java | 15 ++------------- src/gitflow/ui/GitflowCloseTaskPanel.java | 4 +--- 6 files changed, 34 insertions(+), 32 deletions(-) create mode 100644 src/gitflow/DefaultOptions.java diff --git a/src/gitflow/DefaultOptions.java b/src/gitflow/DefaultOptions.java new file mode 100644 index 0000000..0e75c54 --- /dev/null +++ b/src/gitflow/DefaultOptions.java @@ -0,0 +1,18 @@ +package gitflow; + +import java.util.HashMap; +import java.util.Map; + +public class DefaultOptions { + private static final Map options; + static + { + options = new HashMap(); + options.put("RELEASE_customTagCommitMessage", "Tagging version %name%"); + options.put("HOTFIX_customHotfixCommitMessage", "Tagging hotfix %name%"); + } + + public static String getOption(String optionId){ + return options.get(optionId); + } +} diff --git a/src/gitflow/GitflowConfigurable.java b/src/gitflow/GitflowConfigurable.java index f04dfe0..cd8176c 100644 --- a/src/gitflow/GitflowConfigurable.java +++ b/src/gitflow/GitflowConfigurable.java @@ -9,6 +9,7 @@ import javax.swing.*; import java.util.ArrayList; +import java.util.HashMap; import java.util.Map; /** @@ -21,12 +22,14 @@ public class GitflowConfigurable implements Configurable { GitflowOptionsForm gitflowOptionsForm; PropertiesComponent propertiesComponent; Map, ArrayList>> gitflowOptions; + Map optionDefaults; static GitflowConfigurable instance; public GitflowConfigurable(Project project) { gitflowOptions = GitflowOptionsFactory.getOptions(); propertiesComponent = PropertiesComponent.getInstance(project); + optionDefaults = new HashMap(); this.project = project; instance = this; } @@ -58,7 +61,11 @@ public static boolean isOptionActive(Project project, String optionId){ } public static String getOptionTextString (Project project, String optionId){ - return PropertiesComponent.getInstance(project).getValue(optionId+"_text"); + String retValue = PropertiesComponent.getInstance(project).getValue(optionId+"_text"); + if (retValue == null){ + retValue = DefaultOptions.getOption(optionId); + } + return retValue; } @Override diff --git a/src/gitflow/GitflowOptionsFactory.java b/src/gitflow/GitflowOptionsFactory.java index ef25a7c..108c365 100644 --- a/src/gitflow/GitflowOptionsFactory.java +++ b/src/gitflow/GitflowOptionsFactory.java @@ -36,13 +36,13 @@ private GitflowOptionsFactory(){ addOption(TYPE.RELEASE, "Keep branch after performing finish", "keepBranch" , "-k"); // addOption(TYPE.RELEASE, "Squash release during merge", "squash" , "-S"); addOption(TYPE.RELEASE, "Don't tag release", "dontTag" , "-n"); - addOption(TYPE.RELEASE, "Use custom tag commit message", "customTagCommitMessage" , null, "Tagging version %name%" ,"Use %name% for the branch name"); + addOption(TYPE.RELEASE, "Use custom tag commit message", "customTagCommitMessage" , null, DefaultOptions.getOption("RELEASE_customTagCommitMessage") ,"Use %name% for the branch name"); addBranchType(TYPE.HOTFIX); addOption(TYPE.HOTFIX, "Fetch from Origin", "fetchFromOrigin" , "-F"); addOption(TYPE.HOTFIX, "Push on finish Hotfix", "pushOnFinish" , "-p"); addOption(TYPE.HOTFIX, "Don't tag Hotfix", "dontTag" , "-n"); - addOption(TYPE.HOTFIX, "Use custom hotfix commit message", "customHotfixCommitMessage" , null, "Tagging hotfix %name%" ,"Use %name% for the branch name"); + addOption(TYPE.HOTFIX, "Use custom hotfix commit message", "customHotfixCommitMessage" , null, DefaultOptions.getOption("HOTFIX_customHotfixCommitMessage") ,"Use %name% for the branch name"); } private void addBranchType(Enum branchType){ diff --git a/src/gitflow/actions/FinishHotfixAction.java b/src/gitflow/actions/FinishHotfixAction.java index 3da7bb1..b6a05a2 100644 --- a/src/gitflow/actions/FinishHotfixAction.java +++ b/src/gitflow/actions/FinishHotfixAction.java @@ -29,26 +29,16 @@ public void actionPerformed(AnActionEvent e) { String currentBranchName = GitBranchUtil.getBranchNameOrRev(myRepo); - if (currentBranchName.isEmpty()==false){ + if (currentBranchName.isEmpty() == false){ //TODO HOTFIX NAME final String hotfixName = GitflowConfigUtil.getHotfixNameFromBranch(myProject, myRepo, currentBranchName); final String tagMessage; - String tagMessageTemplate; - - String defaultTagMessage = "Tagging hotfix %name%"; - String customTagMessage = GitflowConfigurable.getOptionTextString(myProject, "HOTFIX_customHotfixCommitMessage"); - - if (customTagMessage != null) { - tagMessageTemplate = customTagMessage.replace("%name%", hotfixName); - } - else{ - tagMessageTemplate = defaultTagMessage.replace("%name%", hotfixName); - } + String tagMessageTemplate = GitflowConfigurable.getOptionTextString(myProject, "HOTFIX_customHotfixCommitMessage").replace("%name%", hotfixName); if (GitflowConfigurable.isOptionActive(myProject, "HOTFIX_dontTag")) { - tagMessage=""; + tagMessage = ""; } else { tagMessage = Messages.showInputDialog(myProject, "Enter the tag message:", "Finish Hotfix", Messages.getQuestionIcon(), tagMessageTemplate, null); diff --git a/src/gitflow/actions/FinishReleaseAction.java b/src/gitflow/actions/FinishReleaseAction.java index 0901c5b..7166b88 100644 --- a/src/gitflow/actions/FinishReleaseAction.java +++ b/src/gitflow/actions/FinishReleaseAction.java @@ -47,21 +47,10 @@ public void actionPerformed(AnActionEvent e) { releaseName = customReleaseName!=null ? customReleaseName:GitflowConfigUtil.getReleaseNameFromBranch(myProject, myRepo, currentBranchName); final GitflowErrorsListener errorLineHandler = new GitflowErrorsListener(myProject); - - String tagMessageTemplate; - - String defaultTagMessage = "Tagging version %name%"; - String customTagMessage = GitflowConfigurable.getOptionTextString(myProject, "RELEASE_customTagCommitMessage"); - if (customTagMessage != null) { - tagMessageTemplate = customTagMessage.replace("%name%", releaseName); - } - else{ - tagMessageTemplate = defaultTagMessage.replace("%name%", releaseName); - } - + + String tagMessageTemplate = GitflowConfigurable.getOptionTextString(myProject, "RELEASE_customTagCommitMessage").replace("%name%", releaseName); String tagMessageDraft; - boolean cancelAction=false; if (GitflowConfigurable.isOptionActive(myProject, "RELEASE_dontTag")) { diff --git a/src/gitflow/ui/GitflowCloseTaskPanel.java b/src/gitflow/ui/GitflowCloseTaskPanel.java index 8b3eb80..f3d3bd8 100644 --- a/src/gitflow/ui/GitflowCloseTaskPanel.java +++ b/src/gitflow/ui/GitflowCloseTaskPanel.java @@ -51,9 +51,7 @@ public class GitflowCloseTaskPanel extends TaskDialogPanel { String branchName = myVcsTaskHandler != null ? myVcsTaskHandler.cleanUpBranchName(myTaskManager.constructDefaultBranchName(task)) : myTaskManager.suggestBranchName(task); - - //TODO same code exists in FinishHotfixAction, make DRYer - + if (GitflowConfigurable.isOptionActive(project, "HOTFIX_dontTag")) { tagMessage=""; tagMessageTextField.setEnabled(false); From 816f0825ee8da006c31a5412be43189def037431 Mon Sep 17 00:00:00 2001 From: Opher Vishnia Date: Fri, 21 Sep 2018 23:27:51 +0300 Subject: [PATCH 5/6] Fix #154 NullPointerException while "Track Release" --- src/gitflow/ui/GitflowBranchChooseDialog.java | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/src/gitflow/ui/GitflowBranchChooseDialog.java b/src/gitflow/ui/GitflowBranchChooseDialog.java index 14ea8ab..66f3d06 100644 --- a/src/gitflow/ui/GitflowBranchChooseDialog.java +++ b/src/gitflow/ui/GitflowBranchChooseDialog.java @@ -2,6 +2,7 @@ import com.intellij.openapi.project.Project; import com.intellij.openapi.ui.DialogWrapper; +import com.intellij.openapi.ui.ValidationInfo; import org.jetbrains.annotations.Nullable; import javax.swing.*; @@ -29,6 +30,16 @@ public GitflowBranchChooseDialog(Project project, List branchNames) { init(); } + @Nullable + @Override + protected ValidationInfo doValidate() { + if (branchList.getSelectedValue() == null){ + return new ValidationInfo("No branch selected!"); + } else { + return null; + } + } + @Nullable @Override protected JComponent createCenterPanel() { From fa8619c41ceebc0248b56904ec91d6c8cc6eb432 Mon Sep 17 00:00:00 2001 From: Opher Vishnia Date: Fri, 21 Sep 2018 23:38:00 +0300 Subject: [PATCH 6/6] Bump to 0.6.6 --- 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 0e5aede..71d7792 100644 --- a/META-INF/plugin.xml +++ b/META-INF/plugin.xml @@ -2,7 +2,7 @@ Git Flow Integration Gitflow Git Flow Integration - 0.6.5.1 + 0.6.6 VCS Integration Opher Vishnia