Skip to content

Commit

Permalink
WIP Unlinked changes
Browse files Browse the repository at this point in the history
Will be overwritten
  • Loading branch information
vbjay committed Sep 8, 2016
1 parent 4f20698 commit 55ee822
Show file tree
Hide file tree
Showing 3 changed files with 77 additions and 1 deletion.
73 changes: 73 additions & 0 deletions TFS Release Notes/Cmdlets/GetUnlinkedChanges.vb
Original file line number Diff line number Diff line change
@@ -0,0 +1,73 @@
Imports System.Management.Automation
Imports System.Text.RegularExpressions
Imports Microsoft.TeamFoundation.WorkItemTracking.Client

<Cmdlet(VerbsCommon.Get, "UnlinkedChanges")>
Public Class GetUnlinkedChanges
Inherits PSCmdlet

<Parameter(Mandatory:=True,
ValueFromPipelineByPropertyName:=True,
ValueFromPipeline:=True,
Position:=0,
ParameterSetName:="URL",
HelpMessage:="The URL of the TFS collection to access.")>
Property ServerURL As Uri

<Parameter(Mandatory:=True,
ValueFromPipelineByPropertyName:=True,
ValueFromPipeline:=True,
Position:=0,
ParameterSetName:="Collection",
HelpMessage:="The TFS collection to use.")>
Property TFSCollection As TFSCollection

'<Parameter(Mandatory:=True,
' ValueFromPipelineByPropertyName:=True,
' ValueFromPipeline:=True,
' Position:=1,
' HelpMessage:="The IDs of the work items to retrieve changed files from.")>
'Property WorkItemIDs As Integer()

Protected Overrides Sub BeginProcessing()
MyBase.BeginProcessing()
Select Case True

Case TFSCollection IsNot Nothing
'we are good
Case TFSCollection Is Nothing AndAlso ServerURL IsNot Nothing

TFSCollection = GetTFSCollection(ServerURL)

End Select

End Sub

Protected Overrides Sub ProcessRecord()
MyBase.ProcessRecord()

'Dim changesetRegex As New Regex("vstfs:///VersionControl/Changeset/(\d+)", RegexOptions.Compiled)
'Dim changesetLinks = links.Where(Function(l) changesetRegex.IsMatch(l.LinkedArtifactUri))

'Dim changesets = changesetLinks.Select(Function(c) vcs.GetChangeset(CInt(changesetRegex.Match(c.LinkedArtifactUri).Groups(1).Value))).DistinctBy(Function(c) c.ChangesetId)

'Dim changes = changesets.SelectMany(Function(cs) cs.Changes)

'Dim byItem = From c In changes Group By ServerPath = c.Item.ServerItem Into ItemChanges = Group
' Select New FileChangeInfo With {.ServerPath = ServerPath, .Changes = ItemChanges, .LastCheckin = ItemChanges.Max(Function(c) c.Item.CheckinDate)}

'For Each item In byItem

' For Each ch In item.Changes.OrderByDescending(Function(c) c.Item.CheckinDate)
' WriteObject(item)
' Next
'Next

' service.QueryHistory("$/TeamProject/", VersionSpec.Latest, 0, RecursionType.Full, userName, null, null, Int32.MaxValue, True, False)
' .Cast<Changeset>()
'.Where(cs=>cs.AssociatedWorkItems.Length==0)

WriteObject(TFSCollection.ProjectCollection.Name)

End Sub
End Class
1 change: 1 addition & 0 deletions TFS Release Notes/TFS Release Notes.vbproj
Original file line number Diff line number Diff line change
Expand Up @@ -265,6 +265,7 @@
</ItemGroup>
<ItemGroup>
<Compile Include="Cmdlets\GetTFS.vb" />
<Compile Include="Cmdlets\GetUnlinkedChanges.vb" />
<Compile Include="Cmdlets\GetWorkItemAttachments.vb" />
<Compile Include="Cmdlets\GetWorkItemSQLScripts.vb" />
<Compile Include="Cmdlets\GetWorkItemFiles.vb" />
Expand Down
4 changes: 3 additions & 1 deletion TFS Release Notes/tfs release notes.psd1
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,9 @@ FunctionsToExport = @()
CmdletsToExport = @('Get-TFS',
'Get-WorkItemAttachments',
'Get-WorkItemFiles',
'Get-WorkItemSQLScripts')
'Get-WorkItemSQLScripts',
'Get-UnlinkedChanges'
)

# Variables to export from this module
VariablesToExport = '*'
Expand Down

0 comments on commit 55ee822

Please sign in to comment.