Skip to content

Commit 8e5f6d4

Browse files
committed
Merge branch 'release/0.6.6'
2 parents 79aa567 + fa8619c commit 8e5f6d4

9 files changed

+47
-39
lines changed

META-INF/plugin.xml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,15 +2,15 @@
22
<name>Git Flow Integration</name>
33
<id>Gitflow</id>
44
<description>Git Flow Integration</description>
5-
<version>0.6.5.1</version>
5+
<version>0.6.6</version>
66
<category>VCS Integration</category>
77
<vendor url="http://www.opherv.com">Opher Vishnia</vendor>
88

99
<depends>com.intellij.modules.vcs</depends>
1010
<depends>com.intellij.tasks</depends>
1111
<depends>Git4Idea</depends>
1212

13-
<idea-version since-build="181.0" until-build="181.*"/>
13+
<idea-version since-build="182.0" until-build="182.*"/>
1414

1515
<actions>
1616
<action id="Gitflow.OpenGitflowPopup" class="gitflow.actions.OpenGitflowPopup"

src/gitflow/DefaultOptions.java

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
package gitflow;
2+
3+
import java.util.HashMap;
4+
import java.util.Map;
5+
6+
public class DefaultOptions {
7+
private static final Map<String, String> options;
8+
static
9+
{
10+
options = new HashMap<String, String>();
11+
options.put("RELEASE_customTagCommitMessage", "Tagging version %name%");
12+
options.put("HOTFIX_customHotfixCommitMessage", "Tagging hotfix %name%");
13+
}
14+
15+
public static String getOption(String optionId){
16+
return options.get(optionId);
17+
}
18+
}

src/gitflow/GitflowConfigurable.java

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@
99

1010
import javax.swing.*;
1111
import java.util.ArrayList;
12+
import java.util.HashMap;
1213
import java.util.Map;
1314

