Document directory
- Getting started
- Working with CVS in Eclipse
- Sending files to the server
- Retrieving a former version of a file
- Don't forget to UPDATE!
- Importing an existing project
Setting up CVS in Adobe Flex
This
Tutorial will show you how to get started using CVS (Concurrent
Versions System) and how you use it. CVS is a great tool to backup your
Files, let others work on the same project and keep track of all
Versions of a file.
By Jens C. Brynildsen To read more about why you shoshould use CVS, read here. If you want wish to use Subversion, please refer to this tutorial.
This tutorial will work for both Flex 2 and 3. Screen captures are done
On OSX, but the procedure is identical for Windows (or Linux with FB3
Alpha as Adam correctly pointed out ).
Getting started
CVS support is built right into Flex, so there's no additional
Software to download. You do however need a CVS server. If you do not
Want to manage the server yourself, try a free account at CVSDude (note: affiliate link) or read more here.
Start by opening the CVS perspective. Click on "Window"-> "Open perspective"-> "Other"-> "CVS Repository tracing ing"
Note: the number of items listed may vary.
Click OK to close the dialogue. Flex will now switch to the new mode.
To create a new project (a Repository), right click in the white space
In the left panel called CVS Repositories and select "New"->
"Repository Location" from the popup menu.
Make sure you fill out all the required fields (Host, Repository path,
User, Password and Connection type). If you signed up with CVSDude,
They sent you an email with all the required details as part of
Registration process. If you are connecting to a company server, ask
The admin for the required details or if opted to set up your own
Server, you'll find the info you need on the web.
Switch to the "Flex Development" perspective (in the upper right corner ).
If
You want to start with a new project, make one by selecting File->
New-> MXML Application (or any desired option in this menu ).
Right click the project you want to add and select Team-> Share
Project. (you may be asked to select between CVS and SVN, choose CVS .)
Next, select to use the repository location you just added.
Click next to proceed. You can think of the repository as just a folder
On a server. You can add as your Flex projects you want to a CVS
Repository, but may wish to plan how these files are organized since
The initial commit will decide your future structure (The folder you
Commit initially will become your "root" folder). Keep this in mind
When you create a proper repository. If you use CVSDude, you can easily delete repositories so lets forget about this for now and just continue.
Now select where to put the files. I first opted to use the project
Name option. When I did this, I got an error from the CVS server. I
Then chose the third option ("Use an existing module"). This refreshed
The list of folders on the server and I cocould see that a folder with my
Project name was indeed created and that I cocould now select it.
Something similar happens on this first commit in both Flex 2 and 3.
Next, you add the existing files. Eclipse suggests that you add all
Files. In this dialogue, you may right click and exclude files from CVS
Temporarily or completely (see cvsignore further down this article ).
Click Finish to close this dialogue. If the option to open the COMMIT
Dialogue was checked, Eclipse will do this next. If this does not
Happen automatically, right click your project folder and select Team
-> Commit.
Eclipse will now ask you about certain hidden
Files (. flexProperties. actionScriptProperties. js). These are all
Incorrectly identified as "binary" files. These hidden XML files
Contain project settings an other stuff required by Flex Builder.
Toggle them to "ASCII Text" and click Next. The final dialogue you will see is one that you will see a lot.
This is the COMMIT files dialoge that you'll see every time you send
Files to the CVS server. Type in a suitable message such as "Initial
Commit of existing files "and click" Finish "to send the files off.
Notice that the folders controlled by CVS in your "Flex Navigator" now
Have something extra on each icon-a small symbol that indicates
Status of each file. Next, we'll go through what the icons mean and how
You use CVS in daily life.
Working with CVS in Eclipse
We now have a working repository, so lets look closer at how
Work with CVS in Flex. Start by creating a new ActionScript class File
-> New-> ActionScript Class. Name the class "SomeClass". Did you
Notice that there is now a ">"-character in front of the new file?
The same character is also shown on the folder containing the file.
This is how CVS tells you that something has changed. If you open
File, type a space and save it, CVS will mark it as changed. This makes
It super easy to see any changes not sent to the CVS server.
Sending files to the server
Let's add the newly created file to CVS. Right click
"SomeClass. as" an select Team-> Add to Version Control. Flex
Displays a dialogue that disappears as soon as the CVS server replies.
The icon is changed, but the ">"-character remains to indicate that
The file is still not COMMIT 'ed to CVS (uploaded). To do this, right
Click the file again and select Team-> Commit...
Type an appropriate message to describe the file and click "Finish"
Send the file to the server. The ">"-character is now gone, so all
Files have been commit 'ed to the server.
If there are files
You want CVS to ignore, you specify this by clicking the file and
Selecting Team-> Add to. cvsignore. This will create a text file
That simply contains names of files that shoshould not be managed
CVS. You will have to add this file as well and commit it to the server
For others to get this change as well.
To remove a file from
CVS, just right click it, select "Delete" and then select Team->
Commit to send this change to the server. If you accidentally deleted
File, you can bring it back using Team-> Restore from Repository.
Retrieving a former version of a file
One of the nice things about code versioning is that you can
Easily look through old versions of a file. Imagine that you solve
Problem and later opt for a different solution. If you want to go back
To the old solution, CVS will hold all your code and it's easy
Switch back.
First we must ensure that we have a file that
Exists in several versions. For simplicity, we'll change
Existing file and commit it. Open "SomeClass. as" and add a comment in
The class constructor. Commit this file (Team-> Commit). Now
File has two versions. Add more versions if you wish by changing
File and committing each version.
Now, let's have a look
The history of this file. Right click "SomeClass. as" and select Team
-> Show History. A new panel will open (note: you can drag panels
Where you like them) and display the full history for this file.
To see any of the versions, just double click it. To compare two files,
Select the two files from the list in the History panel and right-click
To select "Compare with each other". A new panel will display that
Easily let you see the differences.
Large files with custom changes will show small rectangles in the margin
Along the scrollbar to show where the two files differ. This view is
Similar to the one you use merge files manually. Merging and branching
Is outside scope of this tutorial, but you can find more via Google.
To bring back a former version, right click the file, select "Replace
With-> History... "and browse to the correct version. Eclipse will
Then create a new version based on the old one. You never delete files
From CVS. It's a complete record of how a project developed, who
Committed what and so on.
Don't forget to UPDATE!
The most common mistake when you start using CVS with other
Programmers is that you just start the day coding and then run
Problems when you COMMIT the changes. While mostly cool, there are some
Things CVS does not like and the most important one of these is that
You always work on a current version of a file. To prevent this:
Always start your day by right-clicking the project folder and select Team-> UPDATE
This will download any changed files. The more often there are changes
To the repository, the more often you'll need to Update. Updating will
Not overwrite your changed files but it will alert you to possible
Conflicts.
Importing an existing project
To finish off this tutorial, we need to show you how to connect
To an existing project. This will allow you to get all the latest files
In a project no matter where you are.
Imagine it's
Christmas holidays and you left your computer at home intentionally.
Client callyou up while you are at your parents. It's the "classic"
Crisis where the client insists that you have to fix a URL since they
Updated it without policying you just before the holidays started. You
Cocould of cause ask the client to go somewhere unpleasant, but it's
Season to be jolly and you know it's a quick fix if you only had
Files...
- Borrow your dad's dated computer
- Download and install the trial version of Flex 3
- Import the project from SVN
- Make the change and commit
- Send the updated file to the customer
That's all. It's really that simple.
To do this, right click the white space in the Flex Navigator panel. Select Import and open "CVS" to find "Projects from CVS ".
Go through the steps as before by creating a new repository location.
This will connect you to the CVS server. Select the folder to Checkout
From the CVS server.
Click Finish to download the latest revision of each file and you are ready to serve your favorite customer.
That's where this tutorial ends. We 've ve been through setup and the most
Common tasks like committing, comparing and replacing files. There are so cute other things you can do with CVS, but that's beyond the scope of this tutorial.
Tutorial by Jens C Brynildsen (January 16th 2008)