340 likes | 868 Views
The Busy Developer’s Guide to Team Foundation Server 2010 Version Control. Brian A. Randell Senior Consultant MCW Technologies brianr@mcwtech.com | @ brianrandell | mcwtech.com/blogs/ brianr /. Version Control. Core component of Team Foundation Server (TFS)
E N D
The Busy Developer’s Guide to Team Foundation Server 2010 Version Control Brian A. Randell Senior Consultant MCW Technologies brianr@mcwtech.com | @brianrandell | mcwtech.com/blogs/brianr/
Version Control • Core component of Team Foundation Server (TFS) • #1 reason why teams move from Visual SourceSafe to TFS • TFS Version Control will store any type of file • Files as large as 64 GB tested by Microsoft • Other terms used • Source Code Control • Revision Control
Core Version Control Clients • Windows, OS/X, and Linux clients • Primary Windows Client is Team Explorer in Visual Studio • Team Explorer Everywhere provides Eclipse Integration and non-Windows platform support • TF—Command-line available on supported OSes
Team Explorer • Runs as Visual Studio Package • Requires devenv.exe shell to run • Exposes Source Control Explorer window
Other Clients • TFPT.EXE—Power Tool command line tool in Windows • Windows Shell Integration—also a Power Tool • Team Web Access—Read-only view from supported browsers • MSSCCI Provider—legacy client support on Windows • .NET API for custom clients
Server • Team Foundation Server 2010 • Supports workgroup and domain mode security • Windows File System style ACL security • New logical model • A server has one or more Team Project Collections (TPC) • A Team Project Collection has one or more Team Project • Version Control factored by Team Project • Similar in concept to a repository in other products
Workspace • A workspace stores a mapping between an endpoint in the version control repository and a location on your client workstation • A workspace is identified by • Its name • The client computer on which it is created • The user account who created the workspace • You can have multiple workspaces on a client workstation • tf.exe workspace to edit | tf.exe workspaces to list
Add • Put a file under version control for the first time • Creates a pending change • tf.exe add from the command-line • Can also use drag and drop from file system to SCC Explorer
Pending Change • Modifications to a file that exist in your workspace but have NOT been committed to version control • Includes files being added • Can be committed via Check-In • Changes can be reversed via Undo Pending Changes • tf.exe status to view pending changes
Check-In • Commits changes to repository • Optionally • Provide comments • Link work items • Add check-in notes • Supports policy enforcement to require above items • tf.exe checkin from the prompt
View History • Every time you commit a file a new version is created • TFS is a “time machine” that lets you go back and see all the changes made to an item • You can view the history for a single file or a whole group • tf.exe history opens dialog
Changeset • All check-in operations are atomic • A changeset represents a unique point in time in the version control repository and has TPC-level unique ID • Check-in operations can encompass multiple operations • Check-in of source code • Check-in related meta-data (comment, user, date/time, etc.) • Associate work items • Add check-in notes • Validate check-in policy
Checkout • Default for most source files is shared checkout • Reduces contention for files • In the 2008 release, get latest on check-out added as team project level option—is this a good thing? • Auto-merge handles most changes where users are working on discreet areas—is this a good thing? • Three-way visual merge lets the “human” decide when auto-merge isn’t possible or when auto-merged shouldn’t be used • Can perform exclusive check-out when necessary
Checkout lock types • TFS support three types of locks for a check out • None—Allow shared checkout • Check Out—Prevent others from checking out and checking in • Check-In—Allow others users to check out but prevent them from checking in (the anti-social lock)
Compare • Can compare contents of files across time • Can compare structure of source tree • Server to local path • Local to local path • Server to server path • Can control point in time • tf.exe folderdiff from command-line
Label • Let’s you tag or snapshot an item or set of items in the repository so you can at a later time get those items back from that point in time • Can be secured • Cannot be audited • TFS does not retain a history of changes made to the label
Get • Request items from TFS be copied down to a workspace • Get Latest • Get Specific Version
Conflict Resolution • Concurrent development without exclusive locks is good • However, possible to have conflicts • TFS 2010 provides new Merge item in channel • tf.exe resolve to start process from command-line • Let’s review from earlier • In the 2008 release, get latest on check-out added as team project level option—is this a good thing? NO • Auto-merge handles most changes where users are working on discreet areas—is this a good thing? NO • Three-way visual merge lets the “human” decide when auto-merge isn’t possible or when auto-merged shouldn’t be used
Shelving • Shelving allows you a way to save changes to the server, without checking in • It provides for interrupted workflow • It provides for team review • It provides easy transfer of work between workstations • For example: home to work
Cloak • Hides a section of your repository from your workspace • Reduces workspace clutter • Reduces download time during get operations
Rollback • Rolls back the effects of one or more changesets to one or more version-controlled items • Does not remove the changesets from an item's history • Creates pending changes in your workspace that negate the effects of the changesets that you specify • In 2008, part of Power Tools • In 2010, built-in BUT only at command-line • tf.exe rollback
Working Offline • TFS is a centralized version control system • Version control operations require access to server • Can work offline from Visual Studio • Open solution under version control; will be prompted to work offline • When access to server is back, tell VS to back online
Policy • Client supports policy validation • Guides developer to on team standards for check-in • Policy controlled on per Team Project basis • Four built-in policies, more in Power Tools • Can write your own policy assemblies http://msdn.microsoft.com/en-us/magazine/cc163320.aspx→
Gated Check-in • No more build breaks with Gated Check-in • Guarantees no code ever gets in that doesn’t meet at least some “Done” criteria • Uses shelving to run private build • Reconcile workspace if build is a success • Fix code if build fails—nothing checked in in this case
Tips • Configure path structure right away • Configure security • Consider common workspace structure • Always manage workspace via tools—no Windows Explorer! • Get latest before check-in; watch auto-merge • Ensure Visual Studio bindings are correct • Install the Power Tools (lots of yummy goodness) • Consider removing resolve option from your work items
Reference Links • MSDN Library Version Control Documentation • http://msdn.microsoft.com/en-us/library/ms181368.aspx • TFS 2010 September Power Tools • http://visualstudiogallery.msdn.microsoft.com/en-us/c255a1e4-04ba-4f68-8f4e-cd473d6b971f • TF.EXE: List of Commands • http://msdn.microsoft.com/en-us/library/z51z7zy0.aspx • Operations Available Only From the Command-Line • http://msdn.microsoft.com/en-us/library/ms194957.aspx
Session Evaluations Tell us what you think, and you could win! All evaluations submitted are automatically entered into a daily prize draw* Sign-in to the Schedule Builder at http://europe.msteched.com/topic/list/ * Details of prize draw rules can be obtained from the Information Desk.
© 2010 Microsoft Corporation. All rights reserved. Microsoft, Windows, Windows Vista and other product names are or may be registered trademarks and/or trademarks in the U.S. and/or other countries. The information herein is for informational purposes only and represents the current view of Microsoft Corporation as of the date of this presentation. Because Microsoft must respond to changing market conditions, it should not be interpreted to be a commitment on the part of Microsoft, and Microsoft cannot guarantee the accuracy of any information provided after the date of this presentation. MICROSOFT MAKES NO WARRANTIES, EXPRESS, IMPLIED OR STATUTORY, AS TO THE INFORMATION IN THIS PRESENTATION.