Re: interaction between cvsimport and cvsexportcommit
- From
Robin Rosenberg <robin.rosenberg.lists@dewire.com>
- Date
- Jun 8, 2007, 15:11 UTC
- Message-ID
- <200706081711.57463.robin.rosenberg.lists@dewire.com>
- In-Reply-To
- <20070608154222.56870830@localhost.localdomain>
fredag 08 juni 2007 skrev picca:
Show 15 quoted lines
> Hello > > In the institut where I am working www.synchrotron-soleil.fr, the > "computing department" use CVS for all their projects. As I am not from > this department (I am a scientist), I can use my own tools and git is > one of them. > Nevertheless I need to interact with them (I am writting a C++ > library to control diffractometers) so I use cvsimport and > cvsexportcommit. > > The point is that I find this over complicate compare to my git > day-to-day experience. > > I do not understand why cvsimport and cvsexportcommit do not > interact nicelly to ease git <-> cvs.
git-cvsexportcommit was written (I assume, since I did not actually write the original version) to solve a problem and not to be a perfect solution.
Later I found it didn't do what I needed so I made improvements (to solve /my/ problems, mainly in reliability and completeness (binaries, add remove, all or nothing). The rest was just inconvenience and I did not consider my solution to that universally viable so I didn't include it in in cvsexportcommit.
Show 7 quoted lines
> For example as a neeby I expect this to work out of the box > after the first cvsimport > > git cvsimport > do some work > git commit -a > git cvsexportcommit
This assume you really want to export all. I don't, but I agree that it should in principle be this simple. Patches anyone?
Show 15 quoted lines
> and that's all > > Instead of this we have this: > > $ export GIT_DIR=~/project/.git > $ cd ~/project_cvs_checkout > $ git-cvsexportcommit -v <commit-sha1> > $ cvs commit -F .mgs <files> > > or even worse > > $ export GIT_DIR=~/project/.git > $ cd ~/project_cvs_checkout > $ git-cherry cvshead myhead | sed -n 's/^+ //p' | xargs -l1 > git-cvsexportcommit -c -p -v
> > what is missing in cvsexportcommit and cvsimport to lower the git <-> > cvs barrier.
Here is my script that I use to export. It takes as arguments a number of commits or stgit patches. Note that hardcoded path to the CVS checkout...
Here's an exercise to the reader: Modify git-cvsexportcommit so it takes the path to the CVS checkout from 1) a parameter (e.g. -w /checkout) or 2) a git config variable. That will get get us a small step closer. It will be fairly easy.
Cheers -- robin
--------------------------8<------------------------- #!/bin/bash -ex
if [ "$1" = "-p" ]
then
P="-p $2"
shift 2
fi
export GIT_DIR=$(git-rev-parse --git-dir)
GIT_DIR=$(cd $GIT_DIR;pwd)
cd ../Iris.CVSsynconly
for patch in "$@"
do
if commit=$(git-rev-parse $patch 2>/dev/null); then
git-cvsexportcommit-u $(echo $P) -c $commit
else
head=$(git-symbolic-ref HEAD)
br=${head#refs/heads/}
if commit=$(git-rev-parse refs/patches/$br/$patch); then
git-cvsexportcommit -u $(echo $P) -c $commit
fi
fi
done