Team Foundation Server - Source Control
-
Upload
dhirendra-singh -
Category
Technology
-
view
10.095 -
download
2
description
Transcript of Team Foundation Server - Source Control
Team Foundation Server Source Control
Dhirendra SinghPrincipal Software Engineer
Zenevo Technologies
Agenda
• TFS- an Overview• Managing Branches• Merging• Code Integration
What is Team Foundation Server?
• It is the “Glue” that connects our team– What am I supposed to do?– What’s my progress?– What’s broken?
• Helps manage project artifacts– Source Control
Visual Studio Team System
How it is helping us?
• Helps our team communicate • Centralized place to manage our project• Data is captured automatically• Everyone looks at the same data• It is Customizable• Artifacts version/source control• Minimize / eliminate lost work• Reproducible builds & product state
Team Foundation Server
Team Foundation ServerVersion Control
Work Item Tracking
Reporting and BI
Team Portal
Team Build
Team Foundation ServerDev Team (Local)
Dev Team (Remote)Business User
Build Agent
Version Control Proxy
(Remote)
Active Directory
TCP/IPHTTP / S
Windows 2003 ServerSQL Server 2005IIS 6.0
Team Foundation Server
TFS Source Control: Terminology• Workspaces
– Area on local disk where you edit files• Check in / check out
– Check out marks the beginning of your edits– Check in commits your changes to the repository– TFS allows shared check out
• Changesets– Group of changes that happen when you check in– It works similarly as Label
• Shelving– Similar to check in – Changes get stored on the server – Not visible as part of the main project source tree– For the purpose of Park your changes & go ahead
• Branching– Used to manage multiple versions of a product– Helps in Release Process (Bug Fixes, Developing new features, Service Packs)
8
TFS does more than just check-in and check-out
• Branching and merging– Facilitates simultaneous development of multiple
versions of an application• Applying Labels• Cloaking• Shelve & Unshelve
What should go into source control?
• Solution files -- *.sln• Project files -- *.csproj, *.vbproj• Source Control Project Metadata (*.vspscc)
– Project bindings– Source control configuration
• Application config files (*.config)• Source files • Project Binaries dependency references (e.g.
Third Party dlls, Components)
10
What should not go in source control?
• Solution user option files (*.suo)– Local user customizations
• Project user option files (*.user)– Local user customizations
• WebInfo files (*.webinfo)• Build outputs
– /bin/debug– /bin/release– /obj
11
Client-side vs Server-side Structure• Directory structure should be the same
– Client-side structure should match server• Simplifies “Get Latest”• Everyone has the same directory layout• This doesn’t mean that everyone has to put
their source in the same place on disk– The relative paths should match– Root path of source tree can be different
12
Plan your Repository
Recommended file structure for Version Control.
Recommended File Structure
Don’t Branch... until
• You have a good reason• Life only gets more complex with branching• Favor Labels over Branches• You can always branch from a Label later
15
When to branch…The Signs…• Regular broken builds• Features in parallel development that need to edit one
another– Branch so that each feature can develop in isolation– Merge changes later
• Avoid source tree being polluted with experimental code.• Allow work on different versions of product at same time• Support maintenance releases etc• Allow parallel Development• Ask yourself if the productivity gained by the branch is
balanced against the pain (anti-productivity) of merging changes back
16
SO…IF YOU REALLY MUST BRANCH…
17
Branching Scenarios• No Branching
– Everyone works from the same code• Branch for Release
– Stabilization in order to prepare for a release• Branch for Maintenance
– Maintenance of a previous build/release– Service pack development
• Branch for Feature– Branch from the Trunk to develop a new feature (such as a new module in
isolation)– Merge back into the Trunk when feature is done
• Branch for Multiple Teams– Branches for multiple teams working on a set of features
18
Branch For Release : Process• \Main\
– Source\• \Release 1\
– Source\• \Release 2\
– Source\
19
Branch For Maintenance
• Similar to Branch For Release• \Main\
– Source\• \Maintenance\
– Release 1\•Source\
– Release 2\•Source\
20
Branch For Feature
• Branching for development isolation
• \Main\– Source\
• \Development\– Feature 1\
•Source\
– Feature 2\•Source\
– Feature 3\•Source\
21
Branch For Feature: The Process
22
Branch For Teams
• \Main\– Source\
• \Development\– Team 1\
• Feature 1\– Source\
• Feature 2\– Source \
– Team 2\• Feature 1\
– Source\
• Feature 2\– Source \
23
Branching Overkill
• Minimize the number of branches• Watch out for branching problems
– Missed deadlines because the merge is too difficult, long, intricate, etc
– Releases take forever because fixes have to go through multiple layers of merge
– You’re simply spending too much time doing merges
24
Branching and Merging
Source: http://downloads.seapine.com/pub/papers/SCMBranchingModels.pdf
Demo
• Create a branch• Merge changes• Create/resolve a check-in conflict• Discussion about Baseless Merge
Some News…
• Bad news– Some features are command-line only
• Good news– There’s a lot you can do from the command-line– Scriptable
Beyond the GUI
TF.exe is your Friend
The most powerful for Team Foundation Source Control is the
command line.
TF.exe
• Command-line interface to TFS source control• 30+ sub commands
– Kind of like “net” command in Windows• Why would you want to use the command
line version?1. It’s cool2. Some things aren’t available through the UI3. Good for automated operations (builds, etc)
The Commands• Add• Branch / Branches• Changeset• Checkin / Checkout• Configure• Delete / Undelete• Dir• Get• History• Label / Labels / Unlabel• Lock• Merge / Merges
• Move• Permission• Properties• Rename• Resolve• Shelve / Unshelve• Status• Undo• View• Workfold• Workspace / Workspaces
Things you (probably) can’t do through the GUI
• Find files in TFS by name/wildcard– tf dir
• Get particular version of a file(s) by wildcard– tf get
• Find checked out / pending change files– tf status
• What will be changed by a “get latest”?– tf get /preview
• Baseless merges– tf merge /baseless
• Eliminating a changeset from a merge– tf merge /discard
And Last but not the Least…
Baby Come Back
Accessing Deleted FilesTools, Options, Source Control, Show deleted items in Source Control Explorer.Undelete file. Remember to add to solution…
Extending TFS
Use the .NET object model to extend Team Foundation Server
Check out != Get Latest
and Also
Check-in != Get Latest
Change != Bad
TFS is new and different – you folks will need time to adjust.
Best Practices- References• http://www.codeplex.com/TFSGu
ide
• Lots of great info• Free• Released Aug 2007
37
Question and Answer
Dhirendra SinghPrincipal Software EngineerZenevo Technologies Pvt. Ltd.
[email protected]@gmail.com www.zenevo.com