I need to create two methods as follows:
- Retrieve all changesets in TFS.
- Retrieve all changesets newer than a specified changeset.
I've done some google searching and found a few links and managed to come up with some code. I can't seem to work out the method to call to get the complete list of changeset items. I've botched something together to get this but was wondering if someone can help me:
TfsTeamProjectCollection projectCollection = TfsTeamProjectCollectionFactory.GetTeamProjectCollection(new Uri("http://mydomain.com:8080/tfs"));
VersionControlServer versionControl = projectCollection.GetService<VersionControlServer>();
int latestId = versionControl.GetLatestChangesetId();
List<Changeset> changesetList = new List<Changeset>();
for (int i = 1; i < latestId; i++)
{
try
{
Changeset cs = versionControl.GetChangeset(i);
if (cs != null)
{
changesetList.Add(cs);
}
}
catch (ResourceAccessException)
{
}
}
Getting the changeset for some Id's throws a 'ResourceAccessException' exception which is why the handler has been added.
Any ideas on how to do this in the "proper" way?
I'm using Visual Studio 2010 with TFS 2010. Application is being written in C# as a .Net 4.0 app.
TIA
See Question&Answers more detail:
os 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…