File tree Expand file tree Collapse file tree 7 files changed +44
-13
lines changed Expand file tree Collapse file tree 7 files changed +44
-13
lines changed Original file line number Diff line number Diff line change 1
1
using System ;
2
2
using System . IO ;
3
+ using System . Text ;
3
4
using GitVersion ;
5
+ using GitVersion . Helpers ;
4
6
using LibGit2Sharp ;
5
7
8
+ /// <summary>
9
+ /// Creates a repo with a develop branch off master which is a single commit ahead of master
10
+ /// </summary>
6
11
public class BaseGitFlowRepositoryFixture : EmptyRepositoryFixture
7
12
{
13
+ /// <summary>
14
+ /// Creates a repo with a develop branch off master which is a single commit ahead of master
15
+ ///
16
+ /// Master will be tagged with the initial version before branching develop
17
+ /// </summary>
8
18
public BaseGitFlowRepositoryFixture ( string initialVersion ) : base ( new Config ( ) )
9
19
{
10
20
SetupRepo ( r => r . MakeATaggedCommit ( initialVersion ) ) ;
11
21
}
12
22
23
+ /// <summary>
24
+ /// Creates a repo with a develop branch off master which is a single commit ahead of master
25
+ ///
26
+ /// The initial setup actions will be performed before branching develop
27
+ /// </summary>
13
28
public BaseGitFlowRepositoryFixture ( Action < IRepository > initialMasterAction ) : base ( new Config ( ) )
14
29
{
15
30
SetupRepo ( initialMasterAction ) ;
@@ -24,5 +39,21 @@ void SetupRepo(Action<IRepository> initialMasterAction)
24
39
initialMasterAction ( Repository ) ;
25
40
26
41
Repository . CreateBranch ( "develop" ) . Checkout ( ) ;
42
+ Repository . MakeACommit ( ) ;
43
+ }
44
+
45
+ public void DumpGraph ( )
46
+ {
47
+ var output = new StringBuilder ( ) ;
48
+
49
+ ProcessHelper . Run (
50
+ o => output . AppendLine ( o ) ,
51
+ e => output . AppendLineFormat ( "ERROR: {0}" , e ) ,
52
+ null ,
53
+ "git" ,
54
+ @"log --graph --abbrev-commit --decorate --date=relative --all" ,
55
+ RepositoryPath ) ;
56
+
57
+ Console . Write ( output . ToString ( ) ) ;
27
58
}
28
59
}
Original file line number Diff line number Diff line change @@ -14,13 +14,13 @@ public void PatchLatestReleaseExample()
14
14
// create hotfix
15
15
fixture . Repository . CreateBranch ( "hotfix-1.2.1" ) . Checkout ( ) ;
16
16
17
- fixture . AssertFullSemver ( "1.2.1-beta.1+0" ) ;
18
- fixture . Repository . MakeACommit ( ) ;
19
17
fixture . AssertFullSemver ( "1.2.1-beta.1+1" ) ;
18
+ fixture . Repository . MakeACommit ( ) ;
19
+ fixture . AssertFullSemver ( "1.2.1-beta.1+2" ) ;
20
20
fixture . Repository . ApplyTag ( "1.2.1-beta.1" ) ;
21
- fixture . AssertFullSemver ( "1.2.1-beta.1+1 " ) ;
21
+ fixture . AssertFullSemver ( "1.2.1-beta.1+2 " ) ;
22
22
fixture . Repository . MakeACommit ( ) ;
23
- fixture . AssertFullSemver ( "1.2.1-beta.2+2 " ) ;
23
+ fixture . AssertFullSemver ( "1.2.1-beta.2+3 " ) ;
24
24
25
25
// Merge hotfix branch to master
26
26
fixture . Repository . Checkout ( "master" ) ;
@@ -77,7 +77,7 @@ public void PatchOlderReleaseExample()
77
77
78
78
// Verify develop version
79
79
fixture . Repository . Checkout ( "develop" ) ;
80
- fixture . AssertFullSemver ( "1.3.0-unstable.0+0 " ) ;
80
+ fixture . AssertFullSemver ( "1.3.0-unstable.1+1 " ) ;
81
81
}
82
82
}
83
83
}
Original file line number Diff line number Diff line change @@ -10,18 +10,18 @@ public class SupportBranchScenarios
10
10
public void SupportIsCalculatedCorrectly ( )
11
11
{
12
12
using ( var fixture = new BaseGitFlowRepositoryFixture ( "1.1.0" ) )
13
- {
13
+ {
14
14
// Create 2.0.0 release
15
15
fixture . Repository . CreateBranch ( "release-2.0.0" ) . Checkout ( ) ;
16
16
fixture . Repository . MakeCommits ( 2 ) ;
17
-
17
+
18
18
// Merge into develop and master
19
19
fixture . Repository . Checkout ( "master" ) ;
20
20
fixture . Repository . MergeNoFF ( "release-2.0.0" ) ;
21
21
fixture . Repository . ApplyTag ( "2.0.0" ) ;
22
22
fixture . Repository . Checkout ( "develop" ) ;
23
23
fixture . Repository . MergeNoFF ( "release-2.0.0" ) ;
24
- fixture . AssertFullSemver ( "2.1.0-unstable.0+0 " ) ;
24
+ fixture . AssertFullSemver ( "2.1.0-unstable.1+1 " ) ;
25
25
26
26
// Now lets support 1.x release
27
27
fixture . Repository . Checkout ( "1.1.0" ) ;
@@ -47,6 +47,6 @@ public void SupportIsCalculatedCorrectly()
47
47
fixture . Repository . MergeNoFF ( "hotfix/1.2.1" ) ;
48
48
fixture . AssertFullSemver ( "1.2.1" ) ;
49
49
}
50
- }
50
+ }
51
51
}
52
52
}
Original file line number Diff line number Diff line change 78
78
<Compile Include =" GitFlow\BranchFinders\RecentTagVersionExtractor.cs" />
79
79
<Compile Include =" Helpers\FileSystem.cs" />
80
80
<Compile Include =" Helpers\IFileSystem.cs" />
81
+ <Compile Include =" Helpers\ProcessHelper.cs" />
81
82
<Compile Include =" LastMinorVersionFinder.cs" />
82
83
<Compile Include =" SemanticVersionExtensions.cs" />
83
84
<Compile Include =" VersioningModes\ContinuousDeliveryMode.cs" />
Original file line number Diff line number Diff line change 1
- namespace GitVersion
1
+ namespace GitVersion . Helpers
2
2
{
3
3
using System ;
4
4
using System . Collections . Generic ;
@@ -7,7 +7,7 @@ namespace GitVersion
7
7
using System . Runtime . InteropServices ;
8
8
using System . Threading ;
9
9
10
- static class ProcessHelper
10
+ public static class ProcessHelper
11
11
{
12
12
static volatile object lockObject = new object ( ) ;
13
13
Original file line number Diff line number Diff line change 2
2
using System . Collections . Generic ;
3
3
using System . IO ;
4
4
using System . Text ;
5
- using GitVersion ;
5
+ using GitVersion . Helpers ;
6
6
using LibGit2Sharp ;
7
7
8
8
public static class GitVersionHelper
Original file line number Diff line number Diff line change 57
57
<Compile Include =" ExtensionMethods.cs" />
58
58
<Compile Include =" GitPreparer.cs" />
59
59
<Compile Include =" HelpWriter.cs" />
60
- <Compile Include =" ProcessHelper.cs" />
61
60
<Compile Include =" Program.cs" />
62
61
<Compile Include =" AssemblyInfo.cs" />
63
62
<Compile Include =" AssemblyInfoFileUpdate.cs" />
You can’t perform that action at this time.
0 commit comments