1
1
namespace GitVersion
2
2
{
3
- using System ;
4
-
5
3
static partial class ExtensionMethods
6
4
{
7
5
public static string GetCanonicalBranchName ( this string branchName )
@@ -17,70 +15,9 @@ public static string GetCanonicalBranchName(this string branchName)
17
15
return string . Format ( "refs/heads/{0}" , branchName ) ;
18
16
}
19
17
20
- public static bool IsHotfix ( this string branchName )
21
- {
22
- return branchName . StartsWith ( "hotfix-" ) || branchName . StartsWith ( "hotfix/" ) ;
23
- }
24
-
25
- public static string GetHotfixSuffix ( this string branchName )
26
- {
27
- return branchName . TrimStart ( "hotfix-" ) . TrimStart ( "hotfix/" ) ;
28
- }
29
-
30
- public static bool IsRelease ( this string branchName )
31
- {
32
- return branchName . StartsWith ( "release-" ) || branchName . StartsWith ( "release/" ) ;
33
- }
34
-
35
- public static string GetReleaseSuffix ( this string branchName )
36
- {
37
- return branchName . TrimStart ( "release-" ) . TrimStart ( "release/" ) ;
38
- }
39
-
40
- public static string GetUnknownBranchSuffix ( this string branchName )
41
- {
42
- var unknownBranchSuffix = branchName . Split ( '-' , '/' ) ;
43
- if ( unknownBranchSuffix . Length == 1 )
44
- return branchName ;
45
- return unknownBranchSuffix [ 1 ] ;
46
- }
47
-
48
- public static string GetSuffix ( this string branchName , BranchType branchType )
49
- {
50
- switch ( branchType )
51
- {
52
- case BranchType . Hotfix :
53
- return branchName . GetHotfixSuffix ( ) ;
54
-
55
- case BranchType . Release :
56
- return branchName . GetReleaseSuffix ( ) ;
57
-
58
- case BranchType . Unknown :
59
- return branchName . GetUnknownBranchSuffix ( ) ;
60
-
61
- default :
62
- throw new NotSupportedException ( string . Format ( "Unexpected branch type {0}." , branchType ) ) ;
63
- }
64
- }
65
-
66
- public static bool IsDevelop ( this string branchName )
67
- {
68
- return branchName == "develop" ;
69
- }
70
-
71
- public static bool IsMaster ( this string branchName )
72
- {
73
- return branchName == "master" ;
74
- }
75
-
76
18
public static bool IsPullRequest ( this string branchName )
77
19
{
78
20
return branchName . Contains ( "pull/" ) || branchName . Contains ( "pull-requests/" ) || branchName . Contains ( "pr/" ) ;
79
21
}
80
-
81
- public static bool IsSupport ( this string branchName )
82
- {
83
- return branchName . ToLower ( ) . StartsWith ( "support-" ) || branchName . ToLower ( ) . StartsWith ( "support/" ) ;
84
- }
85
22
}
86
23
}
0 commit comments