wiki:SvnTutorial

Version 30 (modified by ckharris, 16 years ago) ( diff )

--

SVN Tutorial

In this tutorial, you will learn how to download the CSTM source code and create and modify your own branch.

In the following examples, the username is bubba.

To proceed, you will need to know your username and password which should have received via e-mail from hosted-projects.

Check to Make Sure You Can See the Repository

The easiest way to view a repository is to simply look at it in a web browser. Enter the url of the repository (and your username and password when prompted if the site is protected), and start looking. This is also a good way to see individual files in the repository without actually downloading them.

If you are using TortoiseSVN, right-click on a directory and choose Repo-browser.

Enter the URL

https://www.myroms.org/svn/cstm

Now you should be able to look at the trunk and maybe some branches (depending on ACL), but bubba won't be there yet. You will create this later. (You can also navigate the repository with a web browser, but cannot do any of the version control stuff that follows).

TortoiseSVN Users

The way you do this using the GUI is a little roundabout. The steps are:

  • Make a local working copy of the trunk (or branch) you want to start with.
  • Use the GUI to make a branch from this working copy.
  • Checkout a working copy of the branch.

Checkout a Local Working Copy of the Trunk

This process brings a copy of main code from the repository to your computer and places it under SVN control.
Make a directory...name it something meaningful to you, for example bubba_roms_sed
Right-click on the directory folder icon, and choose SVN Checkout...
URL of repository:
https://www.myroms.org/svn/cstm/trunk
Checkout directory:
bubba_roms_sed
You should see a bunch of stuff stream by like:

Added: D:\crs\proj\Adriatic\bubba_roms_sed\ROMS  
Added: D:\crs\proj\Adriatic\bubba_roms_sed\ROMS\Tangent  
Added: D:\crs\proj\Adriatic\bubba_roms_sed\ROMS\Tangent\tl_rho_eos.F  
Added: D:\crs\proj\Adriatic\bubba_roms_sed\ROMS\Tangent\tl_uv3dmix.F  
Added: D:\crs\proj\Adriatic\bubba_roms_sed\ROMS\Tangent\tl_def_his.F  
Added: D:\crs\proj\Adriatic\bubba_roms_sed\ROMS\Tangent\tl_step2d.F  
...
Added: D:\crs\proj\Adriatic\bubba_roms_sed\Compilers\CYGWIN-g95.mk  
Added: D:\crs\proj\Adriatic\bubba_roms_sed\Compilers\OSF1-f90.mk  
Added: D:\crs\proj\Adriatic\bubba_roms_sed\Compilers\Darwin-ifort.mk  
Added: D:\crs\proj\Adriatic\bubba_roms_sed\Compilers\AIX-xlf.mk  
Added: D:\crs\proj\Adriatic\bubba_roms_sed\Compilers\SunOS-f95.mk  
Added: D:\crs\proj\Adriatic\bubba_roms_sed\makefile  
Completed: At revision: 243  

Click OK.

Create a Branch with Tortoise

You must use the exact branch name that was created for you by a CSTM administrator. If you are unsure of your branch name, check the Access Control List, searching for a line like:

[roms_sed:/branches/bubba]

In TortoiseSVN, choose Branch/tag. (To see this option in TortoiseSVN, you have to right-click on a directory that is under SVN control...but it does not have to be related to the project at hand).
From WC at URL:
https://www.myroms.org/svn/cstm/trunk
to URL:
https://www.myroms.org/svn/cstm/branches/bubba
Click OK.
(stuff streams by...)

The branch will exist in the repository...you can repeat the steps above to make a copy of the branch on your computer (but not in the same directory you made in the example above, because that contains a version of the trunk under SVN control).

Command Line

This is more straightforward, and does not require you make a working copy of the source. PC users can do this from the Cygwin command line, if they installed SVN during the Cygwin installation. The steps are:

  • Make a subdirectory in the repository for the branch
  • Copy the source code to the subdirectory as a branch
  • Checkout a local working copy to mess with

Make a Branch from the Command Line

svn mkdir https://www.myroms.org/svn/cstm/branches/bubba/ -m "Cleaned top directory for my branches"

svn copy https://www.myroms.org/svn/cstm/trunk https://www.myroms.org/svn/cstm/branches/bubba/cstm_trunk -m "copy of cstm trunk"

svn co https://www.myroms.org/svn/cstm bubba_roms_sed

If you only want your branch and not the entire repository type:

svn co https://www.myroms.org/svn/cstm/branches/bubba my_branch

(See the footnote for correctly installing svn with ssl support on unix style machines below.)

PROPFIND error If you see an error that says something like "svn: PROPFIND request failed", make sure that you use the path above (containing www.myroms.org/svn/cstm) and not the path that you see on the web-site (www.myroms.org/projects/cstm).

Make Changes in Your Branch

You can make new files, change existing files, etc. Only existing files will automatically be under SVN control. To add new files, create them in a directory under SVN control (or copy them in from somewhere else).
Then you can right-click on the filename, and choose Add... under TortoiseSVN, or...
You will be given an opportunity later (see next step).
If you compile the code and generate a bunch of .f90 and .o files, or run the model and generate output, they will not be under SVN control unless you add them explicitly. That is usually what you want. (Storing output files here is probably a bad idea, because 1) they tend to be big and take a long time to tranfer to the repository 2) they are binary, so the tools used to compare them will not be useful, and 3) we don't have enough storage space at the repository.)

Commit Your Changes

Navigate to the top directory in your local copy of your branch, e.g., ../bubba_roms_sed and right-click. Choose SVN Commit...
Commit to: https://www.myroms.org/svn/cstm/branches/bubba
Message: (add a meaningful comment here)
Changes made: (Will show files with changes)
If the Show unversioned files box is checked, you will see any files you added to the directory. This is your opportunity place them under SVN control. Say you made one named foo that you want to add...check it and
Click OK.

Adding: bubba_roms_sed\foo  
Sending content: bubba_roms_sed\foo  
Completed: At revision: 244  

To commit changes using the command line: Go to the top directory in your local copy of your branch, e.g., ../bubba_roms_sed . Type >> svn -m "Meaningful message here" commit .

Delete a Branch

From Tortoise

Use the RepoBrowser and select delete.

Command line: svn delete https://www.myroms.org/svn/cstm/branches/crs_branch -m "some useful comment"

Work Cycle

You can Import this branch to another computer...that is the best way to synchronize, say, a desktop at work with a traveling laptop.
After that, the cycle is:
At the top local directory, right-click, and under TortoiseSVN Check for modifications. Click Check Repository.
Make changes.
Check for modifications or SVN Update (again..can't hurt).
Finally, SVN Commit...

Footnote on building svn on unix-like machines

On Unix style machines, you will need to have subversion installed. You will typically want to build this from source, as you will want to compile with secure socket layers enabled (the binary versions of svn do not have this feature). Find the source at http://subversion.tigris.org/. Configure and make with {{{./configure --with-ssl make sudo make install}}}

Note: See TracWiki for help on using the wiki.