suggestions for CVS use
Jason Stephenson
jason at sigio.com
Wed May 7 11:49:46 EDT 2003
Erik Price wrote:
> Hi,
>
> I use CVS for source code control for my projects, and in general I
> really like it. There's just one thing that really bothers me. If you
> wish to rename a file, or move a file to another directory, you have to
> jump through hoops by basically creating a new file for it and
> indicating that the old file is no longer in the project. And it's even
> worse for old directories (that are no longer in the project) because
> they still get generated by a checkout, even if they're empty. Unless
> I'm doing something wrong.
Yes, that's an issue for some people with CVS. When you move or rename a
file or directory, you have to create it under the new name and delete
the old name (both in the filesystem and in cvs). Which is why I never
put anything that I'm working on by myself into CVS until I've got my
first "release" version done. I've used a few source code control
systems (cvs, rcs, sccs, and some proprietary systems on Windoze whose
names escape me at the moment), and they all suffer from this deficiency.
As for old directories, I use -P option when updating and checking out.
This will remove empty directories from the working copy.
> The problem is when refactoring class names or refactoring classes from
> one package to another. Public classes need to be in a file of the same
> name, and the Java package hierarchy is enforced at the filesystem level
> in this fashion. I like this because it helps keep things clean, but
> it seems CVS wasn't designed for this kind of flexibility. Does anyone
> have any tips in this regard? Is this something that is taken into
> account in Subversion (I think I remember Paul saying he uses Subversion).
This is partly a problem with CVS and partly a Java problem. (The way
libraries are laid out by directory in Java bugs me.) The problem is
that points of inflexibility in both Java and CVS are rubbing up against
each other.
I don't think the desiginers of CVS had this sort of thing in mind.
After all, CVS is modeled heavily on RCS, which is entirely directory
based. You run RCS on a directory full of files and it creates an RCS
subdirectory in that directory. CVS adds the notion of the central
repository. It's assumed that when you add a file to the repository,
it's going to stay in that location.
Same thing with Java. The whole library/directory structure was not
designed with refactoring in mind.
It would be possible to add a 'cvs rename' command. It would be
nontrivial though not impossible to implement, which is why there
probably isn't one now. Alternatively, you could get the same effect by
manually jacking with the repository and CVS files in your working copy,
but I wouldn't recommend it to anyone who doesn't understand how it all
works internally. Someone has probably written a utility that will munge
the repository so that version info is tracked across moved files and
old, empty directories are actually removed. There is a huge potential
for corruption of the repository and/or working copy in doing this sort
of thing.
> Maybe I can ask my sysadmin to think about installing it, if Subversion
> is really a lot nicer -- but I kind of doubt it because IIRC it'd
> require changes to be made to the webserver. It's a Gentoo box.
I've not used Subversion. When I was looking into it, it wasn't quite
ready for prime time. There were still quite a few features on the TODO
list that I needed before I could try it out. I'll have to check it out,
again. I'm sure those missing features have been added since.
I'm definitely interested to know how it handles renaming files and
directories.
More information about the gnhlug-discuss
mailing list