SlideShare a Scribd company logo
Team Foundation Server Source ControlDhirendra SinghPrincipal Software EngineerZenevo Technologies
AgendaTFS- an OverviewManaging BranchesMergingCode Integration
What is Team Foundation Server?It is the “Glue” that connects our teamWhat am I supposed to do?What’s my progress?What’s broken?Helps manage project artifactsSource Control
Visual Studio Team System
How it is helping us?Helps our team communicate Centralized place to manage our projectData is captured automaticallyEveryone looks at the same dataIt is CustomizableArtifacts version/source controlMinimize / eliminate lost workReproducible builds & product state
Team Foundation ServerTeam Foundation ServerVersion ControlReporting and BITeam BuildWork Item TrackingTeam Portal
Team Foundation ServerDev Team (Remote)Dev Team  (Local)Build AgentWindows 2003 ServerSQL Server 2005IIS 6.0Business UserVersion Control Proxy (Remote)Active DirectoryHTTP / STCP/IPTeam Foundation Server
TFS Source Control: TerminologyWorkspacesArea on local disk where you edit filesCheck in / check outCheck out marks the beginning of your editsCheck in commits your changes to the repositoryTFS allows shared check outChangesetsGroup of changes that happen when you check inIt works similarly as LabelShelvingSimilar to check in Changes get stored on the server Not visible as part of the main project source treeFor the purpose of Park your changes & go aheadBranchingUsed to manage multiple versions of a productHelps in Release Process (Bug Fixes, Developing new features, Service Packs)8
TFS does more than just check-in and check-outBranching and mergingFacilitates simultaneous development of multiple versions of an applicationApplying LabelsCloakingShelve & Unshelve
What should go into source control?Solution files -- *.slnProject files -- *.csproj, *.vbprojSource Control Project Metadata (*.vspscc)Project bindingsSource control configurationApplication config files (*.config)Source files Project Binaries dependency references (e.g. Third Party dlls, Components)10
What shouldnot go in source control?Solution user option files (*.suo)Local user customizationsProject user option files (*.user)Local user customizationsWebInfo files (*.webinfo)Build outputs/bin/debug/bin/release/obj11
Client-side vs Server-side StructureDirectory structure should be the sameClient-side structure should match serverSimplifies “Get Latest”Everyone has the same directory layoutThis doesn’t mean that everyone has to put their source in the same place on diskThe relative paths should matchRoot path of source tree can be different12
Plan your RepositoryRecommended file structure for Version Control.
Recommended File Structure
Don’t Branch... untilYou have a good reasonLife only gets more complex with branchingFavor Labels over BranchesYou can always branch from a Label later15
When to branch…The Signs…Regular broken buildsFeatures in parallel development that need to edit one anotherBranch so that each feature can develop in isolationMerge changes laterAvoid source tree being polluted with experimental code. Allow work on different versions of product at same time Support maintenance releases etc Allow parallel DevelopmentAsk yourself if the productivity gained by the branch is balanced against the pain (anti-productivity) of merging changes back16
SO…IF YOU REALLY MUST BRANCH…17
Branching ScenariosNo BranchingEveryone works from the same codeBranch for ReleaseStabilization in order to prepare for a releaseBranch for MaintenanceMaintenance of a previous build/releaseService pack developmentBranch for FeatureBranch from the Trunk to develop a new feature (such as a new module in isolation)Merge back into the Trunk when feature is doneBranch for  Multiple TeamsBranches for multiple teams working on a set of features18
Branch For Release : Processainbr />Sourcebr />elease 1br />Sourcebr />elease 2br />Sourcebr />19
Branch For MaintenanceSimilar to Branch For Releaseainbr />Sourcebr />aintenancebr />Release 1br />Sourcebr />Release 2br />Sourcebr />20
Branch For FeatureBranching for development isolationainbr />Sourcebr />evelopmentbr />Feature 1br />Sourcebr />Feature 2br />Sourcebr />Feature 3br />Sourcebr />21
Branch For Feature: The Process22
Branch For Teamsainbr />Sourcebr />evelopmentbr />Team 1br />Feature 1br />Sourcebr />Feature 2br />Source br />Team 2br />Feature 1br />Sourcebr />Feature 2br />Source br />23
Branching OverkillMinimize the number of branchesWatch out for branching problemsMissed deadlines because the merge is too difficult, long, intricate, etcReleases take forever because fixes have to go through multiple layers of mergeYou’re simply spending too much time doing merges24
Branching and MergingSource: http://downloads.seapine.com/pub/papers/SCMBranchingModels.pdf
DemoCreate a branchMerge changesCreate/resolve a check-in conflictDiscussion about Baseless Merge
Some News…Bad newsSome features are command-line onlyGood newsThere’s a lot you can do from the command-lineScriptable
Beyond the GUITF.exe is your FriendThe most powerful for Team Foundation Source Control is the command line.
 TF.exeCommand-line interface to TFS source control30+ sub commandsKind of like “net” command in WindowsWhy would you want to use the command line version?It’s coolSome things aren’t available through the UIGood for automated operations (builds, etc)
