Merging and Updating the SVN Repository For Fortuna

From GEOS-5
Jump to navigation Jump to search

This page will detail information about the SVN repository

Creating new branch

Copy trunk to new branch

First, svn copy the trunk (or another branch) into a new branch:

svn copy http://geos5.org/svn/trunk http://geos5.org/svn/branches/Fortuna-2_5_p6 -m "geos: created Fortuna-2_5_p6 branch"

Note that this is just a copy, so that means the Fortuna-2_5_p6 branch isn't actually Fortuna-2_5_p6 yet.

Checkout SVN version of new branch

cd /path/to/svn/directory
ls
branches/ tags/ trunk/
cd branches/
svn checkout http://geos5.org/svn/branches/Fortuna-2_5_p6

Copy new branch to a SAVE directory (optional)

This is a bit "belt-and-suspenders", but to be sure you don't muck up the "merge" from CVS to SVN, I made a copy of the new branch:

cp -a Fortuna-2_5_p6 Fortuna-2_5_p6-SAVE

Checkout a CVS copy of the new branch

The next step is to check out the tag that will become the new branch:

cd /path/to/cvs/directory
mkdir Fortuna-2_5_p6
cd Fortuna-2_5_p6
cvs co -r Fortuna-2_5_p6 Fortuna

Apply copyright to CVS code

Next, in the CVS branch, run the HandleCopyright.py script:

cd /path/to/model/directory/Fortuna-2_5_p6/GEOSagcm/src
HandleCopyright.py -p .

At the moment, we *think* the copyright script correctly handles all files, but the proof will be when you try and build the "copyrighted" code. The files that have the greatest chance of getting screwed up are .h files since some in the GEOS-5 GCM are .h files that contain C code (mainly in GFDL_fms) and most are .h files that contain Fortran code.

Copy the CVS Code into the SVN directory

Using plain ol' cp, copy the copyrighted CVS into the SVN directory:

