Item Version History available for UI connectivity

Topics: Developer Forum
Jul 18, 2006 at 2:17 PM
I have created a class named CodePlex.Vertigo.TeamFoundation.VersionControl.ChangesetHistory. This will provide a set of Microsoft.TeamFoundation.VersionControl.Client.Changeset objects via the class CodePlex.Vertigo.TeamFoundation.VersionControl.ChangesetHistortyList which inherits from System.Collections.Generic.SortedList<int, Changset> where int is the ChangesetId.

There exists a class TFSContext that should always be created on a session startup that takes in NetworkCredentials and has a method SetTFSServer(string serverName) for creating a static TFSContext.TFSServer that can be used throughout the time of the application. TFSContext.Creds must be set first before calling SetTFSServer or you will not be able to authenticate to the sever since it relies on that set of Credentials.

The ChangesetHistory class requires a property of Path to be set before asking for the HistoryList property otherwise there is no item on which to get history. Path can be a local workspace path to an item or it can be a repository path.

You can look at the unit tests in CodePlex.Vertigo.Tests.ChangeHistoryTest.cs for examples of use.
To run the test you will need to place in your user crednetials and comment out the exception that is thrown just afterwords. I recommend removing your credentials before checkin and returning this section of the code to the prior state.

In short:

Set TFSContext.Creds
Call TFSContext.SetTFSServer(@””);
Determine the path to an item (server path or workspace path)
Create an instance of ChangeHistory(PATH) or ChangesetHistory() and the set the Path Property
Get the ChangsetHistory.HistoryList (This property name will be changing)
You now have a sorted list of Changesets by ChangesetId in which the ChangesetId is the version number.

Jul 18, 2006 at 2:18 PM
TODO: (these will be added to task lists)

Provide front end UI to gather creds, and display a simple tree of versions

TFSContext will be moved from CodePlex.Vertigo.Common to CodePlex.Vertigo.TeamFoundation in a bit of refactoring.

Inline code documentation will be added.

Additional tests will be created.

Provide a mechanism outside storage in SCC for users to store their credentials one time so that the unit tests don’t need changed to support not showing credentials in checked in code and also make it secure that a key of some sort must be known in order to authenticate.
I have an idea on this using a slight variation on encrypted authentication sections in config files.

Currently the unit test points to a given HelloWorld.vb file in the test source tree that has a known set of versions. I have locked this file so that this cannot change. Another file needs to be created that will never need to be touched during testing that provides such know information for unit testing.

Change ChangesetHistory.HistoryList to a better name.