Skip to content

Commit

Permalink
Merge branch 'release/0.7.0'
Browse files Browse the repository at this point in the history
  • Loading branch information
OpherV committed Sep 5, 2019
2 parents f0ff2af + d2ca039 commit 1a3b137
Show file tree
Hide file tree
Showing 34 changed files with 395 additions and 247 deletions.
130 changes: 65 additions & 65 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,65 +1,65 @@
# Git Flow Integration for Intellij


An intelliJ plugin providing a UI layer for git-flow, which in itself is a collection of Git extensions to provide high-level repository operations for Vincent [Driessen's branching model](http://nvie.com/git-model).

![screenshot](http://opherv.github.io/gitflow4idea/images/gitflow.jpg)

## Supporting my work (so that the plugin doesn't die)

Do you use this free software at work? Great! Would you like it to stay free? Of course you do.

I'm not a Java developer. In fact, I don't even like Java. Still I've been actively supporting this plugin for the past 5+ years on my own free time.

If saved you or your company time and effort, please consider supporting me by buying me a cup of coffee.
Better yet, get your boss to donate 10 cups. It's company money, they won't mind.

[![ko-fi](https://www.ko-fi.com/img/githubbutton_sm.svg)](https://ko-fi.com/R6R0TFS7)

## Getting started

For the best introduction to get started with `git flow`, please read Jeff Kreeftmeijer's blog post:

[http://jeffkreeftmeijer.com/2010/why-arent-you-using-git-flow/](http://jeffkreeftmeijer.com/2010/why-arent-you-using-git-flow/)

Or have a look at this [cheat sheet](http://danielkummer.github.io/git-flow-cheatsheet/) by Daniel Kummer:

## Who and why

This plugin was created by [Opher Vishnia](http://www.opherv.com), after I couldn't find any similar implementation.
I saw this [suggestion page](http://youtrack.jetbrains.com/issue/IDEA-65491) on the JetBrains site has more than 220 likes and 80 comments, and decided to take up the gauntlet :)

Huge shoutout [to Kirill Likhodedov](https://github.com/klikh), who wrote much of the original git4idea plugin, without which this plugin could not exist

## Installation

The plugin is available via the IntelliJ plugin manager. Just search for "Git Flow Integration" to get the latest version!

(The plugin requires that you have gitflow installed. I *highly* recommend using the [AVH edition](https://github.com/petervanderdoes/gitflow), rather than [Vanilla Git Flow](https://github.com/nvie/gitflow) since the original isn't being maintained anymore)

**Mac/Linux users:**

If you're running into issues like getting
`Gitflow is not installed`
or
`git: 'flow' is not a git command. See 'git --help'.`

Please be sure to check out [this thread](https://github.com/OpherV/gitflow4idea/issues/7)


## Caveats

While the plugin is operational and contains all basic functions (init/feature/release/hotfix), it may contains bugs. With your help I'll be able to find and zap them all.

## Helping out

This project is under active development.
If you encounter any bug or an issue, I encourage you to add the them to the [Issues list](https://github.com/OpherV/gitflow4idea/issues) on Github.
Feedback and suggestions are also very welcome.

## License

This plugin is under the [Apache 2.0 license](http://www.apache.org/licenses/LICENSE-2.0.html).
Copyright 2013-2018, Opher Vishnia.


# Git Flow Integration for Intellij


An intelliJ plugin providing a UI layer for git-flow, which in itself is a collection of Git extensions to provide high-level repository operations for Vincent [Driessen's branching model](http://nvie.com/git-model).

![screenshot](http://opherv.github.io/gitflow4idea/images/gitflow.jpg)

## Supporting my work (so that the plugin doesn't die)

Do you use this free software at work? Great! Would you like it to stay free? Of course you do.

I'm not a Java developer. In fact, I don't even like Java. Still I've been actively supporting this plugin for the past 5+ years on my own free time.

If saved you or your company time and effort, please consider supporting me by buying me a cup of coffee.
Better yet, get your boss to donate 10 cups. It's company money, they won't mind.

[![ko-fi](https://www.ko-fi.com/img/githubbutton_sm.svg)](https://ko-fi.com/R6R0TFS7)

## Getting started

For the best introduction to get started with `git flow`, please read Jeff Kreeftmeijer's blog post:

[http://jeffkreeftmeijer.com/2010/why-arent-you-using-git-flow/](http://jeffkreeftmeijer.com/2010/why-arent-you-using-git-flow/)

Or have a look at this [cheat sheet](http://danielkummer.github.io/git-flow-cheatsheet/) by Daniel Kummer:

## Who and why

This plugin was created by [Opher Vishnia](http://www.opherv.com), after I couldn't find any similar implementation.
I saw this [suggestion page](http://youtrack.jetbrains.com/issue/IDEA-65491) on the JetBrains site has more than 220 likes and 80 comments, and decided to take up the gauntlet :)

Huge shoutout [to Kirill Likhodedov](https://github.com/klikh), who wrote much of the original git4idea plugin, without which this plugin could not exist

## Installation

The plugin is available via the IntelliJ plugin manager. Just search for "Git Flow Integration" to get the latest version!

(The plugin requires that you have gitflow installed. I *highly* recommend using the [AVH edition](https://github.com/petervanderdoes/gitflow), rather than [Vanilla Git Flow](https://github.com/nvie/gitflow) since the original isn't being maintained anymore)

**Mac/Linux users:**

If you're running into issues like getting
`Gitflow is not installed`
or
`git: 'flow' is not a git command. See 'git --help'.`

Please be sure to check out [this thread](https://github.com/OpherV/gitflow4idea/issues/7)


## Caveats

While the plugin is operational and contains all basic functions (init/feature/release/hotfix), it may contains bugs. With your help I'll be able to find and zap them all.

## Helping out

This project is under active development.
If you encounter any bug or an issue, I encourage you to add the them to the [Issues list](https://github.com/OpherV/gitflow4idea/issues) on Github.
Feedback and suggestions are also very welcome.

## License

This plugin is under the [Apache 2.0 license](http://www.apache.org/licenses/LICENSE-2.0.html).
Copyright 2013-2019, Opher Vishnia.


13 changes: 11 additions & 2 deletions build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ compileJava {
}

group 'gitflow4idea'
version '0.6.9'
version '0.7.0'

sourceCompatibility = JavaVersion.VERSION_1_8
targetCompatibility = JavaVersion.VERSION_1_8
Expand All @@ -29,11 +29,20 @@ intellij {
patchPluginXml {
pluginId "Gitflow"
pluginDescription 'Git Flow Integration'
version '0.6.9'
version '0.7.0'
sinceBuild '182.0'
untilBuild '192.*'
changeNotes """
<H2>Changelog for 0.7.0</H2>
<ul>
<li>Fix NPE when clicking Gitflow menu #245 (@opherv)</li>
<li>Fix "Init gitflow" doesn't update widget #247 (@opherv)</li>
<li>Fix Wrong message when finishing a feature #144 (@opherv)</li>
<li>Feature: Re-init gitflow (access from VCS>Git>Gitflow>Advanced menu) #50 (@bmwsedee/@opherv)</li>
<li>"Feature": Don't show branch select combo on new Hotfix (@opherv)</li>
</ul>
<H2>Changelog for 0.6.9</H2>
<ul>
<li>Support for Idea build 192 #241 (@opherv)</li>
Expand Down
9 changes: 7 additions & 2 deletions src/main/java/gitflow/Gitflow.java
Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,13 @@
*/
public interface Gitflow extends Git {

public GitCommandResult initRepo(@NotNull GitRepository repository,
GitflowInitOptions initOptions, @Nullable GitLineHandlerListener... listeners);
GitCommandResult initRepo(@NotNull GitRepository repository,
GitflowInitOptions initOptions,
@Nullable GitLineHandlerListener... listeners);

GitCommandResult reInitRepo(@NotNull GitRepository repository,
GitflowInitOptions initOptions,
@Nullable GitLineHandlerListener... listeners);


// feature
Expand Down
41 changes: 23 additions & 18 deletions src/main/java/gitflow/GitflowBranchUtil.java
Original file line number Diff line number Diff line change
Expand Up @@ -41,33 +41,38 @@ public GitflowBranchUtil(Project project, GitRepository repo){
myRepo = repo;

if (repo != null) {
currentBranchName = GitBranchUtil.getBranchNameOrRev(repo);

GitflowConfigUtil gitflowConfigUtil = GitflowConfigUtil.getInstance(project, repo);
branchnameMaster = gitflowConfigUtil.masterBranch;
branchnameDevelop = gitflowConfigUtil.developBranch;
prefixFeature = gitflowConfigUtil.featurePrefix;
prefixRelease = gitflowConfigUtil.releasePrefix;
prefixHotfix = gitflowConfigUtil.hotfixPrefix;
prefixBugfix = gitflowConfigUtil.bugfixPrefix;

initRemoteBranches();
initLocalBranchNames();
update();
}
}

public void update(){
currentBranchName = GitBranchUtil.getBranchNameOrRev(myRepo);

GitflowConfigUtil gitflowConfigUtil = GitflowConfigUtil.getInstance(myProject, myRepo);
gitflowConfigUtil.update();
branchnameMaster = gitflowConfigUtil.masterBranch;
branchnameDevelop = gitflowConfigUtil.developBranch;
prefixFeature = gitflowConfigUtil.featurePrefix;
prefixRelease = gitflowConfigUtil.releasePrefix;
prefixHotfix = gitflowConfigUtil.hotfixPrefix;
prefixBugfix = gitflowConfigUtil.bugfixPrefix;

initRemoteBranches();
initLocalBranchNames();
}

public String getCurrentBranchName() {
return currentBranchName;
}

public boolean hasGitflow(){
boolean hasGitflow = myRepo != null
&& branchnameMaster != null
&& branchnameDevelop != null
&& prefixFeature != null
&& prefixRelease != null
&& prefixHotfix != null
&& prefixBugfix != null;
&& getBranchnameMaster() != null
&& getBranchnameDevelop() != null
&& getPrefixFeature() != null
&& getPrefixRelease() != null
&& getPrefixHotfix() != null
&& getPrefixBugfix() != null;

return hasGitflow;
}
Expand Down
37 changes: 17 additions & 20 deletions src/main/java/gitflow/GitflowBranchUtilManager.java
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,11 @@ public class GitflowBranchUtilManager {
private static HashMap<GitRepository, GitflowBranchUtil> repoBranchUtilMap;

static public GitflowBranchUtil getBranchUtil(GitRepository repo){
return repoBranchUtilMap.get(repo);
if (repoBranchUtilMap != null) {
return repoBranchUtilMap.get(repo);
} else {
return null;
}
}

static public void setupBranchUtil(Project project, GitRepository repo){
Expand All @@ -38,24 +42,17 @@ static public void setupBranchUtil(Project project, GitRepository repo){
* Repopulates the branchUtils for each repo
* @param project
*/
static public Future<Void> update(Project proj){
final Project project = proj;
return (Future<Void>) ApplicationManager.getApplication().executeOnPooledThread(new Runnable() {
@Override
public void run() {
if (repoBranchUtilMap == null){
repoBranchUtilMap = new HashMap<GitRepository, gitflow.GitflowBranchUtil>();
}

List<GitRepository> gitRepositories = GitUtil.getRepositoryManager(project).getRepositories();

Iterator gitRepositoriesIterator = gitRepositories.iterator();
while(gitRepositoriesIterator.hasNext()){
GitRepository repo = (GitRepository) gitRepositoriesIterator.next();
GitflowBranchUtilManager.setupBranchUtil(project, repo);
}
}
});

static public void update(Project proj){
if (repoBranchUtilMap == null){
repoBranchUtilMap = new HashMap<GitRepository, gitflow.GitflowBranchUtil>();
}

List<GitRepository> gitRepositories = GitUtil.getRepositoryManager(proj).getRepositories();

Iterator gitRepositoriesIterator = gitRepositories.iterator();
while(gitRepositoriesIterator.hasNext()){
GitRepository repo = (GitRepository) gitRepositoriesIterator.next();
GitflowBranchUtilManager.setupBranchUtil(proj, repo);
}
}
}
40 changes: 29 additions & 11 deletions src/main/java/gitflow/GitflowConfigUtil.java
Original file line number Diff line number Diff line change
@@ -1,5 +1,8 @@
package gitflow;

import java.util.concurrent.ExecutionException;
import java.util.concurrent.Future;
import com.intellij.openapi.application.ApplicationManager;
import com.intellij.openapi.project.Project;
import com.intellij.openapi.vcs.VcsException;
import com.intellij.openapi.vfs.VirtualFile;
Expand Down Expand Up @@ -60,20 +63,35 @@ public static GitflowConfigUtil getInstance(Project project_, GitRepository repo
project = project_;
repo = repo_;

update();
}

public void update(){
VirtualFile root = repo.getRoot();

try{
masterBranch = GitConfigUtil.getValue(project, root, BRANCH_MASTER);
developBranch = GitConfigUtil.getValue(project, root, BRANCH_DEVELOP);
featurePrefix = GitConfigUtil.getValue(project,root,PREFIX_FEATURE);
releasePrefix = GitConfigUtil.getValue(project,root,PREFIX_RELEASE);
hotfixPrefix = GitConfigUtil.getValue(project,root,PREFIX_HOTFIX);
bugfixPrefix = GitConfigUtil.getValue(project,root,PREFIX_BUGFIX);
supportPrefix = GitConfigUtil.getValue(project,root,PREFIX_SUPPORT);
versiontagPrefix = GitConfigUtil.getValue(project,root,PREFIX_VERSIONTAG);

} catch (VcsException e) {
NotifyUtil.notifyError(project, "Config error", e);
Future<Void> f = (Future<Void>) ApplicationManager.getApplication().executeOnPooledThread(new Runnable() {
@Override
public void run() {
try{
masterBranch = GitConfigUtil.getValue(project, root, BRANCH_MASTER);
developBranch = GitConfigUtil.getValue(project, root, BRANCH_DEVELOP);
featurePrefix = GitConfigUtil.getValue(project,root,PREFIX_FEATURE);
releasePrefix = GitConfigUtil.getValue(project,root,PREFIX_RELEASE);
hotfixPrefix = GitConfigUtil.getValue(project,root,PREFIX_HOTFIX);
bugfixPrefix = GitConfigUtil.getValue(project,root,PREFIX_BUGFIX);
supportPrefix = GitConfigUtil.getValue(project,root,PREFIX_SUPPORT);
versiontagPrefix = GitConfigUtil.getValue(project,root,PREFIX_VERSIONTAG);
} catch (VcsException e) {
NotifyUtil.notifyError(project, "Config error", e);
}
}});
f.get();

} catch (InterruptedException e) {
e.printStackTrace();
} catch (ExecutionException e) {
e.printStackTrace();
}
}

Expand Down
Loading

0 comments on commit 1a3b137

Please sign in to comment.