sourcegit/src/Models/GitFlow.cs

41 lines
1 KiB
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)
{
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;
2021-04-29 05:05:55 -07:00
return GitFlowBranchType.None;
}
}
}