Skip to content

Commit 55ee822

Browse files
committed
WIP Unlinked changes
Will be overwritten
1 parent 4f20698 commit 55ee822

3 files changed

Lines changed: 77 additions & 1 deletion

File tree

Lines changed: 73 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,73 @@
1+
Imports System.Management.Automation
2+
Imports System.Text.RegularExpressions
3+
Imports Microsoft.TeamFoundation.WorkItemTracking.Client
4+
5+
<Cmdlet(VerbsCommon.Get, "UnlinkedChanges")>
6+
Public Class GetUnlinkedChanges
7+
Inherits PSCmdlet
8+
9+
<Parameter(Mandatory:=True,
10+
ValueFromPipelineByPropertyName:=True,
11+
ValueFromPipeline:=True,
12+
Position:=0,
13+
ParameterSetName:="URL",
14+
HelpMessage:="The URL of the TFS collection to access.")>
15+
Property ServerURL As Uri
16+
17+
<Parameter(Mandatory:=True,
18+
ValueFromPipelineByPropertyName:=True,
19+
ValueFromPipeline:=True,
20+
Position:=0,
21+
ParameterSetName:="Collection",
22+
HelpMessage:="The TFS collection to use.")>
23+
Property TFSCollection As TFSCollection
24+
25+
'<Parameter(Mandatory:=True,
26+
' ValueFromPipelineByPropertyName:=True,
27+
' ValueFromPipeline:=True,
28+
' Position:=1,
29+
' HelpMessage:="The IDs of the work items to retrieve changed files from.")>
30+
'Property WorkItemIDs As Integer()
31+
32+
Protected Overrides Sub BeginProcessing()
33+
MyBase.BeginProcessing()
34+
Select Case True
35+
36+
Case TFSCollection IsNot Nothing
37+
'we are good
38+
Case TFSCollection Is Nothing AndAlso ServerURL IsNot Nothing
39+
40+
TFSCollection = GetTFSCollection(ServerURL)
41+
42+
End Select
43+
44+
End Sub
45+
46+
Protected Overrides Sub ProcessRecord()
47+
MyBase.ProcessRecord()
48+
49+
'Dim changesetRegex As New Regex("vstfs:///VersionControl/Changeset/(\d+)", RegexOptions.Compiled)
50+
'Dim changesetLinks = links.Where(Function(l) changesetRegex.IsMatch(l.LinkedArtifactUri))
51+
52+
'Dim changesets = changesetLinks.Select(Function(c) vcs.GetChangeset(CInt(changesetRegex.Match(c.LinkedArtifactUri).Groups(1).Value))).DistinctBy(Function(c) c.ChangesetId)
53+
54+
'Dim changes = changesets.SelectMany(Function(cs) cs.Changes)
55+
56+
'Dim byItem = From c In changes Group By ServerPath = c.Item.ServerItem Into ItemChanges = Group
57+
' Select New FileChangeInfo With {.ServerPath = ServerPath, .Changes = ItemChanges, .LastCheckin = ItemChanges.Max(Function(c) c.Item.CheckinDate)}
58+
59+
'For Each item In byItem
60+
61+
' For Each ch In item.Changes.OrderByDescending(Function(c) c.Item.CheckinDate)
62+
' WriteObject(item)
63+
' Next
64+
'Next
65+
66+
' service.QueryHistory("$/TeamProject/", VersionSpec.Latest, 0, RecursionType.Full, userName, null, null, Int32.MaxValue, True, False)
67+
' .Cast<Changeset>()
68+
'.Where(cs=>cs.AssociatedWorkItems.Length==0)
69+
70+
WriteObject(TFSCollection.ProjectCollection.Name)
71+
72+
End Sub
73+
End Class

TFS Release Notes/TFS Release Notes.vbproj

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -265,6 +265,7 @@
265265
</ItemGroup>
266266
<ItemGroup>
267267
<Compile Include="Cmdlets\GetTFS.vb" />
268+
<Compile Include="Cmdlets\GetUnlinkedChanges.vb" />
268269
<Compile Include="Cmdlets\GetWorkItemAttachments.vb" />
269270
<Compile Include="Cmdlets\GetWorkItemSQLScripts.vb" />
270271
<Compile Include="Cmdlets\GetWorkItemFiles.vb" />

TFS Release Notes/tfs release notes.psd1

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -72,7 +72,9 @@ FunctionsToExport = @()
7272
CmdletsToExport = @('Get-TFS',
7373
'Get-WorkItemAttachments',
7474
'Get-WorkItemFiles',
75-
'Get-WorkItemSQLScripts')
75+
'Get-WorkItemSQLScripts',
76+
'Get-UnlinkedChanges'
77+
)
7678

7779
# Variables to export from this module
7880
VariablesToExport = '*'

0 commit comments

Comments
 (0)