CVS Best Practices: Difference between revisions

Cut-and-paste from doc in SI Team CVS
 
Wikify'd
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
==Branching files==
    and "descriptive" is a descriptive name for your branch


  - Note: With GEOS-5 we do not branch the entire model. Rather we 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.
    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:
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:


  You've made modifications to file.F90 and want to save these to a new
===Tag the ROOT of your new branch===
  branch of the model. To do so:


  1. Tag the root of your new branch with:
We recommend that prior to branching your code, you tag where you branched from by running:


      cvs tag b_XYZ_descriptive_ROOT file.F90
cvs tag b_XYZ_descriptive_ROOT file.F90


      [ What this does is tag where your branch came from to allow
This can aid in allowing for easy tracing of your modifications to know where you started from.
        for easy tracing of your modifications. ]


  2. Create a branch relative to that tag:
===Create a branch relative to ROOT tag===


      cvs tag -r b_XYZ_descriptive_ROOT -b b_XYZ_descriptive file.F90
This says relative to that ROOT, we create a branch of name <code>b_XYZ_descriptive</code>:


      [ This says relative to that ROOT, create a branch of name
cvs tag -r b_XYZ_descriptive_ROOT -b b_XYZ_descriptive file.F90
        b_XYZ_descriptive. ]


  3. Update your file to your new branch:
===Update your file to your new branch===


      cvs update -r b_XYZ_descriptive file.F90
We now update to the new branch so we can commit.


      [ We now update to the new branch so we can commit. ]
cvs update -r b_XYZ_descriptive file.F90


  4. Commit your code:
===Commit your code===


      cvs commit file.F90
Finally commit your code with:


  5. Tag your code and update to that tag (optional):
cvs commit file.F90


      cvs tag my-tag-name 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 <code>cvs log</code> we know who added the message:
      cvs update -r my-tag-name file.F90


      [ As non-branch tags are easy to remove and change, naming
XYZ: Added new functionality to file.F90
        practices are not as strict here. The plus of tagging
CVS: ----------------------------------------------------------------------
        and then updating to that tag is that you can't commit
CVS: Enter Log.  Lines beginning with `CVS:' are removed automatically
        to a sticky tag, so you have to explicitly update to
CVS:
        a branch to figure it out. ]
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