Tuesday, 30 September 2014

How to convert all child branches to folders via command-line in TFS (Team Foundation Server)



Currently, tfs branch /checkin does not automatically convert the folder to branch. However, if the source of the folder branched was already a branch the created folder will automatically be a branch as well and no conversion would be required.

The Sept TFS Power tools found here : 
http://visualstudiogallery.msdn.microsoft.com/en-us/c255a1e4-04ba-4f68-8f4e-cd473d6b971f has the tfpt commandline that has "branches" command that allows you to achieve that :

tfpt branches - Convert, reparent, list, and update branches



Usage: tfpt branches [/collection:uri] [folderspec]

                        - Displays information about the specified branch

       tfpt branches /listBranches:roots [/collection:uri]

                        - Lists all root branches

       tfpt branches /listBranches:children,related,ancestors [/collection:uri] [folderspec]

                        - Lists the child, related, and/or ancestor branches for the specified branch

       tfpt branches /convertToBranch [/collection:uri] [/description:text] [/owner:name] [/recursive] [folderspec]

                        - Converts the specified folder to a branch

       tfpt branches /convertToFolder [/collection:uri] [folderspec]

                        - Converts the specified branch back to a normal folder

       tfpt branches /reparent folderspec parentfolderspec [/collection:uri]

                        - Reparents the specified branch to the specified parent branch

       tfpt branches /update [/collection:uri] [/description:text] [/owner:name] [folderspec]

                        - Updates the description and/or owner of the specified branch

       tfpt branches /properties [/collection:uri] [folderspec]

                        - Displays and edits branch properties in a GUI



 uri               Specifies the URI of the team project collection.

 folderspec        Server or local path of the root folder of a branch.

                   If not specified, the current local folder is used.

 parentfolderspec  Server or local path of the root folder of the new parent branch



More information about power tools in Brain's post: 
http://blogs.msdn.com/b/bharry/archive/2010/09/09/sept-2010-tfs-power-tools-release-available.aspx

No comments:

Post a Comment