Search code examples
tfstfvctfs-2012

How to determine folder vs branch with tf command?


I have this example where FolderA had sub FolderB and they were both folders, until I branched FolderB to FolderB-branch. Then both sub folder turned into branches.

enter image description here

How can I use tf command to determine what is folder and what is branch?

tf dir /r and tf dir /r /folders show the same info.

How can I use tf command to distinguish what is what?

TFS 11, Visual Studio 2012.


Solution

  • There is a way do this, using tf branches command. When using it, TFS returns 2 responses:

    when item is a Folder:

    Item FolderA is not used in any branch view
    

    when item is a Branch, it lists branch tree, like:

    ../FolderB
    >>  ../FolderB-branch
    

    Now we can parse the output and assign if item is a Folder or a Branch.

    Of course, the command tf branches need to be run in parent folder or with full parameters like /collection and others, if required.