diff --git a/META-INF/plugin.xml b/META-INF/plugin.xml index decae61..9e05ee5 100644 --- a/META-INF/plugin.xml +++ b/META-INF/plugin.xml @@ -2,14 +2,14 @@ Git Flow Integration Gitflow Git Flow Integration - 0.3.9 + 0.4 VCS Integration Opher Vishnia com.intellij.modules.vcs Git4Idea - + diff --git a/src/gitflow/GitflowConfigurable.java b/src/gitflow/GitflowConfigurable.java index 7a81b6b..a4b6de8 100644 --- a/src/gitflow/GitflowConfigurable.java +++ b/src/gitflow/GitflowConfigurable.java @@ -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"; @@ -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); } @@ -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); } @@ -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() || @@ -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())); @@ -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)); diff --git a/src/gitflow/GitflowImpl.java b/src/gitflow/GitflowImpl.java index 58f8506..f65c98a 100644 --- a/src/gitflow/GitflowImpl.java +++ b/src/gitflow/GitflowImpl.java @@ -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) { @@ -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) { @@ -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) { @@ -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"); } @@ -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) { @@ -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"); } diff --git a/src/gitflow/actions/FinishFeatureAction.java b/src/gitflow/actions/FinishFeatureAction.java index 67fab28..534585c 100644 --- a/src/gitflow/actions/FinishFeatureAction.java +++ b/src/gitflow/actions/FinishFeatureAction.java @@ -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 diff --git a/src/gitflow/actions/FinishReleaseAction.java b/src/gitflow/actions/FinishReleaseAction.java index 980f793..2530e29 100644 --- a/src/gitflow/actions/FinishReleaseAction.java +++ b/src/gitflow/actions/FinishReleaseAction.java @@ -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(); } diff --git a/src/gitflow/ui/GitflowOptionsForm.form b/src/gitflow/ui/GitflowOptionsForm.form index 46aa43a..aa8bc24 100644 --- a/src/gitflow/ui/GitflowOptionsForm.form +++ b/src/gitflow/ui/GitflowOptionsForm.form @@ -13,7 +13,7 @@ - + @@ -23,7 +23,7 @@ - + @@ -32,7 +32,7 @@ - + @@ -40,7 +40,7 @@ - + @@ -48,7 +48,7 @@ - + @@ -59,9 +59,19 @@ + + + + + + + + + + - + @@ -71,7 +81,7 @@ - + @@ -84,7 +94,7 @@ - + @@ -92,7 +102,7 @@ - + @@ -100,16 +110,26 @@ - + + + + + + + + + + + - + @@ -119,7 +139,7 @@ - + @@ -128,14 +148,24 @@ - + - + + + + + + + + + + + diff --git a/src/gitflow/ui/GitflowOptionsForm.java b/src/gitflow/ui/GitflowOptionsForm.java index a4b2c6d..8925db0 100644 --- a/src/gitflow/ui/GitflowOptionsForm.java +++ b/src/gitflow/ui/GitflowOptionsForm.java @@ -10,13 +10,17 @@ */ public class GitflowOptionsForm implements ItemListener { private JPanel contentPane; + private JCheckBox releaseFetchOrigin; private JCheckBox featureKeepRemote; + private JCheckBox featureFetchOrigin; private JCheckBox pushOnFinishRelease; private JCheckBox dontTagRelease; private JCheckBox useCustomTagCommitMessage; private JTextField customTagCommitMessage; + + private JCheckBox hotfixFetchOrigin; private JCheckBox pushOnFinishHotfix; private JCheckBox dontTagHotfix; private JCheckBox useCustomHotfixCommitMessage; @@ -86,23 +90,24 @@ else if (source == dontTagHotfix) { } - // getters/setters + // feature getters/setters - public boolean isPushOnFinishRelease() - { - return pushOnFinishRelease.isSelected(); - } + public boolean isFeatureFetchOrigin() { return featureFetchOrigin.isSelected(); } + public void setFeatureFetchOrigin(boolean selected) { featureFetchOrigin.setSelected(selected); } - public void setPushOnFinishRelease(boolean selected) - { - pushOnFinishRelease.setSelected(selected); - } + public boolean isFeatureKeepRemote() { return featureKeepRemote.isSelected(); } + public void setFeatureKeepRemote(boolean selected) { featureKeepRemote.setSelected(selected); } - public boolean isDontTagRelease() { return dontTagRelease.isSelected(); } - public boolean isFeatureKeepRemote() { return featureKeepRemote.isSelected(); } + // release getters/setters - public void setFeatureKeepRemote(boolean selected) { featureKeepRemote.setSelected(selected); } + public boolean isReleaseFetchOrigin() { return releaseFetchOrigin.isSelected(); } + public void setReleaseFetchOrigin(boolean selected) { releaseFetchOrigin.setSelected(selected); } + + public boolean isPushOnFinishRelease() { return pushOnFinishRelease.isSelected(); } + public void setPushOnFinishRelease(boolean selected) { pushOnFinishRelease.setSelected(selected); } + + public boolean isDontTagRelease() { return dontTagRelease.isSelected(); } /* custom finish release tag commit message */ @@ -124,9 +129,13 @@ public void setCustomTagCommitMessage(String message) { } + // hotfix getters/setters - public boolean isPushOnFinishHotfix() { return pushOnFinishHotfix.isSelected(); } + public boolean isHotfixFetchOrigin() { return hotfixFetchOrigin.isSelected(); } + public void setHotfixFetchOrigin(boolean selected) { hotfixFetchOrigin.setSelected(selected); } + + public boolean isPushOnFinishHotfix() { return pushOnFinishHotfix.isSelected(); } public void setPushOnFinishHotfix(boolean selected) { pushOnFinishHotfix.setSelected(selected); } @@ -153,7 +162,6 @@ public void setUseCustomHotfixCommitMessage(boolean selected){ public String getCustomHotfixCommitMessage(){ return customHotfixCommitMessage.getText(); } - public void setCustomHotfixCommitMessage(String message){ customHotfixCommitMessage.setText(message); }