Enumerating the entire contents of a folder in tfs

Given a specific folder path in tfs, I need to recursively find all the files and folders in a folder for a given set of changes. In other words, I need to get a transitive path closure in tfs for a given set of changes. The problem I encounter with this is listing the contents of a specific folder in tfs .. How is this possible in C #?

+5
source share
4 answers

I assume that you want "the contents of the folder with change set X" and not "the contents of the folder that was part of change set X"

GetItems is the right call to use, just go to the version specification for the set of changes you are interested in.

http://msdn.microsoft.com/en-US/library/bb138911.aspx

therefore, if you already have a link to an instance of VersionControlServer:

var myFolderAtChangeset17 = versionControlServer.GetItems("$/MyFolder", new ChangesetVersionSpec(17), RecursionType.Full);

If I misunderstood and you want “the contents of the folder that was part of change set X”, there are several different ways to do this, but getting the change set using GetChangeset and just filtering Changes is quite simple.

+6
source

- , . , . linq, , , :

    TeamFoundationServer tfs = new TeamFoundationServer("http://tfs:8080");
    VersionControlServer vcs = tfs.GetService<VersionControlServer>();

    Changeset cs = vcs.GetChangeset(6284868);

    foreach (Change change in cs.Changes)
    {
        if (change.Item.ServerItem.StartsWith("$/Application Common/Dev/src"))
        {
            System.Diagnostics.Debug.WriteLine(string.Format("Changeset {0}, file {1}, changes {2}",
                cs.ChangesetId, change.Item.ServerItem, change.ChangeType.ToString()));
        }
    }
+2

, - .


    TeamFoundationServer tfs = new TeamFoundationServer("http://tfs:8080");   
    VersionControlServer vcs = tfs.GetService();   
    ItemSet items;

    items = vcs.GetItems(tfsPath, RecursionType.Full);

, .

0

webservice , XML-, . , , .

URL- - :

Http://your_tfs_server/VersionControl/Changeset.aspx?artifactMoniker= your_changeset_number & Webview =

-1

All Articles