Presentation is loading. Please wait.

Presentation is loading. Please wait.

Microsoft Developer’s Guide to Team Foundation Version Control

Similar presentations


Presentation on theme: "Microsoft Developer’s Guide to Team Foundation Version Control"— Presentation transcript:

1 Microsoft Developer’s Guide to Team Foundation Version Control
Ed Hintz and Buck Hodges

2 Agenda Introduction Dogfood and Performance Statistics
Feature overview Scenarios Visual Studio Command line SDK and Extensibility

3 What is VS Team Foundation?
Integrated Platform for Collaborating on Software Development Projects. Work Item Tracking Version Control Reporting Build Automation Team Communications

4 Microsoft VSTS Dogfooding Version Control
Version Control Users: Number of Files/Folders: 1,507,247/178,953 Compressed File Size: GB Workspaces: ,770 Workspace File Versions: Million Changesets: ,573 Pending Changes: ,278 Shelvesets: ,458 Source: Latest: Copenhagen, Denmark 6 Users Fargo, ND 4 Users Redmond, WA 368 Users Research Triangle, NC 42 Users Hyderabad, India 14 Users

5 Source Control Feature Support
Atomic Checkin Integrated with Visual Studio Work Item Integration Customizable Checkin Experience Checkin Policies Checkin Notes Shelving Delta File Storage Large File Support (>4GB)

6 Source Control Feature Support
Distributed Team Support Checkin Notification Merge and Diff Tool Configurable (see for common tool settings) SDK and VS Extensibility MSSCCI Plugin as Powertoy – (VS2003, VB and VC6)

7 Visual Studio Demo

8 Architecture

9 Architecture Team Foundation Client Tier Version Control Proxy
Build Machine Report Client Team Foundation App Tier App Tier Standby Server MDAC Team Foundation Data Tier

10 TFS Concepts: Workspace
Local copy of files under SCC Isolates developer from other changes Maps repository paths to local paths Mappings can be scattered around local machine Allows for cloaked paths Server maintains inventory Tracks file versions and local paths

11 TFS Concepts: Changeset
Set of committed modifications Add, rename, delete, etc. Atomically applied to repository Associated with work items at checkin Convenient unit for change management

12 Checkin - Under the Hood
Visual Studio Work Item Tracking WorkItem 33231 Workspace Checkin Validate Policies 1 Checkin Policy Engine Unit Testing WI Association Static Analysis Custom Policy Artifact Link Commit Changes 2 Update Work Items 3 Change Set Change Set Change Set Change Set Change Set V2 Changeset V1 V3 V5 V4 V5 Check Notification 4 Events Raised for 3rd party sync purposes Version Control Integration Infrastructure

13 Getting started Create a workspace, set mappings
For example, use /template to start with working folder mappings. tf workspace /template:WorkspaceName;username WS1 /s: Configure diff and merge tools tf diff /configure Get the files from the server tf get Edit a file tf edit foo.cs Check in tf checkin

14 Command line dialogs We provide dialogs for commands involving complex input or data display (use /i to suppress) Changeset Checkin Difference (external diff viewer) Get (conflict resolution) History Resolve Shelve Unshelve View (associated editor) Workspace

15 Shelvesets Shelvesets are collections of pending changes, comments, and associated work items Scenarios Backup tf shelve /i MyWork Temporarily move changes to work on a different issue tf shelve /i MyWork /move Remote code reviews tf unshelve CoolStuff;joe Buddy builds or coordinate changes tf unshelve CoolStuff;joe

16 Shelvesets List shelvesets tf shelvesets tf shelvesets /owner:joe
Delete a shelveset tf shelve /delete MyShelveset List the pending changes in a shelveset tf status /shelveset:MyWork;joe Diff the changes in a shelveset tf diff /shelveset:MyWork;joe

17 Notes To move your workspace, change your mappings (tf workspace) and then run get To handle changing computer names: tf workspaces /updateComputerName:oldName /s: To handle changing user names: tf workspaces /updateUserName:oldUserName /s: Renaming files Don’t overdo it, or your branch merges will be more tedious (for example, renames in both the source and target)

18 Performance Tweaks Use a version control caching proxy server in remote offices Command line Set the BypassProxyOnLocal registry entry (see for details) On my laptop today, ByPassProxyOnLocal saved 2 seconds (my IE settings are Automatically Detect) Visual Studio Change the registry setting not to automatically get missing files (see for details)

19 Commands Command line reference: Command line command and option summary:

20 Client API The Team Foundation Server client object model is a set of .NET 2.0 assemblies There are public APIs for version control, work item tracking, build, reporting, and more

