Welcome to Team System Rocks Sign in | Join | Help

Mickey Gousset

My Journey Into Team System
(Add me to your Live Messenger at mickey_gousset@hotmail.com)

<August 2005>
SuMoTuWeThFrSa
31123456
78910111213
14151617181920
21222324252627
28293031123
45678910

Post Categories

News

ProTFS Book Cover

Navigation

Awards

Links-O-Interest

Syndication

Let's Play With Version Control - Part 1

EDIT: Something weird is going on with some of the formatting of this post, but scroll down and the post is there, I promise!  :)

Its time to start diving back into Team System more, and Version Control is at the top of my list, so my next several posts are going to deal with that aspect of Team System.

We are going to be working with the Person.Contact table in the AdventureWorks database. We are going to create a new Team Project, then a new ASP.NET project. Ultimately, we want to display the contents of the Person.Contact table in a grid on a web page.

Following my previous instructions:

I created a new Team Project called "Contacts". I created a new project as well, except unlike the instructions, I am created an ASP.NET website, so I selected File->New Website. I set the location to be "ContactsWeb", which is the name of the site. I right-clicked on the solution and added it to the Source Control. I then checked the files in with a comment of these files being the initial check-in of the files, and no changes have been made to the project yet. Just for the heck of it, I then closed everything, closed out of VS2005, and opened it back up.

In the Team Explorer window, I see the Contacts Team Project that I created. I click the "+" to drill down into the project. I then double-click on the Version Control file located in the Team Project, to open the Source Control Explorer:

Source Control Explorer

You can see the ContactsWeb folder which was created for the Version Control system. In that folder is the VS2005 solution file, and a folder containing the actual website, which is also called ContactsWeb.

If we right-click on the Contacts->ContactsWeb folder, we get the following context menu:

Context Menu

There are a lot of options on this menu that we will be exploring over the next several posts. Let's look at some of those now. For all of the following, I am right-clicking on the Contacts->ContactsWeb folder in the Source Control Explorer.

Menu Option: Get Latest Version

This option retrieves the latest versions of the files from your repository and puts them in your workspace. For example: If someone had checked in some files, and you wanted to make sure you had the latest version of all the code in the repository, you would use this option.

Menu Option: Get Specific Version

This opens the Get Window:

Get Window

You can retrieve changesets from the database using several different options:

Get Window Version Options

You can also choose to "Overwrite writable files that are not checked out" and to "optimize the file revisions that are already in my workspace". I understand what the first option means, but I don't get the second one at all. We are going to come back to the Get Window later, and evaluate all the different options.

A quick note on changesets. Whenever you check files into the version control system, they are assigned a change set number. This number associates all the files together that were checked in. Using this number, you can retrieve files from a particular state, or research what files were checked in and why. This number is automatically assigned for you. We'll be seeing more about this later.

Menu Option: Check Out For Edit

This opens the Check Out Window:

Check Out Window

I am checking out the entire project, including the solution file, at this point. You can also set the Lock options, depending on your need at the time. I'm going to go ahead and click the Check Out button.

Notice how the Source Control Explorer has changed. There are not red checkmarks beside all the files. Also, note that I have not actually opened the solution yet in VS2005. Everything I've been doing so far as strictly been with the Source Control Explorer:

Source Control Explorer After Checkout

Also notice that the files are marked as "edit" in the Pending Change column, and they show they are checked out to darren. (who is the person I am currently logged in as).

If you double-click the solution file, ContactsWeb.sln in the Source Control Explorer, it will open the solution and the project for me in VS2005. I double-click the Default.aspx page to open it up. It opens up by default into Source View. A cool feature is that you can drag and drop from the toolbox while in source view. I like it! I dropped a Label Control on the page, renamed the control to be "lblTitle", with a Text value of "Contacts Table". Using the Properties window, I set the font to be Bold.

I saved my work, and did a CNTL+SHFT+B to build the solution. Everything compiled successfully. I'm ready to check everything back in, so let's check out the Pending Checkin Window:

Pending Checkin Window

I add the comment "Added Contacts Table Label to the default page" and click the Check In button. Notice in the Source Control Explorer, the files are not shown as being checked out anymore:

Source Control Explorer

And in the Solution Explorer, the files now have blue locks next to them, indicating they have been checked in.

You'll notice in this previous example that I checked out EVERYTHING, but you don't have to do that. If you drill down to a particular file, you can just check that file out as well. You should be able to check out any combination of files that you need.

Menu Option: Lock

Selected this option opens the Lock Window:

Lock Window

You can prevent people from checking anything in or out (Check Out Lock), or you can allow people to check stuff out, but not be able to check it back in (Check In Lock). I went ahead and selected the entire folder, and did a Check Out Lock. If you then click on the Contacts Team Project in the Source Control Explorer, it shows the ContactsWeb folder as being "lock" in the Pending Change Column, and the User column shows "darren" as being the person who has locked the files.

Menu Option: Unlock This unlocks the files you have previously locked. I went ahead and did this on the ContactsWeb folder, that I had locked previously. Now, if you click on the Contacts Team Project in the Source Control Explorer, you'll see it no longer shows values in the Pending Change and User column.

As far as locking and unlocking go, you can do this to directories, or you can drill down to specific files. If you unlock a directory, it will unlock all files in that directory, and in all subdirectories. Just a little tidbit to be aware of.

Menu Option: Delete

This option seems to delete what you select. It does not warn you or anything though. I'm a little confused over exactly what happens, as you'll see over the next couple of posts.

In the Source Control Explorer, I right-clicked on the Default.aspx file and selected Delete:

Deleting In Source Control Explorer

Notice the file I selected is now marked with a Purple "X" in the Source . The files have disappeared completely from the Solution Explorer. In the Source Control Explorer, the Pending Change is shown as "delete" and the User is shown as "darren". Also notice in the Pending Checkin window, the Change column shows as "delete". I added a comment saying "I am deleting the default.aspx. Do I know what I am doing, and checked the files in.

Menu Option: History

This option opens the History Tab:

History Tab

This shows you the history for what you right-clicked on. For example, clicking on the Contacts->ContactsWeb folder shows me the image above. If I go into that ContactsWeb folder, and select History on the .sln file, I see this:

.sln History

Double-clicking a particular row in the History window opens the Details For Changeset window. In the following image, I double-clicked on Changeset #6:

Details For Changeset

This shows you all the information concerning this particular changeset. On cool thing is you can select a specific file, right-click on it, and do a compare with previous versions, the version currently in your workspace, or the latest version. This allows you to quickly and easily see the difference between different versions of the same file.

One thing I noticed was when I selected Default.aspx, and did a compare with latest version, it just shut down the window. I didn't get any notification that the file was deleted, or anything like that.

Up next: More Fun With Version Control! Stick Around!

Published Thursday, August 18, 2005 9:12 AM by mickey_gousset

Comments

New Comments to this post are disabled
Powered by Community Server, by Telligent Systems