.. _How can I configure Eclipse to use a local CVS repository?:

How can I configure Eclipse to use a local CVS repository?
==========================================================

#.  Create a shell script with the contents :ref:`below <Script content>` somewhere on disk and make it executable.
#.  In Eclipse, go to the CVS preference page (:menuselection:`Window --> Preferences --> Team --> CVS --> Ext Connection Method`)

    * Select **Use an external program to connect**
    * For **CVS_RSH** enter the path to the script you just created
    * For **Parameters** enter a whitespace (won't work if left empty)
    * For **CVS_SERVER** you should have **cvs**
#.  Add a new CVS repository location in Eclipse (:menuselection:`File --> New --> Other --> CVS --> CVS Repository Location`)

    * For **Host** enter **localhost**
    * For **Repository path** enter the local absolute path to your repository
    * For user and password you can enter anything (will not be taken into account)
    * For connection type select **ext**

At this point the repository you've just created should be functional in Eclipse. You can checkout a module to see that everything is OK. In order to make cvs work in the command line as well (with projects  checked out from Eclipse) you have to set the system variable ``CVS_RSH`` to point to the script and ``CVSROOT`` to the the local absolute path to your repository.

.. _Script content:

**Script content**

.. code-block:: console

 #!/bin/sh
 if [ "$1" != "cvs" ]; then
     # Remove -l {user} {host}
     shift
     shift
     shift
 fi
 exec "$@"