1415
/**
@@ -21,12 +22,14 @@ public class GitflowConfigurable implements Configurable {
2122
GitflowOptionsForm gitflowOptionsForm;
2223
PropertiesComponent propertiesComponent;
2324
Map<Enum<GitflowOptionsFactory.TYPE>, ArrayList<Map<String,String>>> gitflowOptions;
25+
Map<String, String> optionDefaults;
2426

2527
static GitflowConfigurable instance;
2628

2729
public GitflowConfigurable(Project project) {
2830
gitflowOptions = GitflowOptionsFactory.getOptions();
2931
propertiesComponent = PropertiesComponent.getInstance(project);
32+
optionDefaults = new HashMap<String, String>();
3033
this.project = project;
3134
instance = this;
3235
}
@@ -58,7 +61,11 @@ public static boolean isOptionActive(Project project, String optionId){
5861
}
5962

6063
public static String getOptionTextString (Project project, String optionId){
61-
return PropertiesComponent.getInstance(project).getValue(optionId+"_text");
64+
String retValue = PropertiesComponent.getInstance(project).getValue(optionId+"_text");
65+
if (retValue == null){
66+
retValue = DefaultOptions.getOption(optionId);
67+
}
68+
return retValue;
6269
}
6370

6471
@Override

src/gitflow/GitflowOptionsFactory.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -36,13 +36,13 @@ private GitflowOptionsFactory(){
3636
addOption(TYPE.RELEASE, "Keep branch after performing finish", "keepBranch" , "-k");
3737
// addOption(TYPE.RELEASE, "Squash release during merge", "squash" , "-S");
3838
addOption(TYPE.RELEASE, "Don't tag release", "dontTag" , "-n");
39-
addOption(TYPE.RELEASE, "Use custom tag commit message", "customTagCommitMessage" , null, "Tagging version %name%" ,"Use %name% for the branch name");
39+
addOption(TYPE.RELEASE, "Use custom tag commit message", "customTagCommitMessage" , null, DefaultOptions.getOption("RELEASE_customTagCommitMessage") ,"Use %name% for the branch name");
4040

4141
addBranchType(TYPE.HOTFIX);
4242
addOption(TYPE.HOTFIX, "Fetch from Origin", "fetchFromOrigin" , "-F");
4343
addOption(TYPE.HOTFIX, "Push on finish Hotfix", "pushOnFinish" , "-p");
4444
addOption(TYPE.HOTFIX, "Don't tag Hotfix", "dontTag" , "-n");
45-
addOption(TYPE.HOTFIX, "Use custom hotfix commit message", "customHotfixCommitMessage" , null, "Tagging hotfix %name%" ,"Use %name% for the branch name");
45+
addOption(TYPE.HOTFIX, "Use custom hotfix commit message", "customHotfixCommitMessage" , null, DefaultOptions.getOption("HOTFIX_customHotfixCommitMessage") ,"Use %name% for the branch name");
4646
}
4747

4848
private void addBranchType(Enum<TYPE> branchType){

src/gitflow/actions/FinishHotfixAction.java

Lines changed: 3 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -29,26 +29,16 @@ public void actionPerformed(AnActionEvent e) {
2929
String currentBranchName = GitBranchUtil.getBranchNameOrRev(myRepo);
3030

3131

32-
if (currentBranchName.isEmpty()==false){
32+
if (currentBranchName.isEmpty() == false){
3333

3434
//TODO HOTFIX NAME
3535
final String hotfixName = GitflowConfigUtil.getHotfixNameFromBranch(myProject, myRepo, currentBranchName);
3636

3737
final String tagMessage;
38-
String tagMessageTemplate;
39-
40-
String defaultTagMessage = "Tagging hotfix %name%";
41-
String customTagMessage = GitflowConfigurable.getOptionTextString(myProject, "HOTFIX_customHotfixCommitMessage");
42-
43-
if (customTagMessage != null) {
44-
tagMessageTemplate = customTagMessage.replace("%name%", hotfixName);
45-
}
46-
else{
47-
tagMessageTemplate = defaultTagMessage.replace("%name%", hotfixName);
48-
}
38+
String tagMessageTemplate = GitflowConfigurable.getOptionTextString(myProject, "HOTFIX_customHotfixCommitMessage").replace("%name%", hotfixName);
4939

5040
if (GitflowConfigurable.isOptionActive(myProject, "HOTFIX_dontTag")) {
51-
tagMessage="";
41+
tagMessage = "";
5242
}
5343
else {
5444
tagMessage = Messages.showInputDialog(myProject, "Enter the tag message:", "Finish Hotfix", Messages.getQuestionIcon(), tagMessageTemplate, null);

src/gitflow/actions/FinishReleaseAction.java

Lines changed: 2 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -47,21 +47,10 @@ public void actionPerformed(AnActionEvent e) {
4747
releaseName = customReleaseName!=null ? customReleaseName:GitflowConfigUtil.getReleaseNameFromBranch(myProject, myRepo, currentBranchName);
4848

4949
final GitflowErrorsListener errorLineHandler = new GitflowErrorsListener(myProject);
50-
51-
String tagMessageTemplate;
52-
53-
String defaultTagMessage = "Tagging version %name%";
54-
String customTagMessage = GitflowConfigurable.getOptionTextString(myProject, "RELEASE_customTagCommitMessage");
55-
if (customTagMessage != null) {
56-
tagMessageTemplate = customTagMessage.replace("%name%", releaseName);
57-
}
58-
else{
59-
tagMessageTemplate = defaultTagMessage.replace("%name%", releaseName);
60-
}
61-
50+
51+
String tagMessageTemplate = GitflowConfigurable.getOptionTextString(myProject, "RELEASE_customTagCommitMessage").replace("%name%", releaseName);
6252
String tagMessageDraft;
6353

64-
6554
boolean cancelAction=false;
6655

6756
if (GitflowConfigurable.isOptionActive(myProject, "RELEASE_dontTag")) {

src/gitflow/actions/GitflowLineHandler.java

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,6 @@
33
import com.intellij.openapi.project.Project;
44
import com.intellij.openapi.util.Key;
55
import git4idea.commands.GitLineHandlerListener;
6-
import org.apache.commons.lang.StringUtils;
76

87
import java.util.ArrayList;
98

@@ -24,8 +23,4 @@ public void processTerminated(int exitCode) {}
2423

2524
@Override
2625
public void startFailed(Throwable exception) {}
27-
28-
public String getErrors(){
29-
return StringUtils.join(myErrors, ",");
30-
}
3126
}

src/gitflow/ui/GitflowBranchChooseDialog.java

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22

33
import com.intellij.openapi.project.Project;
44
import com.intellij.openapi.ui.DialogWrapper;
5+
import com.intellij.openapi.ui.ValidationInfo;
56
import org.jetbrains.annotations.Nullable;
67

78
import javax.swing.*;
@@ -29,6 +30,16 @@ public GitflowBranchChooseDialog(Project project, List<String> branchNames) {
2930
init();
3031
}
3132

33+
@Nullable
34+
@Override
35+
protected ValidationInfo doValidate() {
36+
if (branchList.getSelectedValue() == null){
37+
return new ValidationInfo("No branch selected!");
38+
} else {
39+
return null;
40+
}
41+
}
42+
3243
@Nullable
3344
@Override
3445
protected JComponent createCenterPanel() {

src/gitflow/ui/GitflowCloseTaskPanel.java

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -51,9 +51,7 @@ public class GitflowCloseTaskPanel extends TaskDialogPanel {
5151
String branchName = myVcsTaskHandler != null
5252
? myVcsTaskHandler.cleanUpBranchName(myTaskManager.constructDefaultBranchName(task))
5353
: myTaskManager.suggestBranchName(task);
54-
55-
//TODO same code exists in FinishHotfixAction, make DRYer
56-
54+
5755
if (GitflowConfigurable.isOptionActive(project, "HOTFIX_dontTag")) {
5856
tagMessage="";
5957
tagMessageTextField.setEnabled(false);

0 commit comments

Comments
 (0)