public static string CurrentBranchLeafName(this Flow gitflow) { var repo = gitflow.Repository; var fullBranchName = repo.Head.CanonicalName; ConfigurationEntry <string> prefix = null; if (gitflow.IsOnFeatureBranch()) { prefix = repo.Config.Get <string>(GitFlowSetting.Feature.GetAttribute <GitFlowConfigAttribute>().ConfigName); } if (gitflow.IsOnReleaseBranch()) { prefix = repo.Config.Get <string>(GitFlowSetting.Release.GetAttribute <GitFlowConfigAttribute>().ConfigName); } if (gitflow.IsOnHotfixBranch()) { prefix = repo.Config.Get <string>(GitFlowSetting.HotFix.GetAttribute <GitFlowConfigAttribute>().ConfigName); } return(prefix != null?fullBranchName.Replace(prefix.Value, "") : fullBranchName); }
public static string CurrentStatus(this Flow gitflow) { var leafName = gitflow.CurrentBranchLeafName(); string status = ""; if (gitflow.IsOnDevelopBranch()) { status = "Develop: " + leafName; } else if (gitflow.IsOnFeatureBranch()) { status = "Feature: " + leafName; } else if (gitflow.IsOnHotfixBranch()) { status = "Hotfix: " + leafName; } else if (gitflow.IsOnReleaseBranch()) { status = "Release: " + leafName; } return(status); }