Difference between revisions of "UM Source Control"

 
Line 27: Line 27:
  
 
To create a branch from an existing version use '''fcm branch-create'''. For example, to create your own copy of version 7.5 to edit, run the command
 
To create a branch from an existing version use '''fcm branch-create'''. For example, to create your own copy of version 7.5 to edit, run the command
<syntaxhighlight>
+
<syntaxhighlight lang=text>
 
fcm branch-create --branch-of-branch my_vn7.5 fcm:um_br/dev/Share/VN7.5_local_changes
 
fcm branch-create --branch-of-branch my_vn7.5 fcm:um_br/dev/Share/VN7.5_local_changes
 
</syntaxhighlight>
 
</syntaxhighlight>
Line 33: Line 33:
  
 
To edit your new branch you need to check it out from the repository, using '''fcm checkout''', eg
 
To edit your new branch you need to check it out from the repository, using '''fcm checkout''', eg
<syntaxhighlight>
+
<syntaxhighlight lang=text>
 
fcm checkout fcm:um_br/dev/abc123/r1234_my_vn7.5 my_vn7.5
 
fcm checkout fcm:um_br/dev/abc123/r1234_my_vn7.5 my_vn7.5
 
</syntaxhighlight>
 
</syntaxhighlight>
Line 39: Line 39:
  
 
You can now edit existing files, if you create a new file however you'll have to tell subversion about it, e.g. to add the new file foo.f90 run
 
You can now edit existing files, if you create a new file however you'll have to tell subversion about it, e.g. to add the new file foo.f90 run
<syntaxhighlight>
+
<syntaxhighlight lang=text>
 
fcm add foo.f90
 
fcm add foo.f90
 
</syntaxhighlight>
 
</syntaxhighlight>
  
 
Once you've finished making changes run
 
Once you've finished making changes run
<syntaxhighlight>
+
<syntaxhighlight lang=text>
 
fcm commit
 
fcm commit
 
</syntaxhighlight>
 
</syntaxhighlight>
Line 52: Line 52:
  
 
If you want to combine the changes in two branches you can use '''fcm merge'''. Checkout the repository that you want to receive the changes, then in that folder to merge in the r2345_extra_wind branch run
 
If you want to combine the changes in two branches you can use '''fcm merge'''. Checkout the repository that you want to receive the changes, then in that folder to merge in the r2345_extra_wind branch run
<syntaxhighlight>
+
<syntaxhighlight lang=text>
 
fcm merge fcm:um/branches/dev/abc123/r2345_extra_wind
 
fcm merge fcm:um/branches/dev/abc123/r2345_extra_wind
 
</syntaxhighlight>
 
</syntaxhighlight>
 
If there are no conflicting changes you can then checkin the branch. If conflicts occur you will have to manually resolve them by going into the conflicting files, conflicts will be indicated by
 
If there are no conflicting changes you can then checkin the branch. If conflicts occur you will have to manually resolve them by going into the conflicting files, conflicts will be indicated by
<syntaxhighlight>
+
<syntaxhighlight lang=text>
 
>>>>>>>
 
>>>>>>>
 
old code
 
old code

Latest revision as of 00:02, 12 December 2019

Unified Model Repositories

Source code for the UM and related programs is stored under version control using Subversion, with a Trac server providing web access.

NOTE: The following information is for ACCESS 1 and UM versions before UM 10.0. For newer versions, see the MOSRS working practices

The various parts of the UM are stored in the following repositories:

Trac Subversion
~ UM https:access-svn.nci.org.au/trac/um https:access-svn.nci.org.au/svn/um
~ UMUI https:access-svn.nci.org.au/trac/umui https:access-svn.nci.org.au/svn/umui

Repository Structure

    • trunk - Tracks releases from the Met Office
    • branches/dev - Branches for individual users
    • branches/dev/Share - Branches useful for all users, e.g. branches for each version set up for ACCESS facilities
    • branches/dev/Share/VNx.x_local_changes - Individual version branches, to be used as the main path for a run

Creating Branches and Editing Source

The UM uses the program fcm to handle repository management, which is a wrapper around subversion with some extra features useful for the UM's repository structure, such as keywords for important locations. For instance in commands fcm:um will be expanded to the location of the UM repository and fcm:um_br will be expanded to the branches subdirectory. For help with commands run fcm help COMMAND.

To create a branch from an existing version use fcm branch-create. For example, to create your own copy of version 7.5 to edit, run the command

fcm branch-create --branch-of-branch my_vn7.5 fcm:um_br/dev/Share/VN7.5_local_changes

This will create a new branch branches/dev/$USER/r$REV_my_vn7.5, where $USER is your username and $REV the revision of VN7.5_local_changes you created the branch from.

To edit your new branch you need to check it out from the repository, using fcm checkout, eg

fcm checkout fcm:um_br/dev/abc123/r1234_my_vn7.5 my_vn7.5

will create a folder my_vn7.5 containing your branch's source code.

You can now edit existing files, if you create a new file however you'll have to tell subversion about it, e.g. to add the new file foo.f90 run

fcm add foo.f90

Once you've finished making changes run

fcm commit

to get your changes uploaded to the repository. You will be prompted to describe the changes you made, it's helpful here to be descriptive. You can then use your branch as the repository URL within the UMUI, located under FCM Configuration/FCM Extract Directories.

Merging Branches

If you want to combine the changes in two branches you can use fcm merge. Checkout the repository that you want to receive the changes, then in that folder to merge in the r2345_extra_wind branch run

fcm merge fcm:um/branches/dev/abc123/r2345_extra_wind

If there are no conflicting changes you can then checkin the branch. If conflicts occur you will have to manually resolve them by going into the conflicting files, conflicts will be indicated by

>>>>>>>
old code
=======
new code
<<<<<<<

Edit what's between the angle brackets then try committing in the change again.

Resources

NCAS FCM FAQ