forked from lelemka0/MiPushFramework
-
Notifications
You must be signed in to change notification settings - Fork 33
Expand file tree
/
Copy pathintegrate.ps1
More file actions
44 lines (36 loc) · 1.05 KB
/
integrate.ps1
File metadata and controls
44 lines (36 loc) · 1.05 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
param([string]$Message, [string]$Commit, [switch]$Reset)
if ($message -eq "") {
Write-Host "Need -message argument for integration message" -ForegroundColor Red
return;
}
Write-Host "Checking for uncommitted changes" -ForegroundColor Green
[string]$res = git status --porcelain
if ($res) {
Write-Host "Commit changes before integrating" -ForegroundColor Red
return;
}
$integrationBranch = "master"
$currentBranch = git rev-parse --abbrev-ref HEAD
if ($commit -eq "") {
$commit = $currentBranch
}
$tempBranch = "temp_integrate_branch_$commit"
try {
git checkout -B $tempBranch $commit
Write-Host "Validating build" -ForegroundColor Green
./build
if ($LASTEXITCODE -ne 0) {
return
}
Write-Host "Integrating $currentBranch into $integrationBranch" -ForegroundColor Green
git checkout $integrationBranch
if ($Reset) {
git reset --hard origin/$integrationBranch
}
git merge $commit --no-ff --log=9999 --message="INTEGRATE: $message"
git rebase $integrationBranch $currentBranch
}
finally {
git checkout -f $currentBranch
git branch -D $tempBranch
}