Skip to content

Commit

Permalink
Merge branch 'release/0.4'
Browse files Browse the repository at this point in the history
  • Loading branch information
OpherV committed Oct 21, 2014
2 parents 12c8338 + 1c41eef commit 2549def
Show file tree
Hide file tree
Showing 7 changed files with 119 additions and 32 deletions.
4 changes: 2 additions & 2 deletions META-INF/plugin.xml
Original file line number Diff line number Diff line change
Expand Up @@ -2,14 +2,14 @@
<name>Git Flow Integration</name>
<id>Gitflow</id>
<description>Git Flow Integration</description>
<version>0.3.9</version>
<version>0.4</version>
<category>VCS Integration</category>
<vendor url="http://www.opherv.com">Opher Vishnia</vendor>

<depends>com.intellij.modules.vcs</depends>
<depends>Git4Idea</depends>

<idea-version since-build="129" until-build="138.999999"/>
<idea-version since-build="129" until-build="139.999999"/>

<actions>
<action id="Gitflow.InitRepo" class="gitflow.actions.InitRepoAction" text="Initialize Gitflow Repository"></action>
Expand Down
28 changes: 27 additions & 1 deletion src/gitflow/GitflowConfigurable.java
Original file line number Diff line number Diff line change
Expand Up @@ -15,13 +15,18 @@
*/

