MohamedG's Log


VSTS 2010 and .Net 4.0 Beta 2

Beta 2 is here, give it a try and let us know what do you think. div#widget { position: relative; width: 250px; height: 155px; } body ul#cntdwn { width: 250px; height: 80px; background: transparent url( no-repeat scroll left top; list-style-type: none; text-align: center; padding: 74px 0 0 0; margin: 0; font-family: “Helvetica Neue”, helvetica, arial,… Read more

How to: Query All Labels on a Folder Recursively?

To do this, you can’t call query labels with a wildcard character, you need to do the following:   – Get all items blow $/Dir1 using GetItems – Loop through them calling QueryLabels on each one.   Here’s a code snippet: VersionControlServer sc = tfs.GetService<VersionControlServer>();List<VersionControlLabel> labels = new List<VersionControlLabel>();  foreach (Item i in sc.GetItems(“$/Proj”, RecursionType.Full).Items){   labels.AddRange(sc.QueryLabels(null, null, null, false, i.ServerItem, null));}… Read more

How to: Move a Shelveset to Another Branch?

A very handy power tool is tfpt unshelve. It’s capable of migrating a shelveset from a branch to another, it does that by performing a baseless merge, so you will need to resolve the conflicts produced. The syntax of the command looks like the following: tfpt unshelve shelvsetName /migrate /source:$/SourceBranch /target:$/TargetBranch… Read more

How to: Receive Daily E-mail Notifications?

You can receive a daily email that has a compiled list of notifications, but you will need to subscribe programmatically:   IEventServiceeventService = (IEventService)new TeamFoundationServer(“http://tfs:8080”).GetService(typeof(IEventService)); string filter = “‘Artifacts/Artifact[starts-with(translate(@ServerItem,\”ABCDEFGHIJKLMNOPQRSTUVWXYZ\”,\”abcdefghijklmnopqrstuvwxyz\”),\”$/TeamProject/Folder\”)]’ <> null AND \”Committer\”<> ‘DOMAIN\\YourUserName’”; DeliveryPreference dp = new DeliveryPreference{    Address = “”,    Schedule = DeliverySchedule.Daily,};  eventService.SubscribeEvent(@”DOMAIN\userName”, “CheckinEvent”, filter, dp);    … Read more

How to: Diff Shelved Files?

You can run: tf diff /shelveset:shelvesetName;DOMAIN\ownerUserName Please note that this will diff the shelved changes against the unmodified version, not necessarily the latest version, just like what the you get from clicking compare in the shelveset details dialog. If you want to diff the shelved files programmatically against the latest version, you will need to… Read more

How to: List Changesets Between Two Labeled Versions?

You can achieve that behavior by running: tf hist rootItemSpec /r /version:LstartLabel~LendLabel Here’s my scenario: tf hist /i File.cs Changeset Change                     User          Date       Comment ——— ————————– ————- ———- ——– 65        edit                       mohamedg      4/2/2009 63        edit                       mohamedg      4/2/2009 60        edit                       mohamedg      4/2/2009 59        edit                       mohamedg      4/2/2009 50        edit                       mohamedg      4/1/2009 49        edit                       mohamedg      4/1/2009 48        edit                       mohamedg     … Read more

How to: View History of an Item Across Branches?

You can use tfpt history /followbranches to follow the history of an item across branches. We are looking into supporting this in the history dialog in the next version. You can see which versions are ported over during the merge operation if you use tf.exe: tf merge BranchA BranchB /r merge: $/mohamedg/blog/BranchA/File.cs;C663~C664 -> $/mohamedg/blog/BranchB/File.cs;C665 After… Read more

How to: Force a Check-in to be Linked to Work Items?

Well, the answer to this one is pretty easy and straight-forward. You can accomplish that using a check-in policy. For example, to force users to link check-ins to work items that are not closed, you may do the following: Add a Team Query to the desired project, call it “Not Closed” and specify the condition… Read more

How to: Change TFS Temp Folder?

TFS uses a temp folder to get files that you view. The location of that folder is %TMP%\TFSTemp. It’s not configurable via TFS, tf.exe, or Visual Studio. However, you can just set the TMP environment variable. Simply: set TMP=D:\Temp set TEMP=%TMP% md %TMP% Then you can starting using tf.exe afterwards and it will use the… Read more