Sunday, May 6, 2012
Tuesday, May 13, 2008
Moving the blog
Tuesday, April 15, 2008
I had a task recently that involved automating communication with TFS server. I was rather unpleasantly surprised by lack of information in on line help on this subject. Granted, there were definitions of classes that are used for such task on MSDN, but no examples. Sad situation indeed. After some research, I was able to complete my task. It was indeed a trial and error process. The function below gets the latest from specified branch, using local path and server name as parameters. It only pull list of files from that folder, doing one level recursion.
Disclaimer:
This is a quick and dirty function I put together for my needs:
''' <summary>
''' Populates dataset with list of items from TFS server
''' </summary>
''' <param name="path">Local path to get the latest for such as c:sourcesomefolder</param>
''' <param name="serverName">Server name such as TFSServer</param>
''' <returns>True if no errors are thrown</returns>
''' <remarks></remarks>
Private Function GetFolderHistory(ByVal path As String, ByVal serverName As String) As Boolean
Dim returnValue As Boolean = True
Try
'create server object
Dim server As New TeamFoundationServer(serverName)
' create source control object
Dim version As VersionControlServer = CType(server.GetService(GetType(VersionControlServer)), VersionControlServer)
' limit based on changeset id
changeSetNumber = CInt(txtChangeSet.Text)
' paramters for getting latest call
' list of items to get
Dim itemSpecs As New List(Of ItemSpec)
'only specify local path
itemSpecs.Add(New ItemSpec(path, RecursionType.OneLevel))
'only get the latest
Dim versionSpec As VersionSpec = versionSpec.Latest
' get history data
Dim history As BranchHistoryTreeItem()() = version.GetBranchHistory(itemSpecs.ToArray, versionSpec)
' clear dataset with results
ItemsDataSet.Items.Clear()
Dim name As String
Dim changed As DateTime
Dim changeSetID As Integer
' run through items - 2- dimensional array of history
For counter As Integer = 0 To history.Length - 1
For counter1 As Integer = 0 To history(0).Length - 1
Dim item As BranchHistoryTreeItem = history(counter)(counter1)
' get each items's propeties
name = item.Relative.BranchToItem.ServerItem.Substring(item.Relative.BranchToItem.ServerItem.LastIndexOf("/") + 1)
changed = item.Relative.BranchToItem.CheckinDate
changeSetID = item.Relative.BranchToItem.ChangesetId
' compare to minimim change set id
If changeSetID > changeSetNumber Then
If item.Relative.BranchToItem.ItemType = ItemType.File Then
ItemsDataSet.Items.Rows.Add(New Object() {name, changed, changeSetID})
End If
End If
Next
Next
' update UI
ItemsBindingSource.DataSource = ItemsDataSet
grdItems.Sort(grdItems.Columns(2), System.ComponentModel.ListSortDirection.Descending)
If grdItems.Rows.Count > 0 Then
grdItems.Rows(grdItems.Rows.GetFirstRow(DataGridViewElementStates.None)).Selected = True
End If
Catch ex As Exception
MessageBox.Show(ex.Message, "Script", MessageBoxButtons.OK, MessageBoxIcon.Error)
returnValue = False
End Try
Return returnValue
End Function
Tuesday, April 1, 2008
Atlanta Code Camp
My own presentation went pretty well, based on the feedback that I got after it.
I certainly hope that I will get an opportunity to talk more in front of other people. I guess I am a glutton for attention...
Here are Power Point slides converted to a movie.
Saturday, March 15, 2008
CSLA Training
I learned a bit about myself as well. More exactly, I became even more aware of how much I enjoy speaking in front of people. I think I am a glutton for attention :-).
Friday, March 7, 2008
Thoughts On Blogging
For a long time I resisted the temptation to have my own blog. Seems like I needed a little push in order to do so. This push was provided by Atlanta Code Camp application. I needed to put down my blog address, so here it is.
I think I will enjoy blogging. My goal is to keep it purely technology oriented. I enjoy IT industry. I have been working in it for 12 years, and intend to stay working their until retirement (if that time ever comes that is - I have my doubts). Having said that, I enjoy what I do and have not intentions of quitting the wonderful field of software development.
More to come..