Tuesday, April 10, 2007

Version Control Procedure with Tortoise

1.PURPOSE
The purpose of this document is to describe the version control procedure for documentation.
The main concepts that are addressed in this document are:

Tree structure
Code in a CVS repository can be thought of as a tree. The tree shape is not based on the directory structure of the code, but rather on the versions of the code.
Trunk
As code gets modified and is committed back to the repository, it adds another revision to extend the tree. If no branches are specified when checking out working directories, the tree simply grows in a line along the main trunk of the tree.
Tags
A tag can be used to name a particular revision of the code. This tag can later be used to compare different revisions, to go back to an earlier version, or to specify a place to create a branch.
Branches
Branches allow different development paths to be tried. They can be created from the main trunk, or from other branches.

2.ACTIVITY DESCRIPTIONS

2.1 REPOSITORY CREATION (ONE TIME ACTIVITY)
1. Created an empty folder and name it. (ex:- SVN/Mysierra)
2. Right click on the folder and select the option from TortoiseSVN, create
repository.
3. Select FSFS for my repository option.

2.2 IMPORTING A REPOSITORY (ONE TIME ACTIVITY)

1.Create a new folder and name it. ( For example: LeaveAppln.)
2.Created following folders Trunk, Branches and Tags under LeaveAppln.
3.Copied the whole code (Project code along with the initial structure) in Trunk folder.
4.Right click on the LeaveAppln and import the code in the SVN/Mysierra.

2.3 INITIAL SETUP OF TORTOISE SVN

1.Obtain the latest approved copy of the TortoiseSVN software.
2.Install the software on your PC and re-start. To verify the installation, you should see ‘SVN Checkout…’ and ‘TortoiseSVN’ as new options in any Windows Explorer window.
3.Create a directory on your PC’s hard drive in which you’d like to store your version-controlled documentation. It is recommended (though not required) that you create only a high-level directory and allow the subdirectories to mirror those of the TortoiseSVN repository.
Ex: C:\My Documents\TortoiseSVN Documentation\
4.Browse to the directory that you created and create a local working copy of the version-controlled documentation repository by right-clicking and selecting SVN Checkout.
5.Browse to the SVN directory you’d like to check documentation (see Appendix I) out of in the ‘URL of repository:’ field, clicking on the … button next to the field if necessary. See Appendix I for a list of TortoiseSVN directories.
6.Click ‘Ok’ button and you’ll see a dialog noting the download of documents to your PC.

2.4READING DOCUMENTS

1.Browse to the location on your PC in which you’re storing TortoiseSVN documentation using Windows Explorer.
2.Right-click within Windows Explorer and select ‘SVN Update’; this will ensure you have the latest version of all documentation within a directory. You may also select a single document and check it for updates as well.
3.Double-click on the document you’d like to read to open the document in read-only mode.

Note that you should make no changes to these documents as they will not be saved.

2.5 MODIFYING DOCUMENTS

1.Browse to the location on your PC in which you’re storing TortoiseSVN documentation using Windows Explorer.
2.Right-click within Windows Explorer and select ‘SVN Update’; this will ensure you have the latest version of all documentation within a directory. You may also select a single document and check it for updates as well.
3.Right-click within Windows Explorer and select TortoiseSVN-->Get lock… This will ensure you “lock” the document within the repository so that it’s clearly indicated to all TortoiseSVN users that the document is being updated and prevents other users from doing anything other than reading it.
4.A ‘Lock Files’ dialog box will appear, prompting you to enter a message describing why you are locking the file. Enter a short but descriptive message and click ‘OK’.
5.Looking into the directory on your PC that contains TortoiseSVN files, you will now see a lock on the file you have gotten a lock for. Double-click on the file to open and make modifications as you would any other document.
6.Once your modifications to the file are complete, right-click on the file and select ‘SVN Commit…’ to commit your modified file to the version-controlled TortoiseSVN repository.
7.Once again, a dialog box will appear, prompting you to enter a message describing why you are committing the file. Enter a short but descriptive message and click ‘OK’.
8.Finally, note whether or not a copy of the updated file is automatically synched with the appropriate OPLC directory (see Appendix I). If not, make a copy to ensure that non-ODS Systems Analysis staff have access to the latest versions of the documentation.

2.6 COMMON WORK FLOW

For best results, you should use the following steps as a guideline when working with SVN. On a given day when you want to work on your project,

1.Check out a working copy from the repository. (Or, if you already have a working copy, run an "update" on your working copy.)
2.Make your changes, additions, etc. (write code!) Make sure that notify SVN of any new files or name/location changes of files.
3.Do an "Update" in your working copy. If there are others working on the code at the same time, and they commit changes to the repository, this will download those changes to your local copy. If there are conflicts (i.e. someone has changed something that conflicts with your local changes) you will be alerted and asked to fix those conflicts before you commit.
4.Commit your changes to the repository. Make sure you write an informative comment about your changes.
5.Delete your working copy. (optional)