This repository was archived by the owner on Sep 29, 2023. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathCompare-GitLabProjectRepositoryCommit.ps1
More file actions
53 lines (48 loc) · 1.57 KB
/
Copy pathCompare-GitLabProjectRepositoryCommit.ps1
File metadata and controls
53 lines (48 loc) · 1.57 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
45
46
47
48
49
50
51
52
53
function Compare-GitLabProjectRepositoryCommit
{
<#
.SYNOPSIS
Compares 2 commits
.DESCRIPTION
Compares 2 commits by branch, tag or commits.
one is the reference and the other is the target.
returns the difference in commits and in files.
.EXAMPLE
Compare-GitLabProjectRepositoryCommit -ProjectID 20 -Reference 'master' -target 2484458d2f97c5e0263406065f83be0fa8b75d92
---------------------------------------------------------------
compares the branch master with commit 2484458d2f97c5e0263406065f83be0fa8b75d92
#>
[CmdletBinding()]
[Alias()]
[OutputType()]
Param
(
# The ID of a project
[Parameter(HelpMessage = 'ProjectID',
Mandatory = $true)]
[Alias('ID')]
[int]$ProjectID,
#the commit SHA or branch name to compare from
[Parameter(Helpmessage = 'commit SHA or branch name to compare from',
Mandatory = $true)]
[Alias('from')]
[String]$Reference,
#the commit SHA or branch name to compare to
[Parameter(Helpmessage = 'commit SHA or branch name to compare to',
Mandatory = $true)]
[Alias('to')]
[String]$Target,
#Existing GitlabConnector Object, can be retrieved with Get-GitlabConnect
[Parameter(HelpMessage = 'Specify Existing GitlabConnector',
Mandatory = $false,
DontShow = $true)]
[psobject]$GitlabConnect = (Get-GitlabConnect)
)
$httpmethod = 'get'
$apiurl = "projects/$ProjectID/repository/compare"
$Parameters = @{
from = $Reference
to = $Target
}
$GitlabConnect.callapi($apiurl,$httpmethod,$Parameters)
}