Showing posts with label TFS. Show all posts
Showing posts with label TFS. Show all posts

Wednesday, September 17, 2008

Get List of File Associated with multiple Changesets

I wrote a cmdlet for powershell by which you can get list of file associated with list of changesets.
param(
[string] $changesets = $(throw 'Usage: Get-Changeset-Files 'changesets')
)

process
{
# get TFS object
$tfs = get-tfs ;

# build up list of file items
$fileItems = @();

$changesets.Split(',') | foreach {
$tfs.vcs.GetChangeset($_).Changes | foreach {
if($fileItems -notcontains $_.Item.ServerItem) {
$fileItems += $_.Item.ServerItem;
}
}
}
return $fileItems | Sort-Object;
}


Steps:
1. Create a file Get-Changeset-Files.ps1 and copy above code in the file (preferably where get-tfs resides). Also add this directory into your $path
2. Open Powershell, go to Directory where above file recides
3. Run 'Set-ExecutionPolicy unrestricted' so that you can run above cmdlet
4. Everything is ready.. just run for example: Get-Changeset-Files('10, 20, 30')

See here for get-tfs.ps1

Tuesday, September 16, 2008

Idiotic Software (TFS)

User Experience is where Microsoft TFS loses the ground. Here was a day when I struggled to merge around 30 changesets across branches. The user interface doesn't have any filter by which I can see only my changeset (out of 40 membered team's chagesets from the day we separated the branch). I cannot merge multiple changeset at once untill the are in sequence (no CTRL + select). It seems Team Foundation Server assumes the team is made of 1 person.

Thursday, August 14, 2008

Change-Set Rollback using TFS Power Tool (tfpt.exe)

Have you made a booboo by checking in something which you shouldn’t have? If you are using TFS and TFS Power Tools (tfpt in short) installed on your system, you are still good to roll the s#%t back.
Here are the steps that you will need to follow:
1. Install TFS Power Tool. This is recommended as it provides a lot of goodies without which you may see hell some day.

2. ‘Shelve’ all changes, as you will have to ‘undo’ all your changes.

3. Open cmd prompt. Make sure your $path environment variable is configured to find tfpt.exe

4. Change directory to the workspace

5. Give this command: rollback /changeset:{Change-Set Number}
(For example rollback /changeset:39356)

6. It will take latest of all your workspace. This is what I don’t like as it doesn’t work otherwise. It takes some but works…

7. After above step, tfpt has taken older version and all those file will be ready to be check-in with older viersion.. Check-in those and take a tea.

Tip [02/24/2009]: Step 6 may kill you if you are storing huge amount of data into TFS. I advice you to create a new workspace with only required files downloaded. For Example, if your all changes are in '$codebase/folder/subfolder/" then create workspace for $codebase/folder/subfolder/ mapped to local directory C:\for_rollback\ Due to this, step 6 will become very fast.

Powertool help and website: http://msdn.microsoft.com/en-us/tfs2008/bb980963.aspx

Thursday, August 07, 2008

TFS Command Line

I do this get list of files of any shelveset into a text file:
Here is list of commands that you can use: http://blogs.msdn.com/buckh/articles/CommandLineSummary.aspx