PowerShell script to automatically clone/update all repos in Kiln

PowerShell Script files

Download the files here.

Change and replace the following url

Change https://your fogbugz root url to be your root url for fogbugz. For example, if your companies fogbugz url is something like https://secure.bbc.com/FogBugz/default.asp, then your root url will be https://secure.bbc.com

Obtaining a Kiln Token

The first thing you need to do before you can use this script is to obtain a Kiln token. Copy and alter the following link in your browsers URL https://your fogbugz root url/FogBugz/api.asp?cmd=logon&email=[yourEmail]&password=[yourpassword]
Changing the text in square brackets (and also removing the brackets).
You should receive something like this:
ymjt123f8882a6s7td0j8eefa6u2g8
Take the token text: ymjt123f8882a6s7td0j8eefa6u2g8 and paste it into the powerShell script (edit your local copy instead of the SVN one)
token placement

Running the script

Start PowerShell and run the script passing in the root path of your Kiln repos.
example

Will it clone everything?

It could, including branches, but by default I've set it not to clone QA/PROD/UAT repos, or branches.

How to clone branches

Remove this to clone branches

How to clone QA/PROD/UAT repos

Modify the function CanCloneRepo() which is used to filter out repos you may not want.
If you want all repos, simply return 1; from this function.
Cloning QA/UAT/PROD

This script will also remove repository folders from your drive where the repo no longer exists in Kiln!

This prevents orphaned code on your drive. However, if you don't want this functionality, simply remove the following code situated at right the bottom of the script:
remove folders
By leaving the above code in, your repository folder structures will be standardised to how its organised in Kiln. I've tested it and it works. Have faith ;-)

Thanks to

Robin Minto for providing the template of the powershell script.

Popular posts from this blog

Execution of user code in the .NET Framework is disabled

Service Broker sys.transmission_queue clean up

What do I use to write software?