CVS Best Practices: Difference between revisions

From GEOS-5
Jump to navigation Jump to search
Cut-and-paste from doc in SI Team CVS
 
m Added categories
 
(3 intermediate revisions by the same user not shown)
Line 1: Line 1:
Guidelines for Branching the Model
==Branch Name Style==
==================================


Style of branch names:
We recommend using
b_XYZ_descriptive
where <code>XYZ</code> are your initials and <code>descriptive</code> is a descriptive name for your branch.


  - We recommend using b_XYZ_descriptive where XYZ are your initials
'''Note''': Branches and branch tags are essentially ''immutable''. Once you make one, that branch is there.
    and "descriptive" is a descriptive name for your branch


  - Note: With GEOS-5 we do not branch the entire model. Rather we branch
==Branching files==
    individual files that are edited. There may be special circumstances
    when branching an entire directory (say, a leaf Gridded Component)
    might be correct, but this should only be done with approval.


To branch your modified file on a new branch:
'''Note''': With GEOS-5 we do not branch the entire model. Rather we branch individual files that are edited. There may be special circumstances when branching an entire directory (say, a leaf Gridded Component) might be correct, but this should only be done with approval.


  You've made modifications to file.F90 and want to save these to a new
To branch your modified file on a new branch, assume you've made modifications to file.F90 and want to save these to a new branch of the model. To do so:
  branch of the model. To do so:


  1. Tag the root of your new branch with:
===Tag the ROOT of your new branch===


      cvs tag b_XYZ_descriptive_ROOT file.F90
We recommend that prior to branching your code, you tag where you branched from by running:


      [ What this does is tag where your branch came from to allow
cvs tag b_XYZ_descriptive_ROOT file.F90
        for easy tracing of your modifications. ]


  2. Create a branch relative to that tag:
This can aid in allowing for easy tracing of your modifications to know where you started from.


      cvs tag -r b_XYZ_descriptive_ROOT -b b_XYZ_descriptive file.F90
===Create a branch relative to ROOT tag===


      [ This says relative to that ROOT, create a branch of name
This says relative to that ROOT, we create a branch of name <code>b_XYZ_descriptive</code>:
        b_XYZ_descriptive. ]


  3. Update your file to your new branch:
cvs tag -r b_XYZ_descriptive_ROOT -b b_XYZ_descriptive file.F90


      cvs update -r b_XYZ_descriptive file.F90
===Update your file to your new branch===


      [ We now update to the new branch so we can commit. ]
We now update to the new branch so we can commit.


  4. Commit your code:
cvs update -r b_XYZ_descriptive file.F90


      cvs commit file.F90
===Commit your code===


  5. Tag your code and update to that tag (optional):
Finally commit your code with:


      cvs tag my-tag-name file.F90
cvs commit file.F90
      cvs update -r my-tag-name file.F90


      [ As non-branch tags are easy to remove and change, naming
This will open up your favorite editor to add an explanatory message. We recommend this message start with your initials (so when doing <code>cvs log</code> we know who added the message:
        practices are not as strict here. The plus of tagging
 
        and then updating to that tag is that you can't commit
XYZ: Added new functionality to file.F90
        to a sticky tag, so you have to explicitly update to
CVS: ----------------------------------------------------------------------
        a branch to figure it out. ]
CVS: Enter Log.  Lines beginning with `CVS:' are removed automatically
CVS:
CVS: Committing in .
CVS:
CVS: Modified Files:
CVS:  Tag: b_XYZ_descriptive
CVS:  file.F90
CVS: ----------------------------------------------------------------------
 
===Tag your code and update to that tag (optional)===
 
As non-branch tags are easy to remove and change, naming practices are not as strict here. The plus of tagging and then updating to that tag is that you can't commit to a sticky tag, so you have to explicitly update to a branch to figure it out.
 
cvs tag my-tag-name file.F90
cvs update -r my-tag-name file.F90
 
==Renaming tags==
 
With CVS it is fairly simple to rename a tag '''''that is not a branch tag'''''. Assume you have two tags, a <code>bad_tag</code> name you wish to change to a new <code>good_tag</code> name. First, tag all files that have the old tag with the new tag relative to that tag:
 
$ cvs tag -r bad_tag good_tag file1.F90 file2.F90 file3.F90
T file1.F90
T file2.F90
T file3.F90
 
Then remove <code>bad_tag</code> from those files:
 
$ cvs tag -d bad_tag file1.F90 file2.F90 file3.F90
D file1.F90
D file2.F90
D file3.F90
 
[[Category:SI Team]]
[[Category:CVS]]

Latest revision as of 08:43, 3 January 2013

Branch Name Style

We recommend using

b_XYZ_descriptive 

where XYZ are your initials and descriptive is a descriptive name for your branch.

Note: Branches and branch tags are essentially immutable. Once you make one, that branch is there.

Branching files

Note: With GEOS-5 we do not branch the entire model. Rather we branch individual files that are edited. There may be special circumstances when branching an entire directory (say, a leaf Gridded Component) might be correct, but this should only be done with approval.

To branch your modified file on a new branch, assume you've made modifications to file.F90 and want to save these to a new branch of the model. To do so:

Tag the ROOT of your new branch

We recommend that prior to branching your code, you tag where you branched from by running:

cvs tag b_XYZ_descriptive_ROOT file.F90

This can aid in allowing for easy tracing of your modifications to know where you started from.

Create a branch relative to ROOT tag

This says relative to that ROOT, we create a branch of name b_XYZ_descriptive:

cvs tag -r b_XYZ_descriptive_ROOT -b b_XYZ_descriptive file.F90

Update your file to your new branch

We now update to the new branch so we can commit.

cvs update -r b_XYZ_descriptive file.F90

Commit your code

Finally commit your code with:

cvs commit file.F90

This will open up your favorite editor to add an explanatory message. We recommend this message start with your initials (so when doing cvs log we know who added the message:

XYZ: Added new functionality to file.F90
CVS: ----------------------------------------------------------------------
CVS: Enter Log.  Lines beginning with `CVS:' are removed automatically
CVS: 
CVS: Committing in .
CVS: 
CVS: Modified Files:
CVS:  Tag: b_XYZ_descriptive
CVS:  file.F90 
CVS: ----------------------------------------------------------------------

Tag your code and update to that tag (optional)

As non-branch tags are easy to remove and change, naming practices are not as strict here. The plus of tagging and then updating to that tag is that you can't commit to a sticky tag, so you have to explicitly update to a branch to figure it out.

cvs tag my-tag-name file.F90
cvs update -r my-tag-name file.F90

Renaming tags

With CVS it is fairly simple to rename a tag that is not a branch tag. Assume you have two tags, a bad_tag name you wish to change to a new good_tag name. First, tag all files that have the old tag with the new tag relative to that tag:

$ cvs tag -r bad_tag good_tag file1.F90 file2.F90 file3.F90
T file1.F90
T file2.F90
T file3.F90

Then remove bad_tag from those files:

$ cvs tag -d bad_tag file1.F90 file2.F90 file3.F90
D file1.F90
D file2.F90
D file3.F90