21 How It Happens: Team Foundation Core Services
Team Foundation Object Model Visual Studio IDE External tool (Partner or MS) Work Items Integration Interface Version Control Integration Interface Team Build Integration Interface Team Foundation Core Services Team Foundation Server Linking Service User Groups Notification Registration Common Structure

22 Version Control Client API
The primary objects are TeamFoundationServer – this is the root object from which you obtain a service, such as version control or work item tracking VersionControlServer – this is the primary interface to the version control server for operations and queries that are not specific to a workspace Workspace – this object represents a workspace and is used to pend changes, check in changes, and perform queries specific to a workspace Workstation – this object represents the current computer and manages the workspace cache, which contains the list of local paths in each workspace

23 Code Sample TeamFoundationServer tfs = new TeamFoundationServer(" // Get a reference to Version Control. VersionControlServer versionControl = (VersionControlServer) tfs.GetService(typeof(VersionControlServer));

24 Code Sample // Determine the server and workspace based on the local path mapping. WorkspaceInfo wsInfo = Workstation.Current.GetLocalWorkspaceInfo(Environment.CurrentDirectory); // Stop if we couldn't figure out the workspace. if (wsInfo == null) { Console.Error.WriteLine("Unable to determine the workspace."); Environment.Exit(1); } // Get a reference to our Team Foundation Server. TeamFoundationServer tfs = new TeamFoundationServer(wsInfo.ServerUri.AbsoluteUri); // Get a reference to the workspace. Workspace workspace = wsInfo.GetWorkspace(tfs); // Update this workspace. workspace.Get();

25 API Code Samples Basic Team Foundation Version Control client API example Displaying the labels on a file, including label comments Displaying the sizes and dates of files in the server Sample checkin policy: make sure the comment isn't empty Show all pending changes on the Team Foundation server older than a given age Scanning history for the changesets that had policy override - simple usage of QueryHistory

26 VS Extensibility Allows customers to extend the functionality of TF SCC in Visual Studio via add-ins and packages Provides access to the following: Source Control Explorer selection and events Pending Changes selection and events Solution Explorer and SCC Explorer workspace History selection Changeset details dialog Shelveset details dialog

27 VS Extensibility All class names start with Microsoft.VisualStudio.TeamFoundation.VersionControl Use the VersionControlExt object to get to the others: vce = _applicationObject.GetObject("Microsoft.VisualStudio.TeamFoundation.VersionControl.VersionControlExt") as VersionControlExt;

28 VS Extensibility - VersionControlExt
Method/Property Description Explorer Access the Source Control Explorer.  Useful for add-ins that need to scope an operation.  The class is VersionControlExplorerExt. FindChangeSet Find and display a specific changeset from your add-in History Access the History Toolwindow from your add-in.  The class is HistoryExt PendingChanges Access the collection of pending changes (as displayed in the Pending Changes Toolwindow) from your add-in.  The class is PendingChangesExt. SolutionWorkspace Get the Workspace object that contains the currently opened solution.  If there is no solution opened or the solution is not under version control this will be null. ViewChangeSetDetails Display detailed information about a changeset ViewShelveSetDetails Display detailed information about a shelveset

29 VS Extensibility Demo How to Write a Team Foundation Version Control Add-in for Visual Studio

30 Tfpt.exe: Team Foundation Power Toy
Fills some of the gaps in v1 Some of the command names (getcs, uu) may change in the future Work item tracking commands will be available soon Executing queries Updating work items in bulk Downloading and uploading attachments Additional documentation: Currently part of the Visual Studio 2005 SDK:

31 Annotate Downloads all versions of the specified file and shows information about when and who last changed each line in the file tfpt annotate example.cs

32 GetCS Gets only the changes in a particular changeset “tfpt getcs 123”

33 History Copies the functionality of the regular history command with the addition of /followBranches FollowBranches option results in the output including the history of the file’s branch ancestors Requires a single item argument (no wildcards or recursion) tfpt history /followBranches mycode.cs

34 Online Pends edits on writable files that do not have pending edits
Optionally includes adds of files not in version control and deletes of files missing from disk Supports exclusion masks “tfpt online . /r”

35 Review Optimized for a code review rather than checking in or shelving

36 Rollback Used to roll back changes that have already been committed
If you have existing pending changes in your workspace, use shelve /move to move them out while rolling back changes “tfpt rollback /changeset:3”

37 Unshelve Unshelve and merge changes with the changes currently in the workspace Creates a backup shelveset with your changes before unshelving

38 UU Undoes unchanged files, including adds, edits, and deletes
By default, gets the latest files in your workspace (runs get) Specify a particular changeset with /changeset if you only want to check against a particular set of changes Designed to help with a Gauntlet workflow “tfpt uu /changeset:123”

39 Questions


Download ppt "Microsoft Developer’s Guide to Team Foundation Version Control"

Similar presentations


Ads by Google