<

Go Premium for a chance to win a PS4. Enter to Win

x

Script for periodical get latest

Published on
11,056 Points
5,056 Views
Last Modified:
When working in a large software development team, whether you have many developers working on the same projects, or your project is linked to other projects; it is very important that developers regularly perform "get latest" to ensure that the changes applied by their team mates are included in their workspace.

Although Team Foundation Server 2008 & Visual studio 2008 offer a feature to get latest on checkout, sometimes in larger development teams, there is a need to always ensure the workspaces are most updated all the time.

The below solution helped achieve this within our team, since you can not always rely on the developers' memory / discipline to perform get latest manually.

-Create a new text document with the below text

@echo off
CD D:\Development_applications
"%PROGRAMFILES%\Microsoft Visual Studio 9.0\Common7\IDE\TF.exe" get
Exit

Where D:\development applications is your workspace folder , change it to your actual workspace.

Save the file as GET.bat in the root of your C drive or wherever you wish.
Open Command Prompt (CMD).
Type the below command.

Schtasks /Create /SC Onidle /I 5 /TN GET /TR C:\get.bat

Enter your Domain account password when prompted into CMD window.

This will create a scheduled task that runs when the computer is idle for 5 minutes (not in use). This will enforce get latest from Team foundation server source control and ensure your workspace is always updated.

You can also edit the scheduled task directly from Control Panel > Scheduled tasks later on to schedule it on different times that suit your schedule (at night , on login / log off ,etc..).

Another thing to consider is to regularly update the password in the scheduled task whenever your domain password changes. This is necessary to avoid running this scheduled task with a wrong Password, which may cause your Domain account to get locked out.

Hope this helps you as much as it helped me .
0
Comment
  • 3
5 Comments
 

Expert Comment

by:timhoustontx
typically, i find it is better to only update source code when i am ready...if i am in the middle of writing or running a unit test and the source code gets changed without my knowledge, it will be very confusing.
0
 
LVL 23

Author Comment

by:Mohamed Osama
If the source code did get change, most likely your unit test will be obsolete or break after check-in , or if it was a piece of code you were working on , not having latest version may cause build breaks or inconsistencies after you check-in.

Also the above example will prompt you in case of any conflicts between your workspace version & the server version, it can be suppressed by accepting a particular version in the command parameters, but I think it is best to leave the option to the developer to resolve such conflicts.
0
 
LVL 40

Expert Comment

by:evilrix
>> If the source code did get change, most likely your unit test will be obsolete or break after check-in
IMOa better solution is to always update just prior to a check in and ensure all code still builds and all unit tests still run. Then, have all code get checked in via a integration server, which will clean build code with ONLY your change, run all unit tests and only commit to the source control system if it passes. If it fails reject it.

Arbitrary updates when you're in the middle of working on things are only likely to cause more problems than they solve. I would, certainly, not subscribe to or recommend this as a practice.
0
 
LVL 23

Author Comment

by:Mohamed Osama
The solution is not probably for everyone, the part of the schedule is just an example, you can set it to be on computer startup, user log-in or at a particular time.

Development environments differ, what does not suit your team, hits the spot for another.

I am also well aware that developers' discipline is quite different from the SCM, developers prefer to have everything customizable and left to their own judgment.

SCM is more inclined towards automation,avoiding unneeded problems like (human error, build breaks, code instability,release delays , etc..), especially if you work on delivering mission critical systems where delays or errors are not acceptable.
0
 
LVL 23

Author Comment

by:Mohamed Osama
Another very good use for this script came when configuring a Team foundation proxy server for developers to work on at a remote location
Works like a charm.
0

Featured Post

Free Tool: SSL Checker

Scans your site and returns information about your SSL implementation and certificate. Helpful for debugging and validating your SSL configuration.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Join & Write a Comment

Video by: ITPro.TV
In this episode Don builds upon the troubleshooting techniques by demonstrating how to properly monitor a vSphere deployment to detect problems before they occur. He begins the show using tools found within the vSphere suite as ends the show demonst…
In response to a need for security and privacy, and to continue fostering an environment members can turn to for support, solutions, and education, Experts Exchange has created anonymous question capabilities. This new feature is available to our Pr…

Keep in touch with Experts Exchange

Tech news and trends delivered to your inbox every month