<?xml version="1.0" encoding="ISO-8859-1"?><!DOCTYPE document PUBLIC "-//APACHE//DTD Documentation V1.3//EN" "document-v13.dtd">
<document xmlns:xi="http://www.w3.org/2001/XInclude" xml:lang="en">
  <header>
    <title>How to use CVS</title>
    <authors>
      <person email="trond.trosterud@hum.uit.no" name="Trond Trosterud"/>
      <person email="boerre.gaup@samediggi.no" name="Børre Gaup"/>
      <person email="sjur.moshagen@samediggi.no" name="Sjur N. Moshagen"/>
    </authors>
  </header>
  <body>
<warning>This documentation is obsolete! We do no longer use cvs, but svn.</warning>
      <p>We first cover cvs on victorio, then cvs on another Linux machine, then cvs on
         Windows, and finally cvs on the Mac.</p>

      <note>Trond, Børre: The general-philosophical part of this document should be moved to an svn document.</note>
           

      <section>
        <title>A crash course in CVS</title>

        <section>
          <title>What is it?</title>

          <p>CVS, or Concurrent Version System, is a program that keeps track of different versions of the same files. This is done by keeping an original of the files in a different place. Thereafter each user must <strong>check out</strong> a copy of the original, and work on that copy. After the work is done,the new version of the file must be <strong>checked in</strong> to the repository again. Thereafter, all workers will receive the new and updated version of the file when they check it out.</p>
        </section>

        <section>
          <title>How do I use it?</title>
          <p>Be sure to always have the latest version of the project files, by giving the command <strong>cvs update</strong> (or <strong>cvs up</strong>) whenever you log in. When you have worked on a file, check in the file 'filename' with the following command:</p>
          <p>cvs ci -m "Write a short log command here" filename</p>
          <p>If you want to write a longer log command, write</p>
          <p>cvs ci filename</p>
          <p>and you will get an emacs window where you can write your command. When you are done, write <strong>C-x-c</strong> as you always do in emacs, and the log command will be saved.</p>
        </section>

        <section>
          <title>How often do I check in?</title>
          <p>Always check in the files at the end of the day. If you know that other people are working on the same file, you should check in more often than that. You should also check in after you have done major revisions. Remember to compile the program before you check in, so that you know you do not check in a defect file.</p>
        </section>

        <section>
          <title>What do I write in the log message</title>
          <p>The best way to learn to write good log messages is to read other log messages. Pick a file (e.g. twol-sme.txt, sme-lex.fst), and read the log (the command is <strong>cvs log filename | less</strong>). If the log message tells you what you want to know, then it is a good log message.</p>
          <p>That was the crash course, here come some more details.</p>
        </section>

      </section>

      <section>
        <title>Checking out the files when working on victorio (the project's own machine)</title>

        <p>The first session you get yourself a version of the project, with the command <strong>cvs checkout gt</strong>. All subsequent sessions you should go to the gt directory (in your home directory, write "cd gt"), and start the session by the command <strong>cvs update -dP</strong>. The reason for this is to ensure that you start out with the most recent version of the files and folders.</p>
        
	<p>The most important cvs commands are found below, with comments in parentheses after each command.</p>
        <dl>
          <dt>
            <code>cvs update -dP</code>
          </dt>
          <dd>(to get recent versions of the files that are already there, and new folders and files that have been added.)</dd>
          <dt>
            <code>cvs up -dP</code>
          </dt>
          <dd>(short version of the same command)</dd>
        </dl>

        <p>Then work hard on e.g. the file called file.txt. Save the file you worked on. Then the file must be checked in (by "cvs commit") to make it available to the other workers. Check in at least once a day, in order to avoid conflicts arising from other people working on files that do not (yet) contain your updates.</p>
        
	<dl>
          <dt>
            <code>cvs commit filename</code>
          </dt>
          <dd>(to make the file available to all other workers)</dd>
          <dt>
            <code>cvs ci filename</code>
          </dt>
          <dd>(a short version of the same command)</dd>
        </dl>

        <p>Then cvs asks you to write a log comment. Do that. Then write 'ctrl x ctrl c' (i.e., quit emacs). cvs ci -m "short log comment" filename if all you want to write is "short log comment".</p>
        <p>There is an alternative way of checking in files. If you have worked on the file in emacs (as we do in this project), you may write C-x C-q instead of the normal emacs command C-x C-c. Then you get a buffer asking for a log text. Terminate you log text with C-c C-c, and, voila, the file is checked in in cvs. (This method works for RCS as well).</p>
        <p>Other commands:</p>
        <dl>
          <dt>
            <code>cvs log filename | less</code>
          </dt>
          <dd>(to see earlier log comments written to the file filename)</dd>
          <dt>
            <code>cvs add filename</code>
          </dt>
          <dd>(to make a new file available to be checked in to the cvs system. After you have used the <code>cvs add</code> command, you must write <code>cvs ci -m "..." filename</code> (where <code>...</code> is the log message) in order to check in the file)</dd>
          <dt>
            <code>cvs diff filename</code>
          </dt>
          <dd>(to see the difference between your local version of a file and the version in the repository; this command works only when there is an <strong>M</strong> before the file name when you write "cvs up")</dd>
          <dt>
            <code>cvs diff -r 1.123 filename</code>
          </dt>
          <dd>(to see the difference between the current version and version number 1.123)</dd>
          <dt>
            <code>cvs diff -r 1.123 -r 1.124 filename</code>
          </dt>
          <dd>(to see the difference between version number 1.123 and version number 1.124)</dd>
          <dt>
            <code>cvs co -r 1.123 filename</code>
          </dt>
          <dd>If you work on revision 1.125, and suddenly find out everything that was done since 1.123 has been a disastrous dead end, you may go back and check out version 1.123 with this command.</dd>
        </dl>

        
	<section>
          <title>Messages from cvs when you update</title>
          <ul>
            <li>An <strong>M</strong> before the filename indicates that your own file has been altered, and is not up to date. <ul>
                <li>If you know what changes you have done: Write "cvs ci filename" and make your log comment.</li>
                <li>If you do not remember what changes you have done: Write "cvs diff filename"</li>
              </ul>
            </li>
            <li>A <strong>U</strong> or <strong>P</strong> before the filename indicates that someone else has altered the file, and that your version has been updated. (If you want to see what has been done, look at the log comment, with "cvs log filename | less")</li>
            <li>A <strong>C</strong> before the filename indicates a conflict. You should now open the file in your editor (emacs), look at it, and resolve the conflicts. That means that you write the text as you think it shall be, and that you delete all text that was inserted by cvs (&lt;&lt;&lt;&lt;&lt;&lt;&lt;&lt;&lt;&lt;, &gt;&gt;&gt;&gt;&gt;&gt;&gt;&gt;&gt;&gt;&gt;, line numbers, etc.)</li>
          </ul>

        </section>
      </section>
      <section>
        <title>General manuals</title>
        <p>The official CVS manual is <link href="http://www.cvshome.org/docs/manual/cvs.html">http://www.cvshome.org/docs/manual/cvs.html</link>, also known as 'the Cederqvist Manual'.</p>
        <p>CVS Pocket Reference</p>
        <p>You may also write <strong>info cvs</strong> on the command line, that manual is actually quite ok.</p>
      </section>
      <section>
        <title>cvs in victorio.uit.no</title>
        <p>You need a username in the master cvs server, victorio.uit.no, and cvs group membership. All persons associated with the project do have this. The following line is automatically executed in /etc/profile; only those who do not have bash as shell might need to set it manually (and we all have a bash shell on victorio).</p>
        <p>
            <code>export CVSROOT=/usr/local/cvs/repository</code>
        </p>
      </section>
      <section>
        <title>Setting up environment for remote cvs use on a Linux and Mac OSX machine</title>
        <p>'remote use' means that you check out the cvs files to a machine different from victorio.uit.no. You then work offline on your local machine (at home, or on travel). Then, returning to a place where you are online, you may check in and update your cvs files as normal. In this way, you have <strong>two</strong> sandboxes (i.e.: you have two copies of the source files): One copy on victorio, and one copy on your own local computer. Note that these two sandboxes are independent of each other.</p>
        <p>You need a ssh client in your local computer that can connect to victorio. If you have Linux or Mac OSX this is already in place. You also need a username in the master cvs server, victorio.uit.no, and cvs group membership in victorio. Then you need to set up your local machine. The following lines should be added into your local initialization file (this is the file <em>.profile</em> for bash on Linux, on Mac OSX).</p>
        <p>
          <code>export CVSROOT=:ext:username@victorio.uit.no:/usr/local/cvs/repository</code>
        </p>
        <p>
          <code>export CVS_SSH=ssh</code>
        </p>
        <p>Another (much more cumbersome) way is to specify the repository attributes on each command line:</p>
        <dl>
          <dt>Write the following command:</dt>
          <dd>
            <code>cvs -d :ext:username@victorio.uit.no:/usr/local/cvs/repository co gt</code>
          </dd>
        </dl>
        <p>You are then prompted for your password to victorio. You can leave out your remote (victorio) username if your local username and username in victorio are the same.</p>
        <p>That is all! Then you run cvs as described above: cvs update to update, etc. You will be prompted for password at every occasion, but otherwise it is the same procedure as for local work (if there are many changes done, it might be easier to first copy all the files to victorio via scp, and thereafter copy them to the sandbox and do cvs update there).</p>
      </section>
      <section>
        <title>Using CVS on a Windows machine: TortoiseCVS</title>
        <section>
          <title>The program</title>
          <p>Here we assume that you already have an account at victorio.uit.no, and that you are able to use it via putty.exe on your Windows machine, and that you are sitting on your windows machine now.</p>
          <p>To be able to use CVS you need the program TortoiseCVS, which can be downloaded from their homepage, <link href="http://www.tortoisecvs.org/">www.tortoisecvs.org</link> (when we migrate to svn there will also be a tortoiseSVN waiting for us). Just download the program and store it into your Program Folder</p>
          <p/>
        </section>
	<section>
	  <title>Usage</title>
	  <p>When the program is installed, go to the folder where you want to keep the language technology files (e.g. <code>My Documents</code>). In that folder, right-click with the mouse on an empty spot in the folder. You will note that the context-sensitive menu has some additions in the middle, where it reads CVS and something. Choose the <code>CVS Checkout</code>. You will then get a panel, where you fill in your account data.</p>
	  <p>Now you may edit the files, e.g. with EditPad Lite, Notepad++ or XMLEditor. When you have edited them you will note that the green symbol attached to the file symbol has turned orange. This means you should <code>check in</code>. Right click on the file icon, and choose <code>check in</code>. Write a log message, and click OK.</p>
	  <p>The general principles are the same for CVS usage here as elsewhere: Always update before you start working (right-click, and CVS Update), and always check in when you are done with your work, minimum once a day.</p>
	  <p>There also is a <link href="http://www.tortoisecvs.org/support.shtml">User Guide</link> (in a strange format).</p>
        </section>
      </section>
      <section>
        <title>Using CVS on a Mac</title>

        <section>
          <title>Command line usage</title>
          <p>CVS has been built-in to MacOS X since the very first day, and the basic procedures
             are exactly as described above for Linux outside victorio.</p>
        </section>

        <section>
          <title>Graphical clients</title>
          <p>There are a couple of excellent graphical clients available for MacOS X. The one
             used in our projects is <link href="http://www.sente.ch/software/cvl/">Concurrent
             Versions Librarian (CVL)</link>. More detailed instructions on how to set-up and
             check-out from victorio using CVL can be found on <link href="../infra/forrest-howto.html">another
             page</link>.</p>
        </section>
      </section>

      <section>
        <title>Resurrecting files from the dead (the Attic)</title>

        <p>If you have committed a file as 'dead', that is marked it as removed, and commited
           that change, the file is moved to the attic. Sometimes you may want to bring it
           back into life again, and to do that you should follow the procedure outlined here
           (this is taken from <link href="https://ccvs.cvshome.org/fom//cache/312.html">the CVS
           FAQ-O-Matic</link>):</p>

        <ol>
          <li>Identify the deleted revision of the file, simply performing a 'status' on the
              file will reveal this (paths shortened for readability):
<source xml:space="preserve"><![CDATA[
a84-230-135-66: sjur$ cvs status ulikestavelsesverb.xml
===================================================================
File: no file ulikestavelsesverb.xml            Status: Up-to-date

   Working revision:    No entry for ulikestavelsesverb.xml
   Repository revision: 1.2     /.../gram/sma/Attic/ulikestavelsesverb.xml,v
]]></source>
          </li>
          <li>We now need to check out the revision prior to being deleted
<source xml:space="preserve"><![CDATA[
a84-230-135-66:~/.../gram/sma sjur$ cvs up -r 1.1 -p ulikestavelsesverb.xml > ulikestavelsesverb.xml
cvs update: use `cvs add' to create an entry for ulikestavelsesverb.xml
]]></source>
          </li>
          <li>We can now add the file again, restoring the previous revision:
<source xml:space="preserve"><![CDATA[
a84-230-135-66:~/.../gram/sma sjur$ cvs add ulikestavelsesverb.xml
cvs add: Re-adding file `ulikestavelsesverb.xml' (in place of dead revision 1.2).
cvs add: use 'cvs commit' to add this file permanently
]]></source>
          </li>
          <li>Finally we commit the change:
<source xml:space="preserve"><![CDATA[
a84-230-135-66:~/.../gram/sma sjur$ cvs ci "Resurrected this file from the dead ..."
   cvs commit: Examining .
   Checking in ulikestavelsesverb.xml;
   /.../gram/sma/ulikestavelsesverb.xml,v  <--  deleted_file
   new revision: 1.3; previous revision: 1.2
   done
]]></source>
          </li>
        </ol>

      </section>

      <section>
        <title id="trouble">Troubles using cvs</title>
        <p>What if you get an error message like the following?</p>
        <p>You type <code>cvs co gt</code>, as you have been told. The machine answers:</p>
        <source xml:space="preserve"><![CDATA[cvs update: No CVSROOT specified! Please use the '-d' option.]]></source>
        <p>Then answer with the following magic spell:</p>
        <source xml:space="preserve"><![CDATA[cvs -d /usr/local/cvs/repository/ co gt]]></source>
        <p>Why you have to do this I do not know.</p>
      </section>
      <p class="last_modified">Last modified: $Date: 2008-11-05 18:52:54 +0100 (ons, 05 nov 2008) $, by $Author: boerre $</p>
  </body>
</document>
