-
Notifications
You must be signed in to change notification settings - Fork 138
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
26 changed files
with
359 additions
and
232 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -102,3 +102,5 @@ fabric.properties | |
|
||
# GitEye project file | ||
/.project | ||
|
||
.idea |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,6 @@ | ||
#Tue Apr 06 01:50:18 CEST 2019 | ||
distributionBase=GRADLE_USER_HOME | ||
distributionPath=wrapper/dists | ||
distributionUrl=https\://services.gradle.org/distributions/gradle-4.8-bin.zip | ||
zipStoreBase=GRADLE_USER_HOME | ||
zipStorePath=wrapper/dists | ||
distributionUrl=https\://services.gradle.org/distributions/gradle-5.3.1-all.zip |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,60 @@ | ||
package gitflow.actions; | ||
|
||
import com.intellij.openapi.actionSystem.AnActionEvent; | ||
import git4idea.repo.GitRepository; | ||
import org.jetbrains.annotations.NotNull; | ||
|
||
public abstract class AbstractBranchAction extends GitflowAction { | ||
enum BranchType { | ||
Feature, Release, Bugfix, Hotfix | ||
} | ||
|
||
BranchType type; | ||
|
||
AbstractBranchAction(String actionName, BranchType type) { | ||
super(actionName); | ||
this.type = type; | ||
} | ||
|
||
AbstractBranchAction(GitRepository repo, String actionName, BranchType type) { | ||
super(repo, actionName); | ||
this.type = type; | ||
} | ||
|
||
|
||
@Override | ||
public void update(@NotNull AnActionEvent e) { | ||
if (branchUtil == null) { | ||
e.getPresentation().setEnabledAndVisible(false); | ||
return; | ||
} | ||
|
||
//Disable and hide when gitflow has not been setup | ||
if (branchUtil.hasGitflow() == false) { | ||
e.getPresentation().setEnabledAndVisible(false); | ||
return; | ||
} | ||
|
||
//Disable and hide when the branch-type is incorrect | ||
if (isActionAllowedForBranch() == false) { | ||
e.getPresentation().setEnabledAndVisible(false); | ||
} else { | ||
e.getPresentation().setEnabledAndVisible(true); | ||
} | ||
} | ||
|
||
protected boolean isActionAllowedForBranch() { | ||
switch (type) { | ||
case Feature: | ||
return branchUtil.isCurrentBranchFeature(); | ||
case Release: | ||
return branchUtil.isCurrentBranchRelease(); | ||
case Bugfix: | ||
return branchUtil.isCurrentBranchBugfix(); | ||
case Hotfix: | ||
return branchUtil.isCurrentBranchHotfix(); | ||
default: | ||
return false; | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
package gitflow.actions; | ||
|
||
import git4idea.repo.GitRepository; | ||
|
||
public abstract class AbstractPublishAction extends AbstractBranchAction { | ||
AbstractPublishAction(String actionName, BranchType type) { | ||
super(actionName, type); | ||
} | ||
|
||
AbstractPublishAction(GitRepository repo, String actionName, BranchType type) { | ||
super(repo, actionName, type); | ||
} | ||
|
||
@Override | ||
protected boolean isActionAllowedForBranch() { | ||
if (!super.isActionAllowedForBranch()) { | ||
return false; | ||
} | ||
|
||
return !branchUtil.isCurrentBranchPublished(); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
package gitflow.actions; | ||
|
||
import com.intellij.openapi.actionSystem.AnActionEvent; | ||
import git4idea.repo.GitRepository; | ||
import gitflow.GitflowBranchUtil; | ||
import gitflow.GitflowBranchUtilManager; | ||
import org.jetbrains.annotations.NotNull; | ||
|
||
public abstract class AbstractStartAction extends GitflowAction { | ||
AbstractStartAction(String actionName) { | ||
super(actionName); | ||
} | ||
|
||
AbstractStartAction(GitRepository repo, String actionName) { | ||
super(repo, actionName); | ||
} | ||
|
||
|
||
@Override | ||
public void update(@NotNull AnActionEvent e) { | ||
GitflowBranchUtil branchUtil = GitflowBranchUtilManager.getBranchUtil(myRepo); | ||
|
||
//Disable and hide when gitflow has not been setup | ||
if (branchUtil.hasGitflow() == false) { | ||
e.getPresentation().setEnabledAndVisible(false); | ||
} else { | ||
e.getPresentation().setEnabledAndVisible(true); | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,36 @@ | ||
package gitflow.actions; | ||
|
||
import git4idea.repo.GitRepository; | ||
|
||
public abstract class AbstractTrackAction extends AbstractBranchAction { | ||
AbstractTrackAction(String actionName, BranchType type) { | ||
super(actionName, type); | ||
} | ||
|
||
AbstractTrackAction(GitRepository repo, String actionName, BranchType type) { | ||
super(repo, actionName, type); | ||
} | ||
|
||
@Override | ||
protected boolean isActionAllowedForBranch() { | ||
String prefix; | ||
switch (type) { | ||
case Feature: | ||
prefix = featurePrefix; | ||
break; | ||
case Release: | ||
prefix = releasePrefix; | ||
break; | ||
case Bugfix: | ||
prefix = bugfixPrefix; | ||
break; | ||
default: | ||
return false; | ||
} | ||
|
||
boolean noRemoteBranches = branchUtil.getRemoteBranchesWithPrefix(prefix).isEmpty(); | ||
boolean trackedAllBranches = branchUtil.areAllBranchesTracked(prefix); | ||
|
||
return noRemoteBranches == false && trackedAllBranches == false; | ||
} | ||
} |
Oops, something went wrong.