Upload
giancarlo-molina
View
229
Download
0
Embed Size (px)
Citation preview
8/6/2019 VSTS MN - 2007-08 - TFS Enterprise Source Control
1/34
Enterprise Source Control
Jeff Mutschler Senior Consultant - Microsoft Consulting ServicesMike Abrahamson Senior Consultant - Microsoft Consulting Services
8/6/2019 VSTS MN - 2007-08 - TFS Enterprise Source Control
2/34
Objectives
Understand the primary concepts of TFS sourcecontrol
Establish a source control model with effective use of
Workspaces Shelving
Check in policies
Branching / merging
Know the common issues when moving from VSS
8/6/2019 VSTS MN - 2007-08 - TFS Enterprise Source Control
3/34
Agenda
n
Team Foundation source control featuresn Source control concepts overview
n Source control deep dive
n Check in policy
n Branching / Merging
n Distributed development
n Moving from VSS
8/6/2019 VSTS MN - 2007-08 - TFS Enterprise Source Control
4/34
TFS Source Control Overview
n Built new from the ground upn 3-tier ASP.NET web servicen SQL Server 2005 data store
Totally NewVersion Control
System
Lots of NewFeatures
Built for theEnterprise
n Integrated checkinn Shelvingn Source Control Explorern More
n Support for distributed teamsn Secure, Reliable, Scalablen Future tool for Microsoft
8/6/2019 VSTS MN - 2007-08 - TFS Enterprise Source Control
5/34
TFS Source Control Features
Atomic Checkin
Work Item Integration
Checkin Policies
Shelving
Delta File Storage
Delta Binary File Storage
Large File Support (>4GB)
Distributed Team Support
Yes No
8/6/2019 VSTS MN - 2007-08 - TFS Enterprise Source Control
6/34
TFS Source Control Features
E-mail Checkin Notification
Non-Windows Support
Diff Tool ExtensibilityShared Checkout
VS 2003 Integration
Keyword ExpansionPinning & Sharing
Shadow Folders
Yes No
8/6/2019 VSTS MN - 2007-08 - TFS Enterprise Source Control
7/34
Source Safe Comparison
Features in TFS but not in SS
Workspaces
Changesets
Shelving
TFS Work ItemsCheck-in policy
Builds
Reporting
Process Management (CMMI, Agile)
8/6/2019 VSTS MN - 2007-08 - TFS Enterprise Source Control
8/34
Source Safe Comparison
Features in SS but not in TFS
Share (TFS branching preferred)
Pin (replaced by TFS shelving)
Archive/Restore (TFS uses standard SQL Server backup andrestores)
Destroy
Keyword expansion
8/6/2019 VSTS MN - 2007-08 - TFS Enterprise Source Control
9/34
Source Control Concept Overview
WorkspacesCheck in and Check out
Changesets
Check in policy
Shelving
Branching and merging
8/6/2019 VSTS MN - 2007-08 - TFS Enterprise Source Control
10/34
Workspaces
A workspace contains your client-side copy of thesource files on the source control server
Get Latest command synchronizes your workspace withthe latest checked in files on the server
You can create multiple workspacesYou can have multiple workspaces per Team Project
Useful when working with multiple branches of theproject
Or a test workspace for performing code reviews
8/6/2019 VSTS MN - 2007-08 - TFS Enterprise Source Control
11/34
Check In and Check Out
In TFS, check out means only make local copywritable
The latest version is NOT downloaded
By default, no lock is placed on file(s)
TFS supports 3 types of lockNone (default): allow other users to check out and checkin
Check out: prevent other users from checking out and
checking inCheck in: Allow other users to check out but prevent themfrom checking in
8/6/2019 VSTS MN - 2007-08 - TFS Enterprise Source Control
12/34
Changesets
When you check-in changes, TFS creates a changesetand associates a changeset id
The changeset contains:
File and folder revisions
Links to related work itemsCheck-in notes, policy compliance
System metadata such as owner name and date/time ofcheck in
Changesets provides advanced history capabilities
You can search changesets
You can get all files associated with a changeset
8/6/2019 VSTS MN - 2007-08 - TFS Enterprise Source Control
13/34
Check In Policy and Notes
On check in, TFS executes check in policies
Enforces development practices
Several policies types are provided
Require code analysis (aka FxCop)
Require unit test coverage Require associated work item
Also on check in, TFS can prompt you to add Notes
You can customize the info to gather in Notes
You can make Notes mandatory
8/6/2019 VSTS MN - 2007-08 - TFS Enterprise Source Control
14/34
Shelving
Shelving allows you to upload a set of pending changes
without checking inCreates a shelveset (instead of a changeset)
You or others can restore the changes in a shelveset
Purpose of shelving
You need to upload changes but not ready to check in
Better than saving to local disk - leverages TFS nightlybackup
Unlike changesets, a shelveset
Is not versioned
Can be deleted
Cannot enforce policy
8/6/2019 VSTS MN - 2007-08 - TFS Enterprise Source Control
15/34
Branching and Merging
Branching allows teams to work on two or more similar
code bases
Development versus Test versus Production
Version 1.0 versus Version 1.1
A branch is analogous to a file system copy
Source files are copied into target branch
Preserves the history
Merging applies changes in one branch to another
Promoting from development to test
Applying a version 1.0 bug fix into the 1.1 branch
8/6/2019 VSTS MN - 2007-08 - TFS Enterprise Source Control
16/34
Demo
Creating a Team Project
Establishing a workspace
Check in and check out
Working with changesets
Shelving
8/6/2019 VSTS MN - 2007-08 - TFS Enterprise Source Control
17/34
Source Control Deep Dives
Customizing policies
Branching and merging
Efficient storage
Distributed development
Moving from Source Safe
8/6/2019 VSTS MN - 2007-08 - TFS Enterprise Source Control
18/34
Customizing Check In Policies
Customizing code analysis policies
8/6/2019 VSTS MN - 2007-08 - TFS Enterprise Source Control
19/34
Check In Policy Demo
Customizing code analysis policy
Customizing test policy
8/6/2019 VSTS MN - 2007-08 - TFS Enterprise Source Control
20/34
Branching and Merging Terminology
Reverse Integration
Merging changes from a child branch into the main or parentbranch
Forward Integration
Merging changes in the main or parent branch into a child
branch
8/6/2019 VSTS MN - 2007-08 - TFS Enterprise Source Control
21/34
Branching and Merging Strategies
Release Isolation
Facilitates multiple versions in parallel
Feature Isolation
Best when lots of experimental functionality
Team IsolationGreat for large teams that do not want to constantly break each
other (Visual Studio Team for example)
Integration Isolation
Great for when integration is usually breaking, everyone comesto an integration branch where no active dev occurs
Hybrids
Examples RR Team, SDA Team, Visual Studio Team
8/6/2019 VSTS MN - 2007-08 - TFS Enterprise Source Control
22/34
TFS Branching Features
Path-space branching
Branches are depicted as paths (like directory paths)
Support for merging namespace changes
Merge handles adds, deletes, moves, renames
Changesets
Cherry-pick merges
Example: merge v3 changes to target branch but not v2changes
Merge candidate queries
Merge history queries
8/6/2019 VSTS MN - 2007-08 - TFS Enterprise Source Control
23/34
Labeling and Branching
Labels and Branching
A label a marker that you can attach selectively to a set ofotherwise unrelated files and folders to facilitate their collectiveretrieval to a workspace.
Branching allows a collection of files to evolve in two or moredivergent paths
When to use what
Use branches to create isolation
Use branches for supported releases (i.e. maintenance branch)
Use labels to tag a file or a series of files with a distinct notation(i.e. daily builds)
8/6/2019 VSTS MN - 2007-08 - TFS Enterprise Source Control
24/34
Branching Demo
Creating Branches
Merging Branches
Promoting files
8/6/2019 VSTS MN - 2007-08 - TFS Enterprise Source Control
25/34
Branching and Merging Best Practices
Plan your branching structure along merge paths
Avoid baseless merges where possible
Prefer full merges to cherry-pick merges
Merge frequently
Always create a top-level folder underneath a new teamproject to serve as a main branch
8/6/2019 VSTS MN - 2007-08 - TFS Enterprise Source Control
26/34
Branching and Merging Best Practices
More merging best practices
Prior to performing a merge use the candidate orpreviewswitch to double check your expected (command line)
When renames are part of the merge pay close attention tothe path that the tool recommends and make changes as
appropriate (all renames are marked as conflicts)Be careful when resolving merge conflicts. An/auto:AcceptMerge is handy but may not always be theright resolution
Always check-in a merge before performing another mergethat involves the affected files
Build and run tests after the merge and prior to checkin
8/6/2019 VSTS MN - 2007-08 - TFS Enterprise Source Control
27/34
Baseless Merge
A baseless merge is the process of merging items that
arent directly branched from each other
Only works via command line
Syntax: > tf merge /baseless shared-source shared-target
Baseless merge records history and establishes a
relationship between the folders/files
You can use it for branch re-parenting
8/6/2019 VSTS MN - 2007-08 - TFS Enterprise Source Control
28/34
Efficient File Storage
9 11
12 15
17 17The Deltafier
File Cache
File Store
Down
loa
d
Han
dle
r
Up
loa
d
H
andle
r
Compression + Delta Storage 70% Space Savings!
Get foo.bmp;12
9 12 15 12
Commitfoo.bmp bar.vb
8/6/2019 VSTS MN - 2007-08 - TFS Enterprise Source Control
29/34
Distributed Development
Designed for the Internet
Web-based protocols: HTTP & HTTPS
Optimized for high-latency, low-bandwidthscenarios
New! Caching proxy
File content cached on LANIdeal for regional offices
8/6/2019 VSTS MN - 2007-08 - TFS Enterprise Source Control
30/34
Distributed Development - No Proxy
SOAPM
essage
s
SOAP Messages
SOAPMessages
FileTransfers
File Transfers
FileTransfers
8/6/2019 VSTS MN - 2007-08 - TFS Enterprise Source Control
31/34
Distributed Development with Proxy
SOAPM
essage
s
SOAP Messages
SOAPMessages
FileUploads
File Uploads
FileUploads
Down
loads
8/6/2019 VSTS MN - 2007-08 - TFS Enterprise Source Control
32/34
Distributed Development with Proxy
Content No Proxy With Proxy
35 MB, 1824 Files 00:05:20 00:00:32
80 MB, 8 Files 00:14:07 00:00:25
* Raleigh office has 3Mbps of bandwidth shared by ~70 employees.
Redmond to Raleigh performance comparison
8/6/2019 VSTS MN - 2007-08 - TFS Enterprise Source Control
33/34
TFS Surprises for VSS Users
Checkout does not download the latest file
Get doesnt always get
Get of deleted files/folders will delete them locally
No sharing and pinning of files/folders
Use branching and merging instead
Deletes do not happen immediately
Adding a VS solution to TFS is not done immediately
8/6/2019 VSTS MN - 2007-08 - TFS Enterprise Source Control
34/34
Questions?