From a89cac0c627196d72b5bf9de7026bb6092db6bc5 Mon Sep 17 00:00:00 2001 From: Opher Vishnia Date: Thu, 23 Oct 2014 19:24:28 +0300 Subject: [PATCH 1/4] fix for "Phpstorm hangs while changing active tab" #33 --- src/gitflow/ui/GitflowWidget.java | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/gitflow/ui/GitflowWidget.java b/src/gitflow/ui/GitflowWidget.java index ff4555d..29b101e 100644 --- a/src/gitflow/ui/GitflowWidget.java +++ b/src/gitflow/ui/GitflowWidget.java @@ -74,17 +74,17 @@ public WidgetPresentation getPresentation(@NotNull PlatformType type) { @Override public void selectionChanged(FileEditorManagerEvent event) { - update(); + //update(); } @Override public void fileOpened(FileEditorManager source, VirtualFile file) { - update(); + //update(); } @Override public void fileClosed(FileEditorManager source, VirtualFile file) { - update(); + //update(); } @Override From 30331b42fdcc2c2f906f95558ae829d821f894e7 Mon Sep 17 00:00:00 2001 From: OpherV Date: Mon, 3 Nov 2014 18:39:21 +0200 Subject: [PATCH 2/4] Major refactor to git flow init. Users are now able to enter custom names for production\dev branches #54 --- src/gitflow/GitInitLineHandler.java | 100 +++++++++++++++++++ src/gitflow/GitflowImpl.java | 50 +++++----- src/gitflow/ui/GitflowInitOptionsDialog.form | 4 +- 3 files changed, 129 insertions(+), 25 deletions(-) create mode 100644 src/gitflow/GitInitLineHandler.java diff --git a/src/gitflow/GitInitLineHandler.java b/src/gitflow/GitInitLineHandler.java new file mode 100644 index 0000000..5ae5dc5 --- /dev/null +++ b/src/gitflow/GitInitLineHandler.java @@ -0,0 +1,100 @@ +package gitflow; + +import com.intellij.execution.ExecutionException; +import com.intellij.openapi.project.Project; +import com.intellij.openapi.util.Key; +import com.intellij.openapi.vfs.VirtualFile; +import git4idea.commands.GitCommand; +import git4idea.commands.GitLineHandler; +import org.jetbrains.annotations.NotNull; +import org.jetbrains.annotations.Nullable; + +import java.io.BufferedWriter; +import java.io.IOException; +import java.io.OutputStreamWriter; +import java.io.PrintWriter; + + +public class GitInitLineHandler extends GitLineHandler { + private BufferedWriter writer; + GitflowInitOptions _initOptions; + + public GitInitLineHandler(GitflowInitOptions initOptions,@NotNull Project project, @NotNull VirtualFile vcsRoot, @NotNull GitCommand command) { + super(project, vcsRoot, command); + _initOptions=initOptions; + } + + @Nullable + @Override + protected Process startProcess() throws ExecutionException { + Process p = super.startProcess(); + writer = new BufferedWriter(new OutputStreamWriter(p.getOutputStream())); + return p; + } + + protected void processTerminated(final int exitCode) { + super.processTerminated(exitCode); + } + + + @Override + protected void onTextAvailable(String s, Key key) { + super.onTextAvailable(s,key); + try { + if (s.contains("Branch name for production releases")){ + writer.write(_initOptions.getProductionBranch()); + myVcs.showCommandLine(_initOptions.getProductionBranch()); + writer.newLine(); + writer.flush(); + } + + if (s.contains("Branch name for \"next release\"") || + s.contains("Which branch should be used for integration of the")){ + + writer.write(_initOptions.getDevelopmentBranch()); + myVcs.showCommandLine(_initOptions.getDevelopmentBranch()); + writer.newLine(); + writer.flush(); + } + if (s.contains("Feature branches")){ + writer.write(_initOptions.getFeaturePrefix()); + myVcs.showCommandLine(_initOptions.getFeaturePrefix()); + writer.newLine(); + writer.flush(); + } + if (s.contains("Release branches")){ + writer.write(_initOptions.getReleasePrefix()); + myVcs.showCommandLine(_initOptions.getReleasePrefix()); + writer.newLine(); + writer.flush(); + } + if (s.contains("Hotfix branches")){ + writer.write(_initOptions.getHotfixPrefix()); + myVcs.showCommandLine(_initOptions.getHotfixPrefix()); + writer.newLine(); + writer.flush(); + } + if (s.contains("Support branches")){ + writer.write(_initOptions.getSupportPrefix()); + myVcs.showCommandLine(_initOptions.getSupportPrefix()); + writer.newLine(); + writer.flush(); + } + if (s.contains("Version tag")){ + writer.write(_initOptions.getVersionPrefix()); + myVcs.showCommandLine(_initOptions.getVersionPrefix()); + writer.newLine(); + writer.flush(); + } + if (s.contains("Hooks and filters")){ + writer.newLine(); + writer.flush(); + } + + + } catch (IOException e) { + e.printStackTrace(); + } + } + +} diff --git a/src/gitflow/GitflowImpl.java b/src/gitflow/GitflowImpl.java index f65c98a..a8ed4e3 100644 --- a/src/gitflow/GitflowImpl.java +++ b/src/gitflow/GitflowImpl.java @@ -7,6 +7,7 @@ import org.jetbrains.annotations.NotNull; import org.jetbrains.annotations.Nullable; +import java.io.IOException; import java.lang.reflect.InvocationTargetException; import java.lang.reflect.Method; import java.util.ArrayList; @@ -70,40 +71,41 @@ private static GitCommandResult run(@org.jetbrains.annotations.NotNull git4idea. public GitCommandResult initRepo(@NotNull GitRepository repository, GitflowInitOptions initOptions, @Nullable GitLineHandlerListener... listeners) { - if(!initOptions.isUseDefaults()) { - configureBranches(initOptions, repository.getProject()); - } - final GitLineHandler h = new GitLineHandler(repository.getProject(), repository.getRoot(), GitflowCommand()); - h.setSilent(false); + GitCommandResult result; - h.addParameters("init"); - h.addParameters("-d"); + if(initOptions.isUseDefaults()) { + final GitLineHandler h = new GitLineHandler(repository.getProject(), repository.getRoot(), GitflowCommand()); + h.setSilent(false); + h.setStdoutSuppressed(false); + h.setStderrSuppressed(false); - for (GitLineHandlerListener listener : listeners) { - h.addLineListener(listener); + h.addParameters("init"); + h.addParameters("-d"); + + result = run(h); } - GitCommandResult result = run(h); + else{ + - if(result.success() && !initOptions.isUseDefaults()) { - configurePrefixes(initOptions, repository.getProject()); + final GitInitLineHandler h = new GitInitLineHandler(initOptions,repository.getProject(), repository.getRoot(), GitflowCommand()); + + h.setSilent(false); + h.setStdoutSuppressed(false); + h.setStderrSuppressed(false); + + h.addParameters("init"); + + for (GitLineHandlerListener listener : listeners) { + h.addLineListener(listener); + } + result = run(h); } - return result; - } - private void configureBranches(GitflowInitOptions initOptions, Project project) { - GitflowConfigUtil.setMasterBranch(project, initOptions.getProductionBranch()); - GitflowConfigUtil.setDevelopBranch(project, initOptions.getDevelopmentBranch()); + return result; } - private void configurePrefixes(GitflowInitOptions initOptions, Project project) { - GitflowConfigUtil.setFeaturePrefix(project, initOptions.getFeaturePrefix()); - GitflowConfigUtil.setReleasePrefix(project, initOptions.getReleasePrefix()); - GitflowConfigUtil.setHotfixPrefix(project, initOptions.getHotfixPrefix()); - GitflowConfigUtil.setSupportPrefix(project, initOptions.getSupportPrefix()); - GitflowConfigUtil.setVersionPrefix(project, initOptions.getVersionPrefix()); - } //feature diff --git a/src/gitflow/ui/GitflowInitOptionsDialog.form b/src/gitflow/ui/GitflowInitOptionsDialog.form index dfcbbed..5d1e61b 100644 --- a/src/gitflow/ui/GitflowInitOptionsDialog.form +++ b/src/gitflow/ui/GitflowInitOptionsDialog.form @@ -3,7 +3,7 @@ - + @@ -23,6 +23,7 @@ + @@ -54,6 +55,7 @@ + From d7eb592a4775b6c8d943c827497600695579a464 Mon Sep 17 00:00:00 2001 From: OpherV Date: Sun, 1 Mar 2015 11:57:57 +0200 Subject: [PATCH 3/4] support build #140 --- 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 9e05ee5..21c74b5 100644 --- a/META-INF/plugin.xml +++ b/META-INF/plugin.xml @@ -9,7 +9,7 @@ com.intellij.modules.vcs Git4Idea - + From 41005304b5de839337dc8d9b5165a68df5ccc499 Mon Sep 17 00:00:00 2001 From: OpherV Date: Sun, 1 Mar 2015 11:59:19 +0200 Subject: [PATCH 4/4] change version to 0.4.1 --- 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 21c74b5..35490df 100644 --- a/META-INF/plugin.xml +++ b/META-INF/plugin.xml @@ -2,7 +2,7 @@ Git Flow Integration Gitflow Git Flow Integration - 0.4 + 0.4.1 VCS Integration Opher Vishnia