CVS

From Mu2eWiki
Jump to navigation Jump to search

Expert.jpeg This page page needs expert review!

Introduction

Our primary code base has moved to [1]. No current repositories are stored using the Concurrent Version System (CVS) on Fermilab redmine but some archival information is still there. There is little to no current information on this page.

There is a read-only interface to browse files in the repository http://cdcvs.fnal.gov/cgi-bin/public-cvs/cvsweb-public.cgi/mu2e/. This is not a fully functional code browser but it is a start.

Access to the repository, for both read and write, is restricted and is based on your Fermilab kerberos principal. To get authorization to use Mu2e's cvs, send an email, containing your kerberos principal, to kutschke@fnal.gov.

Setting Environment Variables

To access files in the repository you need to first get a kerberos ticket and set two enviroment variables. For csh flavor shells (csh, tcsh) the instructions are:

setenv CVSROOT   mu2ecvs@cdcvs.fnal.gov:/cvs/mu2e
setenv CVS_RSH   /usr/bin/ssh
setenv CVSEDITOR /usr/bin/xemacs  # For example; see below.

For sh flavor shells ( sh, bash) the instructions are:

export CVSROOT=mu2ecvs@cdcvs.fnal.gov:/cvs/mu2e
export CVS_RSH=/usr/bin/ssh
export CVSEDITOR=/usr/bin/xemacs  # For example; see below.

For a Mac using the ssh3a version of ssh the last line should read:

export CVS_RSH=/usr/bin/ssh3a

In all cases the value of CVSROOT must be given exactly as shown. The example value of CVS_RSH is correct for Scientific Linux Fermi, versions 4.* and 5.*. On other machines it may be different; it should be the complete path of the name of a kerberos aware version of ssh that is compliant with Fermilab's use of kerberos.

Setting the CVSEDITOR environment variable is not necessary but most people will find it useful. This controls the editor that will be used when you are asked to supply a comment for a cvs commit operation. If you do not specify an editor then a system default, usually vi, will be chosen; if you are not familiar with vi you will then be trapped. This is discussed further in CVS Cheat Sheet section on cvs commit.


Forwarding Kerberos Tickets

If you kinit on your laptop ( or desktop ) you will be able to run cvs to check out and commit files. If you log in from your laptop to the interactive machines you should be able to run cvs on those machines. If you get a "permission denied" error from the cvs server, there are two things to check:

  • Check that the kerberos ticket on your laptop is still valid.
  • Check that the ticket was forwarded to the interactive machine. This can be done with the -A option on ssh or by configuring ssh and kinit defaults on your laptop.

If the ssh defaults for your computer are set up correctly, the following step is not necessary. If the ssh defaults for your computer are incorrect, then you should override them for your own account by adding the following lines to your ~ssh/.config:

host cdcvs.fnal.gov
  ForwardX11 = no
  GSSAPIAuthentication yes
  GSSAPIDelegateCredentials yes

The cvs User Areas

We have provided a cvs area for people to keep side projects and code that is not yet ready to be in an official cvs release. At the cvs top level there is a subdirectory Users, in which people may create subdirectories for themselves. If a subdirectory has already been created for you, you can check out its contents with:

cvs co Users/yourKerberosPrincipal


To create your own User cvs area:

cvs co Users/nobody
cd Users
mkdir <yourKerberosPrincipal>
cd <yourKerberosPrincipal>
cp yourfiles .
cd ..
cvs add <yourKerberosPrincipal>
cvs commit -m "Comment about what you did." <yourKerberosPrincipal>

where you should replace <yourKerberosPrincipal> with the name of your kerberos principal. A quirk of cvs is that when you cvs add a new directory there must already be at least one file in that directory; if not, cvs gets confused. See also the [CvsCheatSheet]] section on adding directories in the CvsCheatSheet. There is no technical enforement that the directory name you create for yourself must match your kerberos principal but please follow that convention.

These areas are not protected. So if several people wish to collaborate on a project they can agree to set up their code base in the cvs space of one of the group.

In an earlier incarnation of this I called this cvs space "Personal" not "Users". Please use "Users" space. At some point "Personal" will go away.

Import to Github

************************************************************
import cvs

export CVSROOT=mu2ecvs@cdcvs.fnal.gov:/cvs/mu2e
export CVS_RSH=/usr/bin/ssh
cvs co Users/knoepfel/CoordinatePackage

****************** cvs2svn
mu2einit
setup cvs

mkdir cvs
rsync -av mu2ecvs@cdcvs.fnal.gov:/cvs/mu2e/Users/knoepfel/CoordinatePackage cvs
rsync -av mu2ecvs@cdcvs.fnal.gov:/cvs/mu2e/CVSROOT cvs


note: requires python 2.7  (do not setup offline)
git clone https://github.com/mhagger/cvs2svn
export DESTDIR=<local dir> 
make install
DESTDIR will contain a usr/bin and usr/lib

cp cvs2svn/cvs2git-example.options ./cvs2git.options
  edit cvs2git.options (path to cvs pacakge)
    r'cvs/CoordinatePackage',

export PYTHONPATH=$PYTHONPATH:$DESTDIR/usr/lib/python2.7/site-packages

$DESTDIR/usr/bin/cvs2git --options=cvs2git.options --fallback-encoding utf-8
creates ./cvs2git-tmp dir with migration files

create repo on gtihub, fork to personal account
git clone git@github.com:rlcee/CoordinatePackage

cd CoordinatePackage
cat ../cvs2git-tmp/git-{blob,dump}.dat | git fast-import


git checkout -b import2 origin/main
git merge --allow-unrelated-histories master
check git log
git push origin
make PR, merge