sourcegit/src/SourceGit/Models/GitFlow.cs

36 lines
978 B
C#
Raw Normal View History

namespace SourceGit.Models
{
public enum GitFlowBranchType
{
2021-04-29 05:05:55 -07:00
None,
Feature,
Release,
Hotfix,
}
public class GitFlow
{
2021-04-29 05:05:55 -07:00
public string Feature { get; set; }
public string Release { get; set; }
public string Hotfix { get; set; }
public bool IsEnabled
{
get
{
2021-04-29 05:05:55 -07:00
return !string.IsNullOrEmpty(Feature)
&& !string.IsNullOrEmpty(Release)
&& !string.IsNullOrEmpty(Hotfix);
}
}
public GitFlowBranchType GetBranchType(string name)
{
2021-04-29 05:05:55 -07:00
if (!IsEnabled) return GitFlowBranchType.None;
if (name.StartsWith(Feature)) return GitFlowBranchType.Feature;
if (name.StartsWith(Release)) return GitFlowBranchType.Release;
if (name.StartsWith(Hotfix)) return GitFlowBranchType.Hotfix;
return GitFlowBranchType.None;
}
}
}