Skip to content

Commit

Permalink
Adds auto-add and auto-delete functionality to the TFVC Checkin task. C…
Browse files Browse the repository at this point in the history
…loses #19 and #18 and finishes the work for #8.
  • Loading branch information
jessehouwing committed Feb 25, 2016
1 parent 166f3b2 commit 74554a2
Show file tree
Hide file tree
Showing 6 changed files with 44 additions and 16 deletions.
2 changes: 1 addition & 1 deletion extension-manifest.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
"manifestVersion": 1,
"id": "jessehouwing-vsts-tfvc-tasks-TEST",
"name": "TFVC Build Tasks",
"version": "1.1.38",
"version": "1.1.39",
"publisher": "jessehouwing",
"public": false,
"targets": [
Expand Down
2 changes: 1 addition & 1 deletion vsts-tfvc-add/TfvcAdd.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ param(
[ValidateSet("None", "Full", "OneLevel")]
[string] $Recursion = "None",
[ValidateSet($true, $false, "")]
[string] $Recursive,
[string] $Recursive, #For backwards compatibility reasons
[string] $ApplyLocalitemExclusions = $true
)

Expand Down
2 changes: 1 addition & 1 deletion vsts-tfvc-add/task.json
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
"version": {
"Major": 1,
"Minor": 1,
"Patch": 38
"Patch": 39
},
"minimumAgentVersion": "1.83.0",
"groups": [
Expand Down
27 changes: 16 additions & 11 deletions vsts-tfvc-checkin/TfvcCheckin.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,10 @@ param(
[string] $ConfirmUnderstand = $false,
[string] $OverridePolicy = $false,
[string] $OverridePolicyReason = "",
[string] $Notes = ""
[string] $Notes = "",

[string] $AutoDetectAdds = $false,
[string] $AutoDetectDeletes = $false
)

Write-Verbose "Entering script $($MyInvocation.MyCommand.Name)"
Expand Down Expand Up @@ -84,7 +87,6 @@ Function Evaluate-Checkin {
}
}


Function Handle-PolicyOverride {
[cmdletbinding()]
param(
Expand Down Expand Up @@ -119,8 +121,7 @@ Function Handle-PolicyOverride {
}
}

function Parse-CheckinNotes
{
function Parse-CheckinNotes {
[cmdletbinding()]
param(
[string] $Notes
Expand Down Expand Up @@ -159,17 +160,21 @@ Try

$RecursionType = [Microsoft.TeamFoundation.VersionControl.Client.RecursionType]$Recursion

if ($Itemspec -ne "")
[string[]] $FilesToCheckin = $ItemSpec -split "(;|\r?\n)"
Write-Output $FilesToCheckin

if ($AutoDetectAdds -eq $true)
{
[string[]] $FilesToCheckin = $ItemSpec -split "(;|\r?\n)"
Write-Output $FilesToCheckin
$pendingChanges = $provider.Workspace.GetPendingChanges( [string[]]@($FilesToCheckin), $RecursionType )
AutoPend-WorkspaceChanges -Provider $provider -Items @($FilesToCheckin) -RecursionType $RecursionType -ChangeType "Add"
}
else

if ($AutoDetectDeletes -eq $true)
{
$pendingChanges = $provider.Workspace.GetPendingChanges($RecursionType)
AutoPend-WorkspaceChanges -Provider $provider -Items @($FilesToCheckin) -RecursionType $RecursionType -ChangeType "Delete"
}


$pendingChanges = $provider.Workspace.GetPendingChanges( [string[]]@($FilesToCheckin), $RecursionType )

if ($Notes -ne "")
{
$CheckinNotes = Parse-CheckinNotes $Notes
Expand Down
25 changes: 24 additions & 1 deletion vsts-tfvc-checkin/task.json
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
"version": {
"Major": 1,
"Minor": 1,
"Patch": 38
"Patch": 39
},
"visibility": [
"Build"
Expand All @@ -29,6 +29,11 @@
"displayName": "Configuration",
"isExpanded": true
},
{
"name": "autoDetectOptions",
"displayName": "Auto-detect changes",
"isExpanded": true
},
{
"name": "notesOptions",
"displayName": "Notes",
Expand Down Expand Up @@ -59,6 +64,24 @@
"required": false,
"type": "boolean"
},
{
"defaultValue": false,
"groupName": "autoDetectOptions",
"helpMarkdown": "Auto-detects any files added to the workspace. Always applies local workspace exclusions.",
"label": "Adds",
"name": "autoDetectAdds",
"required": false,
"type": "boolean"
},
{
"defaultValue": false,
"groupName": "autoDetectOptions",
"helpMarkdown": "Auto-detects any files deleted from the workspace. Always applies local workspace exclusions.",
"label": "Deletes",
"name": "autoDetectDeletes",
"required": false,
"type": "boolean"
},
{
"defaultValue": false,
"groupName": "overrideOptions",
Expand Down
2 changes: 1 addition & 1 deletion vsts-tfvc-delete/task.json
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
"version": {
"Major": 1,
"Minor": 1,
"Patch": 38
"Patch": 39
},
"minimumAgentVersion": "1.83.0",
"groups": [
Expand Down

0 comments on commit 74554a2

Please sign in to comment.