public class GitflowConfigurable implements Configurable {
public static final String GITFLOW_FEATURE_FETCH_ORIGIN = "Gitflow.featureFetchOrigin";
public static final String GITFLOW_FEATURE_KEEP_REMOTE = "Gitflow.featureKeepRemote";

public static final String GITFLOW_RELEASE_FETCH_ORIGIN = "Gitflow.releaseFetchOrigin";
public static final String GITFLOW_PUSH_ON_FINISH_RELEASE = "Gitflow.pushOnFinishRelease";
public static final String GITFLOW_PUSH_ON_FINISH_HOTFIX = "Gitflow.pushOnFinishHotfix";
public static final String GITFLOW_DONT_TAG_RELEASE = "Gitflow.dontTagRelease";
public static final String GITFLOW_USE_CUSTOM_TAG_COMMIT_MESSAGE = "Gitflow.useCustomTagCommitMessage";
public static final String GITFLOW_CUSTOM_TAG_COMMIT_MESSAGE = "Gitflow.customTagCommitMessage";


public static final String GITFLOW_HOTFIX_FETCH_ORIGIN = "Gitflow.hotfixFetchOrigin";
public static final String GITFLOW_DONT_TAG_HOTFIX = "Gitflow.dontTagHotfix";
public static final String GITFLOW_USE_CUSTOM_HOTFIX_TAG_COMMIT_MESSAGE = "Gitflow.useCustomHotfixTagCommitMessage";
public static final String GITFLOW_CUSTOM_HOTFIX_TAG_COMMIT_MESSAGE = "Gitflow.customHotfixTagCommitMessage";
Expand All @@ -40,12 +45,20 @@ public GitflowConfigurable(Project project)

/* feature */

public static boolean featureFetchOrigin(Project project) {
return PropertiesComponent.getInstance(project).getBoolean(GitflowConfigurable.GITFLOW_FEATURE_FETCH_ORIGIN, false);
}

public static boolean featureKeepRemote(Project project) {
return PropertiesComponent.getInstance(project).getBoolean(GitflowConfigurable.GITFLOW_FEATURE_KEEP_REMOTE, false);
}

/* release */

public static boolean releaseFetchOrigin(Project project) {
return PropertiesComponent.getInstance(project).getBoolean(GitflowConfigurable.GITFLOW_RELEASE_FETCH_ORIGIN, false);
}

public static boolean pushOnReleaseFinish(Project project) {
return PropertiesComponent.getInstance(project).getBoolean(GitflowConfigurable.GITFLOW_PUSH_ON_FINISH_RELEASE, false);
}
Expand All @@ -72,6 +85,10 @@ public static String getCustomTagCommitMessage(Project project) {

/*hotfix*/

public static boolean hotfixFetchOrigin(Project project) {
return PropertiesComponent.getInstance(project).getBoolean(GitflowConfigurable.GITFLOW_HOTFIX_FETCH_ORIGIN, false);
}

public static boolean pushOnHotfixFinish(Project project) {
return PropertiesComponent.getInstance(project).getBoolean(GitflowConfigurable.GITFLOW_PUSH_ON_FINISH_HOTFIX, false);
}
Expand Down Expand Up @@ -117,13 +134,16 @@ public JComponent createComponent() {

@Override
public boolean isModified() {
return PropertiesComponent.getInstance(project).getBoolean(GITFLOW_FEATURE_KEEP_REMOTE, false) != gitflowOptionsForm.isFeatureKeepRemote() ||
return PropertiesComponent.getInstance(project).getBoolean(GITFLOW_FEATURE_FETCH_ORIGIN, false) != gitflowOptionsForm.isFeatureFetchOrigin() ||
PropertiesComponent.getInstance(project).getBoolean(GITFLOW_FEATURE_KEEP_REMOTE, false) != gitflowOptionsForm.isFeatureKeepRemote() ||

PropertiesComponent.getInstance(project).getBoolean(GITFLOW_RELEASE_FETCH_ORIGIN, false) != gitflowOptionsForm.isReleaseFetchOrigin() ||
PropertiesComponent.getInstance(project).getBoolean(GITFLOW_PUSH_ON_FINISH_RELEASE, false) != gitflowOptionsForm.isPushOnFinishRelease() ||
PropertiesComponent.getInstance(project).getBoolean(GITFLOW_DONT_TAG_RELEASE, false) != gitflowOptionsForm.isDontTagRelease() ||
PropertiesComponent.getInstance(project).getBoolean(GITFLOW_USE_CUSTOM_TAG_COMMIT_MESSAGE, false) != gitflowOptionsForm.isUseCustomTagCommitMessage() ||
PropertiesComponent.getInstance(project).getValue(GITFLOW_CUSTOM_TAG_COMMIT_MESSAGE, DEFAULT_TAG_COMMIT_MESSAGE).equals(gitflowOptionsForm.getCustomTagCommitMessage())==false ||

PropertiesComponent.getInstance(project).getBoolean(GITFLOW_HOTFIX_FETCH_ORIGIN, false) != gitflowOptionsForm.isHotfixFetchOrigin() ||
PropertiesComponent.getInstance(project).getBoolean(GITFLOW_PUSH_ON_FINISH_HOTFIX, false) != gitflowOptionsForm.isPushOnFinishHotfix() ||
PropertiesComponent.getInstance(project).getBoolean(GITFLOW_DONT_TAG_HOTFIX, false) != gitflowOptionsForm.isDontTagHotfix() ||
PropertiesComponent.getInstance(project).getBoolean(GITFLOW_USE_CUSTOM_HOTFIX_TAG_COMMIT_MESSAGE, false) != gitflowOptionsForm.isUseCustomHotfixComitMessage() ||
Expand All @@ -133,13 +153,16 @@ public boolean isModified() {

@Override
public void apply() throws ConfigurationException {
PropertiesComponent.getInstance(project).setValue(GITFLOW_FEATURE_FETCH_ORIGIN, Boolean.toString(gitflowOptionsForm.isFeatureFetchOrigin()));
PropertiesComponent.getInstance(project).setValue(GITFLOW_FEATURE_KEEP_REMOTE, Boolean.toString(gitflowOptionsForm.isFeatureKeepRemote()));

PropertiesComponent.getInstance(project).setValue(GITFLOW_RELEASE_FETCH_ORIGIN, Boolean.toString(gitflowOptionsForm.isReleaseFetchOrigin()));
PropertiesComponent.getInstance(project).setValue(GITFLOW_PUSH_ON_FINISH_RELEASE, Boolean.toString(gitflowOptionsForm.isPushOnFinishRelease()));
PropertiesComponent.getInstance(project).setValue(GITFLOW_DONT_TAG_RELEASE, Boolean.toString(gitflowOptionsForm.isDontTagRelease()));
PropertiesComponent.getInstance(project).setValue(GITFLOW_USE_CUSTOM_TAG_COMMIT_MESSAGE, Boolean.toString(gitflowOptionsForm.isUseCustomTagCommitMessage()));
PropertiesComponent.getInstance(project).setValue(GITFLOW_CUSTOM_TAG_COMMIT_MESSAGE, gitflowOptionsForm.getCustomTagCommitMessage());

PropertiesComponent.getInstance(project).setValue(GITFLOW_HOTFIX_FETCH_ORIGIN, Boolean.toString(gitflowOptionsForm.isHotfixFetchOrigin()));
PropertiesComponent.getInstance(project).setValue(GITFLOW_PUSH_ON_FINISH_HOTFIX, Boolean.toString(gitflowOptionsForm.isPushOnFinishHotfix()));
PropertiesComponent.getInstance(project).setValue(GITFLOW_DONT_TAG_HOTFIX, Boolean.toString(gitflowOptionsForm.isDontTagHotfix()));
PropertiesComponent.getInstance(project).setValue(GITFLOW_USE_CUSTOM_HOTFIX_TAG_COMMIT_MESSAGE, Boolean.toString(gitflowOptionsForm.isUseCustomHotfixComitMessage()));
Expand All @@ -148,13 +171,16 @@ public void apply() throws ConfigurationException {

@Override
public void reset() {
gitflowOptionsForm.setFeatureFetchOrigin(PropertiesComponent.getInstance(project).getBoolean(GITFLOW_FEATURE_FETCH_ORIGIN, false));
gitflowOptionsForm.setFeatureKeepRemote(PropertiesComponent.getInstance(project).getBoolean(GITFLOW_FEATURE_KEEP_REMOTE, false));

gitflowOptionsForm.setReleaseFetchOrigin(PropertiesComponent.getInstance(project).getBoolean(GITFLOW_RELEASE_FETCH_ORIGIN, false));
gitflowOptionsForm.setPushOnFinishRelease(PropertiesComponent.getInstance(project).getBoolean(GITFLOW_PUSH_ON_FINISH_RELEASE, false));
gitflowOptionsForm.setDontTagRelease(PropertiesComponent.getInstance(project).getBoolean(GITFLOW_DONT_TAG_RELEASE, false));
gitflowOptionsForm.setUseCustomTagCommitMessage(PropertiesComponent.getInstance(project).getBoolean(GITFLOW_USE_CUSTOM_TAG_COMMIT_MESSAGE, false));
gitflowOptionsForm.setCustomTagCommitMessage(PropertiesComponent.getInstance(project).getValue(GITFLOW_CUSTOM_TAG_COMMIT_MESSAGE,DEFAULT_TAG_COMMIT_MESSAGE));

gitflowOptionsForm.setHotfixFetchOrigin(PropertiesComponent.getInstance(project).getBoolean(GITFLOW_HOTFIX_FETCH_ORIGIN, false));
gitflowOptionsForm.setPushOnFinishHotfix(PropertiesComponent.getInstance(project).getBoolean(GITFLOW_PUSH_ON_FINISH_HOTFIX, false));
gitflowOptionsForm.setDontTagHotfix(PropertiesComponent.getInstance(project).getBoolean(GITFLOW_DONT_TAG_HOTFIX, false));
gitflowOptionsForm.setUseCustomHotfixCommitMessage(PropertiesComponent.getInstance(project).getBoolean(GITFLOW_USE_CUSTOM_HOTFIX_TAG_COMMIT_MESSAGE, false));
Expand Down
21 changes: 21 additions & 0 deletions src/gitflow/GitflowImpl.java
Original file line number Diff line number Diff line change
Expand Up @@ -115,6 +115,9 @@ public GitCommandResult startFeature(@NotNull GitRepository repository,

h.addParameters("feature");
h.addParameters("start");
if (GitflowConfigurable.featureFetchOrigin(repository.getProject())) {
h.addParameters("-F");
}
h.addParameters(featureName);

for (GitLineHandlerListener listener : listeners) {
Expand All @@ -138,6 +141,10 @@ public GitCommandResult finishFeature(@NotNull GitRepository repository,
h.addParameters("--keepremote");
}

if (GitflowConfigurable.featureFetchOrigin(repository.getProject())) {
h.addParameters("-F");
}

h.addParameters(featureName);

for (GitLineHandlerListener listener : listeners) {
Expand Down Expand Up @@ -213,6 +220,11 @@ public GitCommandResult startRelease(@NotNull GitRepository repository,

h.addParameters("release");
h.addParameters("start");

if (GitflowConfigurable.releaseFetchOrigin(repository.getProject())) {
h.addParameters("-F");
}

h.addParameters(releaseName);

for (GitLineHandlerListener listener : listeners) {
Expand All @@ -231,6 +243,9 @@ public GitCommandResult finishRelease(@NotNull GitRepository repository,

h.addParameters("release");
h.addParameters("finish");
if (GitflowConfigurable.releaseFetchOrigin(repository.getProject())) {
h.addParameters("-F");
}
if(GitflowConfigurable.pushOnReleaseFinish(repository.getProject())) {
h.addParameters("-p");
}
Expand Down Expand Up @@ -298,6 +313,9 @@ public GitCommandResult startHotfix(@NotNull GitRepository repository,

h.addParameters("hotfix");
h.addParameters("start");
if (GitflowConfigurable.hotfixFetchOrigin(repository.getProject())) {
h.addParameters("-F");
}
h.addParameters(hotfixName);

for (GitLineHandlerListener listener : listeners) {
Expand All @@ -316,6 +334,9 @@ public GitCommandResult finishHotfix(@NotNull GitRepository repository,

h.addParameters("hotfix");
h.addParameters("finish");
if (GitflowConfigurable.hotfixFetchOrigin(repository.getProject())) {
h.addParameters("-F");
}
if (GitflowConfigurable.pushOnHotfixFinish(repository.getProject())) {
h.addParameters("-p");
}
Expand Down
2 changes: 2 additions & 0 deletions src/gitflow/actions/FinishFeatureAction.java
Original file line number Diff line number Diff line change
Expand Up @@ -60,6 +60,8 @@ else if(errorLineHandler.hasMergeError){
NotifyUtil.notifyError(myProject, "Error", "Please have a look at the Version Control console for more details");
}

repo.update();

}

@Override
Expand Down
2 changes: 1 addition & 1 deletion src/gitflow/actions/FinishReleaseAction.java
Original file line number Diff line number Diff line change
Expand Up @@ -87,7 +87,7 @@ else if(errorLineHandler.hasMergeError){
NotifyUtil.notifyError(myProject, "Error", "Please have a look at the Version Control console for more details");
}


repo.update();

}

Expand Down
Loading

0 comments on commit 2549def

Please sign in to comment.