Source Control: Difference between revisions

From VrlWiki
Jump to navigation Jump to search
Jadrian Miles (talk | contribs)
No edit summary
Jadrian Miles (talk | contribs)
No edit summary
Line 4: Line 4:
# Go to the directory that has your source in it.
# Go to the directory that has your source in it.
# Delete or move away anything you don't want to go into CVS.  If you already have something compiled, do <code>make clean</code> to get rid of the object files---you don't want to put them in CVS. In general, just leave the Makefile and the source files.
# Delete or move away anything you don't want to go into CVS.  If you already have something compiled, do <code>make clean</code> to get rid of the object files---you don't want to put them in CVS. In general, just leave the Makefile and the source files.
#* '''Note:''' even though non-source files are sometimes necessary for builds of complex projects, data files don't belong in <code>$G/src</code>!  Carefully consider whether non-source files belong in the <code>$G/src</code>, and put all others in <code>$G/data</code> instead.
#* '''Note:''' even though non-source files are sometimes necessary for builds of complex projects, data and config files don't belong in <code>$G/src</code>!  Carefully consider whether non-source files belong in the <code>$G/src</code>; they most likely do not and belong in <code>$G/lib</code> (or <code>$G/data</code> for example data on which your program runs) instead.
# If you have any binary files, like images that you want to go in CVS, move them out of this directory temporarily.  We will add them later because CVS requires non-text files to be added with a special flag.  Once again, keep in mind that if a binary file is not necessary to the build process, it's probably data and belongs in <code>$G/data</code> instead.
# If you have any binary files, like images that you want to go in CVS, move them out of this directory temporarily.  We will add them later because CVS requires non-text files to be added with a special flag.  Once again, keep in mind that most binary files are program resources and belong in <code>$G/lib</code> instead. if a binary file is not necessary to the build process, it's probably data and belongs in <code>$G/data</code> instead.
# Run the following command, replacing &lt;projectname&gt; with the name you want your project to have---that will become a new directory under <code>$G/src</code>: <pre>gfxprojinit &lt;projectname&gt; .</pre>
# Run the following command, replacing &lt;projectname&gt; with the name you want your project to have---that will become a new directory under <code>$G/src</code>: <pre>gfxprojinit &lt;projectname&gt; .</pre>
#* Note the period at the end of that command.  It might be hard to see, but it is important.
#* Note the period at the end of that command.  It might be hard to see, but it is important.
#* It's worth knowing, for those familiar with CVS, that <code>gfxprojinit</code> is essentially a fancy wrapper around <code>cvs import</code>.  Please be sure to use <code>gfxprojinit</code> anyway, as it maintains important metadata and may do even more in the future.
#* It's worth knowing, for those familiar with CVS, that <code>gfxprojinit</code> is essentially a fancy wrapper around <code>cvs import</code>.  Please be sure to use <code>gfxprojinit</code> anyway, as it maintains important metadata and may do even more in the future.
# If you had some binary files you wanted to add to CVS like images that you load up in your program, do the following for each file:
# If you had some extra files you wanted to add to CVS like build components, config files, program resources, or example data, you now want to check them into the relevant directories, which will be among <code>$G/src/&lt;projectname&gt;</code>, <code>$G/lib/&lt;projectname&gt;</code>, and <code>$G/doc/&lt;projectname&gt;</code>.  For each relevant directory, which we'll call <code>$X</code>, do the following:
## Copy the file to <code>$G/src/&lt;projectname&gt;</code>
## Create <code>$X</code>, import it into CVS, then delete it and check it back out.
## From within the <code>$G/src/&lt;projectname&gt;</code> directory run the command: <pre>cvs add -kb &lt;filename&gt;</pre>
## Copy each appropriate file into <code>$X</code>, and for each one run the command: <pre>cvs add -kb &lt;filename&gt;</pre>
# After adding all the files, run: <pre>cvs commit -m "&lt;Commit message&gt;"</pre>
## After adding all the files, run: <pre>cvs commit -m "&lt;commit message&gt;"</pre>
# Your project should have been automatically added to the <code>$G/src</code> directory on the filesystem you are on now. To get it in the <code>$G/src</code> directory somewhere else, like at the [[Cave]], run this command from within <code>$G/src</code>: <pre>cvs update -d &lt;projectname&gt;</pre>
# Your project should have been automatically added to the <code>$G/src</code> directory on the filesystem you are on now. To get it in the <code>$G/src</code> directory somewhere else, like at the [[Cave]], run this command from within <code>$G/src</code>: <pre>cvs update -d &lt;projectname&gt;</pre> You may also need to use the same command in <code>$G/lib</code> and <code>$G/doc</code>.


[[Category:HOWTO]]
[[Category:HOWTO]]

Revision as of 09:16, 23 July 2008

The $G tree is not intended for users to write to directly, and future IT plans for our group include enforcing this restriction. Instead, we use the revision control system CVS as an interface to the directory structure in $G. CVS keeps track of changes to every file, allows concurrent editing of source code by multiple people, and provides an easy means for copying source trees to new locations.

Ordinarily, the first steps of development for your own software project happens somewhere in your homedir. This doesn't allow other people to work with your code, though, so once it's nontrivial you should add it to $G:

  1. Go to the directory that has your source in it.
  2. Delete or move away anything you don't want to go into CVS. If you already have something compiled, do make clean to get rid of the object files---you don't want to put them in CVS. In general, just leave the Makefile and the source files.
    • Note: even though non-source files are sometimes necessary for builds of complex projects, data and config files don't belong in $G/src! Carefully consider whether non-source files belong in the $G/src; they most likely do not and belong in $G/lib (or $G/data for example data on which your program runs) instead.
  3. If you have any binary files, like images that you want to go in CVS, move them out of this directory temporarily. We will add them later because CVS requires non-text files to be added with a special flag. Once again, keep in mind that most binary files are program resources and belong in $G/lib instead. if a binary file is not necessary to the build process, it's probably data and belongs in $G/data instead.
  4. Run the following command, replacing <projectname> with the name you want your project to have---that will become a new directory under $G/src:
    gfxprojinit <projectname> .
    • Note the period at the end of that command. It might be hard to see, but it is important.
    • It's worth knowing, for those familiar with CVS, that gfxprojinit is essentially a fancy wrapper around cvs import. Please be sure to use gfxprojinit anyway, as it maintains important metadata and may do even more in the future.
  5. If you had some extra files you wanted to add to CVS like build components, config files, program resources, or example data, you now want to check them into the relevant directories, which will be among $G/src/<projectname>, $G/lib/<projectname>, and $G/doc/<projectname>. For each relevant directory, which we'll call $X, do the following:
    1. Create $X, import it into CVS, then delete it and check it back out.
    2. Copy each appropriate file into $X, and for each one run the command:
      cvs add -kb <filename>
    3. After adding all the files, run:
      cvs commit -m "<commit message>"
  6. Your project should have been automatically added to the $G/src directory on the filesystem you are on now. To get it in the $G/src directory somewhere else, like at the Cave, run this command from within $G/src:
    cvs update -d <projectname>
    You may also need to use the same command in $G/lib and $G/doc.