The CommandsAddBranch / BranchesChangesetCheckin / CheckoutConfigureDelete / UndeleteDirGetHistoryLabel / Labels / UnlabelLockMerge / MergesMovePermissionPropertiesRenameResolveShelve / UnshelveStatusUndoViewWorkfoldWorkspace / Workspaces
Things you (probably) can’t do through the GUI Find files in TFS by name/wildcardtf dirGet particular version of a file(s) by wildcardtf getFind checked out / pending change filestf statusWhat will be changed by a “get latest”?tf get /previewBaseless mergestf merge /baselessEliminating a changeset from a mergetf merge /discard
And Last but not the Least…
Baby Come BackAccessing Deleted FilesTools, Options, Source Control, Show deleted items in Source Control Explorer.Undelete file.  Remember to add to solution…
Extending TFSUse the .NET object model to extend Team Foundation Server
Check out != Get Latestand AlsoCheck-in != Get Latest
Change != BadTFS is new and different – you folks will need time to adjust.
Best Practices- Referenceshttp://www.codeplex.com/TFSGuideLots of great infoFreeReleased Aug 200737
Question and AnswerDhirendra SinghPrincipal Software EngineerZenevo Technologies Pvt. Ltd.dheerendra.singh@zenevo.comSingh.dheerendra@gmail.comwww.zenevo.com

More Related Content

