mirror of
https://github.com/sourcegit-scm/sourcegit.git
synced 2024-11-01 13:13:21 -07:00
36 lines
1.1 KiB
C#
36 lines
1.1 KiB
C#
namespace SourceGit.Models {
|
|
/// <summary>
|
|
/// GitFlow的分支类型
|
|
/// </summary>
|
|
public enum GitFlowBranchType {
|
|
None,
|
|
Feature,
|
|
Release,
|
|
Hotfix,
|
|
}
|
|
|
|
/// <summary>
|
|
/// GitFlow相关设置
|
|
/// </summary>
|
|
public class GitFlow {
|
|
public string Feature { get; set; }
|
|
public string Release { get; set; }
|
|
public string Hotfix { get; set; }
|
|
|
|
public bool IsEnabled {
|
|
get {
|
|
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;
|
|
return GitFlowBranchType.None;
|
|
}
|
|
}
|
|
}
|