cd /path/to/svn/directory/branches/Fortuna_2_5_p6/src
cp -rv /path/to/model/directory/Fortuna-2_5_p6/GEOSagcm/src/* . 

Remove the CVS directories

Now remove the CVS directories using find:

find . -type d -name 'CVS' -exec rm -rf {} +

Remove the FV3 code (Fortuna only)

The FV3 code is not distributed with Fortuna tags so we must remove it:

cd GEOSgcs_GridComp/GEOSgcm_GridComp/GEOSagcm_GridComp/GEOSsuperdyn_GridComp/
rm -rf FVdycoreCubed_GridComp/

This also means we must comment out the sections of code in GEOS_SuperdynGridComp.F90 that call the FV3 code as well as remove it from the GNUmakefile. These differences can be seen through an svn diff:

(1186) $ svn diff GNUmakefile GEOS_SuperdynGridComp.F90
Index: GNUmakefile
===================================================================
--- GNUmakefile	(revision 67)
+++ GNUmakefile	(working copy)
@@ -63,6 +63,7 @@
 LIB   = lib$(THIS).a
 
 ALLDIRS = FVdycore_GridComp \
+	  FVdycoreCubed_GridComp \
 	  GEOSdatmodyn_GridComp \
 	  ARIESg3_GridComp   
 
Index: GEOS_SuperdynGridComp.F90
===================================================================
--- GEOS_SuperdynGridComp.F90	(revision 67)
+++ GEOS_SuperdynGridComp.F90	(working copy)
@@ -45,7 +45,7 @@
   use MAPL_Mod
 
   use FVdycore_GridCompMod,     only :    FV_SetServices => SetServices
-!  use FVdycoreCubed_GridComp,   only :   FV3_SetServices => SetServices
+  use FVdycoreCubed_GridComp,   only :   FV3_SetServices => SetServices
   use ARIESg3_GridCompMod,      only : ARIES_SetServices => SetServices
   use GEOS_DatmoDynGridCompMod, only : DATMO_SetServices => SetServices
 
@@ -169,10 +169,10 @@
                   DYN =  MAPL_AddChild(GC, NAME='DYN', SS=   FV_SetServices, RC=STATUS)
                   VERIFY_(STATUS)
     endif
-!    if(adjustl(DYCORE)=="FV3"  ) then
-!                  DYN =  MAPL_AddChild(GC, NAME='DYN', SS=  FV3_SetServices, RC=STATUS)
-!                  VERIFY_(STATUS)
-!    endif
+    if(adjustl(DYCORE)=="FV3"  ) then
+                  DYN =  MAPL_AddChild(GC, NAME='DYN', SS=  FV3_SetServices, RC=STATUS)
+                  VERIFY_(STATUS)
+    endif
     if(adjustl(DYCORE)=="ARIES") then
                   DYN =  MAPL_AddChild(GC, NAME='DYN', SS=ARIES_SetServices, RC=STATUS)
                   VERIFY_(STATUS)

Edit the files such that you don't see these anymore.

Strip copyright from Copyrighted Files

Some files in GEOS-5 already have copyrights, so we shouldn't copyright those.

FMS

FMS has a copyright, so we can strip ours from that:

cd /path/to/svn/directory/branches/Fortuna_2_5_p6/src
HandleCopyright.py -s -p GMAO_Shared/GFDL_fms/shared/

Satsim

Using grep, the files that don't have a copyright seem to be (files in bold):

(1228) $ grep -iL copyright * | grep -v svn
actsim
cmor
geos5_cosp_const.F90
geos5_read.f90
GEOS_SatsimGridComp.F90
GNUmakefile
llnl
mcai.data
quickbeam
tauir.F
tausw.F

So, we strip the copyright from all the files and add a copyright to ours:

cd GEOSgcs_GridComp/GEOSgcm_GridComp/GEOSagcm_GridComp/GEOSphysics_GridComp/GEOSradiation_GridComp/GEOSsatsim_GridComp/
HandleCopyright.py -s -p .
HandleCopyright.py -f geos5_cosp_const.F90
HandleCopyright.py -f geos5_read.f90
HandleCopyright.py -f GEOS_SatsimGridComp.F90
HandleCopyright.py -f GNUmakefile
HandleCopyright.py -f mcai.data
HandleCopyright.py -f tauir.F
HandleCopyright.py -f tausw.F

Add the files that are new to the branch

You can see all the files that must be added by doing a:

cd /path/to/svn/directory/branches/Fortuna_2_5_p6/src
svn status | grep "^?"

What we need to do is add those:

svn add `svn status | grep "^?" | awk '{print $2}'

Commit the new branch

svn commit -m "geos: Update to code from Fortuna-2_5_p6 CVS checkout"

Test compile the new branch

Now make sure the branch can actually be built on discover:

cd /path/to/checkout/directory
mkdir Fortuna-2_5_p6-SVN 
cd Fortuna-2_5_p6-SVN
svn checkout http://geos5.org/svn/branches/Fortuna-2_5_p6 GEOSagcm
cd GEOSagcm/src
make install |& tee make.log

If there are issues, fix them. Most likely ones are g5_modules isn't quite right, or a copyright was put in in the wrong format. Make note of the latter issues since the HandleCopyright.py script needs to handle them correctly.

Make sure to commit all changes to the SVN repo.

Ignoring unversioned files

When you do a test build, you'll find there are lots of files that appear with an svn status. To ignore them, create a file called ignore-from-svn.txt which has:

*.d
*.mod
*.x
*.xx
*___.h
*___.F90
*___.rc

Then, on the src/ directory do:

cd /path/to/checkout/directory/Fortuna-2_5_p6/GEOSagcm
svn propset -R svn:ignore -F ~/ignore-from-svn.txt src
svn commit

Merge latest code to trunk (if not a feature branch)

Once the code builds, if it's not a feature branch, but the latest code, this should be merged to trunk. To do so, run:

cd /path/to/svn/directory/trunk
svn update
svn merge --reintegrate http://geos5.org/svn/branches/Fortuna-2_5_p6@HEAD

Create tag

svn copy http://geos5.org/svn/trunk http://geos5.org/svn/tags/Fortuna-2_5_p6 -m "geos: Create Fortuna-2_5_p6 tag"