Accueil du site > INFORMATIQUE > CVS : Moving and renaming files using :local : repository

CVS : Moving and renaming files using :local : repository

samedi 22 avril 2006, par Thierry Bothorel

Toutes les versions de cet article : [English ] [français ]

Renaming and moving files is possible with a :local : CVS repository.

I used [CVS] for an open source project and the main drawback is the fact that you can’t rename or move files without losing file history. For CVS, it is a new file. Since several years, we can see many projects using a new versioning system, [Subversion], which handle properly this feature along other enhancements.

As I am accustomed to CVS, I must admit i’m stuck with it, as for the moment I use it only on my local system. I use also a lot of some goodies linked to CVS as a PERL script that build automatically a ChangeLog file, or CVSWEB NT to browse a local repository (I don’t want to install [Python] just to use it for ViewVC (formerly ViewCvs). These tools are very handy because they do not need a fully qualified CVS server to run. They read files from your repository straight from your file system thanks to [RCS] tools.

There is an indirect advantage to this CVS drawback. You have to think carefully to your files names and directory structure before committing them, whereas with Subversion this is not so important. But the fact was that I continued to use CVS locally as I was using it on the Internet.

One week ago, as I need to change a file name, I decided trying to change it within the repository instead. Miracle, it works ! Why didn’t I tried this before ! I was afraid that CVS stores changes internally in a more complex way, but this is not the case. All changes to a file are stored within this file name within the repository. For example, you have a file config.inc that you want to rename to config.inc.php. Go to you repository, rename

to

and that’s it ! Make an update on you sandbox and your renamed file appears, with all its history as it was its name since the beginning.

With last CVS versions, there is a new line at the bottom of each commit informations block :

It’s the filename line with the name of the file. If you changed the name of your file, previous commit blocks keep the previous name, but this has no effects with new blocks.

Moving and renaming directories works well too. Beware that contrary to Subversion, CVS does not track name changing. Your renamed files will be shown as if they had this new name since version 1.1.

Répondre à cet article | RétroLiens :0


Répondre à cet article