Team Foundation Server - Source Control

  • 1. Team Foundation Server Source ControlDhirendra SinghPrincipal Software EngineerZenevo Technologies
  • 2. AgendaTFS- an OverviewManaging BranchesMergingCode Integration
  • 3. What is Team Foundation Server?It is the “Glue” that connects our teamWhat am I supposed to do?What’s my progress?What’s broken?Helps manage project artifactsSource Control
  • 5. How it is helping us?Helps our team communicate Centralized place to manage our projectData is captured automaticallyEveryone looks at the same dataIt is CustomizableArtifacts version/source controlMinimize / eliminate lost workReproducible builds & product state
  • 6. Team Foundation ServerTeam Foundation ServerVersion ControlReporting and BITeam BuildWork Item TrackingTeam Portal
  • 7. Team Foundation ServerDev Team (Remote)Dev Team (Local)Build AgentWindows 2003 ServerSQL Server 2005IIS 6.0Business UserVersion Control Proxy (Remote)Active DirectoryHTTP / STCP/IPTeam Foundation Server
  • 8. TFS Source Control: TerminologyWorkspacesArea on local disk where you edit filesCheck in / check outCheck out marks the beginning of your editsCheck in commits your changes to the repositoryTFS allows shared check outChangesetsGroup of changes that happen when you check inIt works similarly as LabelShelvingSimilar to check in Changes get stored on the server Not visible as part of the main project source treeFor the purpose of Park your changes & go aheadBranchingUsed to manage multiple versions of a productHelps in Release Process (Bug Fixes, Developing new features, Service Packs)8
  • 9. TFS does more than just check-in and check-outBranching and mergingFacilitates simultaneous development of multiple versions of an applicationApplying LabelsCloakingShelve & Unshelve
  • 10. What should go into source control?Solution files -- *.slnProject files -- *.csproj, *.vbprojSource Control Project Metadata (*.vspscc)Project bindingsSource control configurationApplication config files (*.config)Source files Project Binaries dependency references (e.g. Third Party dlls, Components)10
  • 11. What shouldnot go in source control?Solution user option files (*.suo)Local user customizationsProject user option files (*.user)Local user customizationsWebInfo files (*.webinfo)Build outputs/bin/debug/bin/release/obj11
  • 12. Client-side vs Server-side StructureDirectory structure should be the sameClient-side structure should match serverSimplifies “Get Latest”Everyone has the same directory layoutThis doesn’t mean that everyone has to put their source in the same place on diskThe relative paths should matchRoot path of source tree can be different12
  • 13. Plan your RepositoryRecommended file structure for Version Control.
  • 15. Don’t Branch... untilYou have a good reasonLife only gets more complex with branchingFavor Labels over BranchesYou can always branch from a Label later15
  • 16. When to branch…The Signs…Regular broken buildsFeatures in parallel development that need to edit one anotherBranch so that each feature can develop in isolationMerge changes laterAvoid source tree being polluted with experimental code. Allow work on different versions of product at same time Support maintenance releases etc Allow parallel DevelopmentAsk yourself if the productivity gained by the branch is balanced against the pain (anti-productivity) of merging changes back16
  • 17. SO…IF YOU REALLY MUST BRANCH…17
  • 18. Branching ScenariosNo BranchingEveryone works from the same codeBranch for ReleaseStabilization in order to prepare for a releaseBranch for MaintenanceMaintenance of a previous build/releaseService pack developmentBranch for FeatureBranch from the Trunk to develop a new feature (such as a new module in isolation)Merge back into the Trunk when feature is doneBranch for Multiple TeamsBranches for multiple teams working on a set of features18
  • 19. Branch For Release : Processainbr />Sourcebr />elease 1br />Sourcebr />elease 2br />Sourcebr />19
  • 20. Branch For MaintenanceSimilar to Branch For Releaseainbr />Sourcebr />aintenancebr />Release 1br />Sourcebr />Release 2br />Sourcebr />20
  • 21. Branch For FeatureBranching for development isolationainbr />Sourcebr />evelopmentbr />Feature 1br />Sourcebr />Feature 2br />Sourcebr />Feature 3br />Sourcebr />21
  • 22. Branch For Feature: The Process22
  • 23. Branch For Teamsainbr />Sourcebr />evelopmentbr />Team 1br />Feature 1br />Sourcebr />Feature 2br />Source br />Team 2br />Feature 1br />Sourcebr />Feature 2br />Source br />23
  • 24. Branching OverkillMinimize the number of branchesWatch out for branching problemsMissed deadlines because the merge is too difficult, long, intricate, etcReleases take forever because fixes have to go through multiple layers of mergeYou’re simply spending too much time doing merges24
  • 25. Branching and MergingSource: http://downloads.seapine.com/pub/papers/SCMBranchingModels.pdf
  • 26. DemoCreate a branchMerge changesCreate/resolve a check-in conflictDiscussion about Baseless Merge
  • 27. Some News…Bad newsSome features are command-line onlyGood newsThere’s a lot you can do from the command-lineScriptable
  • 28. Beyond the GUITF.exe is your FriendThe most powerful for Team Foundation Source Control is the command line.
  • 29. TF.exeCommand-line interface to TFS source control30+ sub commandsKind of like “net” command in WindowsWhy would you want to use the command line version?It’s coolSome things aren’t available through the UIGood for automated operations (builds, etc)
  • 30. The CommandsAddBranch / BranchesChangesetCheckin / CheckoutConfigureDelete / UndeleteDirGetHistoryLabel / Labels / UnlabelLockMerge / MergesMovePermissionPropertiesRenameResolveShelve / UnshelveStatusUndoViewWorkfoldWorkspace / Workspaces
  • 31. Things you (probably) can’t do through the GUI Find files in TFS by name/wildcardtf dirGet particular version of a file(s) by wildcardtf getFind checked out / pending change filestf statusWhat will be changed by a “get latest”?tf get /previewBaseless mergestf merge /baselessEliminating a changeset from a mergetf merge /discard
  • 32. And Last but not the Least…
  • 33. Baby Come BackAccessing Deleted FilesTools, Options, Source Control, Show deleted items in Source Control Explorer.Undelete file. Remember to add to solution…
  • 34. Extending TFSUse the .NET object model to extend Team Foundation Server
  • 35. Check out != Get Latestand AlsoCheck-in != Get Latest
  • 36. Change != BadTFS is new and different – you folks will need time to adjust.
  • 38. Question and AnswerDhirendra SinghPrincipal Software EngineerZenevo Technologies Pvt. Ltd.dheerendra.singh@zenevo.comSingh.dheerendra@gmail.comwww.zenevo.com