8000 WIP - GitVersion is not worth it · PoshCode/PSGit@28d90c3 · GitHub
[go: up one dir, main page]

Skip to content

Commit 28d90c3

Browse files
committed
WIP - GitVersion is not worth it
1 parent 84b0136 commit 28d90c3

File tree

5 files changed

+391
-210
lines changed

5 files changed

+391
-210
lines changed

Build.ps1

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -186,6 +186,7 @@ function update {
186186
foreach($manifest in Get-ChildItem $Script:SourcePath -filter *.psd1 -Recurse) {
187187
foreach($Dependency in (Get-Module $manifest.FullName -ListAvailable -ErrorAction SilentlyContinue).RequiredModules) {
188188
if(!(Get-Module $Dependency.Name -ListAvailable -EA 0)) {
189+
Write-Warning "Installing $($Dependency.Name) in -Scope CurrentUser"
189190
Install-Module -Name $Dependency.Name -AllowClobber -Force -SkipPublisherCheck -Scope CurrentUser
190191
}
191192
}
@@ -220,7 +221,7 @@ function build {
220221

221222
Trace-Message "robocopy $PackageSource $LibPath /E /NP /LOG+:'$OutputPath\build.log' /R:2 /W:15"
222223
$null = robocopy $PackageSource $LibPath /E /NP /LOG+:"$OutputPath\build.log" /R:2 /W:15
223-
if($LASTEXITCODE -ne 0 -and $LASTEXITCODE -ne 1 -and $LASTEXITCODE -ne 3) {
224+
if($LASTEXITCODE -gt 3) {
224225
throw "Failed to copy Package $($Package.id) (${LASTEXITCODE}), see build.log for details"
225226
}
226227
}

Examples/TestVersions.ps1

Lines changed: 59 additions & 32 deletions
Original file line numberDiff line numberDiff line change
@@ -96,7 +96,7 @@ $NewVersion = "18.6.1"
9696
Set-Content Readme.md "Testing versions"
9797
New-Commit $NewVersion -File one
9898
if ($TagFeatures) {
99-
## To work aroung versions, I tag the branches.
99+
## As a test, tag feature branches
100100
git tag $NewVersion
101101
}
102102
Test-Version $NewVersion
@@ -110,7 +110,7 @@ git checkout features/two
110110
$NewVersion = "18.6.2"
111111
New-Commit $NewVersion -File two
112112
if ($TagFeatures) {
113-
## To work aroung versions, I tag the branches.
113+
## As a test, tag feature branches
114114
git tag $NewVersion
115115
}
116116
Test-Version $NewVersion
@@ -119,23 +119,6 @@ $NewVersion = "18.6.2.1"
119119
New-Commit $NewVersion -File two
120120
Test-Version $NewVersion
121121

122-
## And DEV3 starts a feature
123-
git checkout master
124-
git branch features/three
125-
git checkout features/three
126-
127-
$NewVersion = "18.6.3"
128-
New-Commit $NewVersion -File three
129-
if ($TagFeatures) {
130-
## To work aroung versions, I tag the branches.
131-
git tag $NewVersion
132-
}
133-
Test-Version $NewVersion
134-
135-
$NewVersion = "18.6.3.1"
136-
New-Commit $NewVersion -File three
137-
Test-Version $NewVersion
138-
139122
git checkout features/one
140123

141124
## But what we want is for each commit to increment only the build: Major.Minor.Patch.BUILD
@@ -150,50 +133,94 @@ $NewVersion = "18.6.2.2"
150133
New-Commit $NewVersion -File two
151134
Test-Version $NewVersion
152135

153-
## MERGE A BRANCH (tagged 18.6.1) TO MASTER
136+
## And DEV2 finishes, and merges to master
154137
$NewVersion = "18.6.3"
155138
git checkout master
156139
git merge --no-ff -m "Want $NewVersion (merge two)" features/two
140+
git branch -d features/two
141+
Test-Version $NewVersion
142+
143+
## And DEV3 starts a feature
144+
git checkout master
145+
git branch features/three
146+
git checkout features/three
147+
148+
$NewVersion = "18.6.4"
149+
New-Commit $NewVersion -File three
150+
if ($TagFeatures) {
151+
## As a test, tag feature branches
152+
git tag $NewVersion
153+
}
157154
Test-Version $NewVersion
158155

156+
$NewVersion = "18.6.4.1"
157+
New-Commit $NewVersion -File three
158+
Test-Version $NewVersion
159+
160+
## And DEV1 does some more work
159161
git checkout features/one
160162

161163
$NewVersion = "18.6.1.2"
162164
New-Commit $NewVersion -File one
163165
Test-Version $NewVersion
164166

165-
$NewVersion = "18.6.4"
167+
## And DEV1 finishes, and merges to master
168+
$NewVersion = "18.6.5"
166169
git checkout master
167170
git merge --no-ff -m "Want $NewVersion (merge one)" features/one
171+
git branch -d features/one
168172
Test-Version $NewVersion
169173

170174
## RANDOM COMMIT ON MASTER
171-
$NewVersion = "18.6.5"
175+
$NewVersion = "18.6.6"
172176
New-Commit $NewVersion -File one
173177
Test-Version $NewVersion
174178

175179
## RELEASE BRANCH
176-
$NewVersion = "18.6.6"
180+
$Release = $NewVersion = "18.6.7"
177181
git branch releases/$NewVersion
178182
git checkout releases/$NewVersion
179183
New-Commit $NewVersion
180184
Test-Version $NewVersion
181185

182186
## COMMIT ON RELEASE
183-
$NewVersion = "18.6.6"
187+
$NewVersion = "18.6.7"
184188
New-Commit $NewVersion
185189
Test-Version $NewVersion
186190

187-
## TAG RELEASE
188-
$NewVersion = "18.6.6"
191+
if($StopEarly) {
192+
return
193+
}
194+
195+
## And DEV2 starts a new feature
196+
git checkout master
197+
git branch features/two
198+
git checkout features/two
199+
200+
$NewVersion = "18.6.8"
201+
New-Commit $NewVersion -File two
189202
if ($TagFeatures) {
190-
## To work aroung versions, I tag the branches.
203+
## As a test, tag feature branches
191204
git tag $NewVersion
192205
}
193206
Test-Version $NewVersion
194207

195-
# ## MERGE TO MASTER
196-
# $NewVersion = "18.6.7"
197-
# git checkout master
198-
# git merge --no-ff -m "Want $NewVersion (merge $NewVersion)" releases/18.6.6
199-
# Test-Version $NewVersion
208+
$NewVersion = "18.6.8.1"
209+
New-Commit $NewVersion -File two
210+
Test-Version $NewVersion
211+
212+
## Finish RELEASE
213+
$NewVersion = $Release -split "\." | % {$i=0; $a=@()} { $i += 1; if($i -eq 3){ $a += @(([int]$_) + 1) }else{ $a += @($_) } } { $a -join "." }
214+
git checkout releases/$Release
215+
git tag $NewVersion
216+
Test-Version $NewVersion
217+
git checkout master
218+
git merge --no-ff -m "Want $NewVersion (merge $NewVersion)" releases/$Release
219+
git branch -d releases/$Release
220+
221+
## And DEV3 finishes, and merges to master ??
222+
$NewVersion = "18.7.1"
223+
git checkout master
224+
git merge --no-ff -m "Want $NewVersion (merge three)" features/three
225+
git branch -d features/three
226+
Test-Version $NewVersion

Tests/Log.feature

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
Feature: Get a list of changes to the repository
2+
In order to understand the history of our repository
3+
We should have a command that will return the most recent commits
4+
5+
# This is a freebie, so that there's something not @wip
6+
Scenario: There's no Repository
7+
Given we are NOT in a repository
8+
When Get-GitLog is called
9+
Then the output should be a warning: "The path is not in a git repository!"
10+
11+
Scenario: Empty Repository
12+
Given we have initialized a repository
13+
When Get-GitLog is called
14+
Then there should be no output1
15+
16+
17+
Scenario: Get-GitLog should have similar parameters to git status
18+
Given we have a command Get-GitChange
19+
Then it should have parameters:
20+
| Name | Type |
21+
| PathSpec | String[] |
22+
| HideUntracked | Switch |
23+
| ShowIgnored | Switch |
24+
| HideSubmodules | Switch |

src/PSGit.formats.ps1xml

Lines changed: 8 additions & 55 deletions
Original file line numberDiff line numberDiff line change
@@ -137,13 +137,16 @@
137137
<Label>Message</Label>
138138
</TableColumnHeader>
139139
<TableColumnHeader>
140-
<Label>Date</Label>
140+
<Label>Branch</Label>
141141
</TableColumnHeader>
142142
<TableColumnHeader>
143-
<Label>Author</Label>
143+
<Label>Tags</Label>
144144
</TableColumnHeader>
145145
<TableColumnHeader>
146-
<Label>Tags</Label>
146+
<Label>Date</Label>
147+
</TableColumnHeader>
148+
<TableColumnHeader>
149+
<Label>Author</Label>
147150
</TableColumnHeader>
148151
</TableHeaders>
149152
<TableRowEntries>
@@ -158,58 +161,13 @@
158161
<PropertyName>MessageShort</PropertyName>
159162
</TableColumnItem>
160163
<TableColumnItem>
161-
<ScriptBlock>
162-
"{0:MMM d yyyy hh:mm:ss}" -f $_.Date
163-
</ScriptBlock>
164-
</TableColumnItem>
165-
<TableColumnItem>
166-
<PropertyName>Author</PropertyName>
164+
<PropertyName>Branch</PropertyName>
167165
</TableColumnItem>
168166
<TableColumnItem>
169167
<ScriptBlock>
170-
"{" + ($_.Tags.FriendlyName -join ", ") + "}"
171-
</ScriptBlock>
172-
</TableColumnItem>
173-
</TableColumnItems>
174-
</TableRowEntry>
175-
</TableRowEntries>
176-
</TableControl>
177-
</View>
178-
<View>
179-
<Name>Git.CommitList</Name>
180-
<ViewSelectedBy>
181-
<TypeName>LibGit2Sharp.Commit</TypeName>
182-
<TypeName>PSGit.Commit</TypeName>
183-
</ViewSelectedBy>
184-
<TableControl>
185-
<TableHeaders>
186-
<TableColumnHeader>
187-
<Label>Sha</Label>
188-
</TableColumnHeader>
189-
<TableColumnHeader>
190-
<Label>Message</Label>
191-
</TableColumnHeader>
192-
<TableColumnHeader>
193-
<Label>Date</Label>
194-
</TableColumnHeader>
195-
<TableColumnHeader>
196-
<Label>Author</Label>
197-
</TableColumnHeader>
198-
<TableColumnHeader>
199-
<Label>Tags</Label>
200-
</TableColumnHeader>
201-
</TableHeaders>
202-
<TableRowEntries>
203-
<TableRowEntry>
204-
<TableColumnItems>
205-
<TableColumnItem>
206-
<ScriptBlock>
207-
$_.Sha.ToString().Substring(0,7)
168+
$_.Tags.FriendlyName
208169
</ScriptBlock>
209170
</TableColumnItem>
210-
<TableColumnItem>
211-
<PropertyName>MessageShort</PropertyName>
212-
</TableColumnItem>
213171
<TableColumnItem>
214172
<ScriptBlock>
215173
"{0:MMM d yyyy hh:mm:ss}" -f $_.Date
@@ -218,11 +176,6 @@
218176
<TableColumnItem>
219177
<PropertyName>Author</PropertyName>
220178
</TableColumnItem>
221-
<TableColumnItem>
222-
<ScriptBlock>
223-
"{" + ($_.Tags.FriendlyName -join ", ") + "}"
224-
</ScriptBlock>
225-
</TableColumnItem>
226179
</TableColumnItems>
227180
</TableRowEntry>
228181
</TableRowEntries>

0 commit comments

Comments
 (0)
0