forked from dotnet/source-build
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathfetch-vsts-commits.ps1
40 lines (36 loc) · 999 Bytes
/
fetch-vsts-commits.ps1
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
param (
[Parameter(Mandatory=$true)][string]$pat,
[string]$remote_ref_name = "vsts"
)
function get_vsts_url(
[Parameter(Mandatory=$true)][string]$name,
[string]$instance = 'devdiv.visualstudio.com',
[string]$project = 'DevDiv')
{
return "https://usernameplaceholder:${pat}@${instance}/${project}/_git/${name}/"
}
function fetch(
[Parameter(Mandatory=$true)][string]$name,
[Parameter(Mandatory=$true)][string]$remote)
{
$cmd = @(
"-C", "src/$name"
# Disable credential manager if one is specified. Always use manual PAT.
"-c", "credential.helper="
"fetch"
$remote
"+refs/heads/*:refs/remotes/${remote_ref_name}/*"
)
echo "Fetching commits using: & git $cmd"
& git @cmd
}
function fetch_vsts(
[Parameter(Mandatory=$true)][string]$name,
[string]$url = (get_vsts_url "DotNet-$name-Trusted"))
{
fetch "$name" "$url"
}
fetch_vsts cli
fetch_vsts core-setup
fetch_vsts coreclr
fetch_vsts corefx