[1068451 views]

[]

[toggle ads]

Odi's astoundingly incomplete notes

New entries | Code

Using CVS in Eclipse and from the shell

When working with Eclipse against a CVS repository it is sometimes necessary to perform certain CVS operations on the command line. A simple example is creating a diff between arbitrary tags / dates or diffing by date on a branch. Even though the Eclipse help system has an explicit page about this problem, it only tells half the story.
There are two problems to solve:

1. Make Eclipse use the ext method.
By default Eclipse uses its proprietary extssh method to connect to the repository, which command line CVS does not support. Go to the CVS Perspective, select the CVS location. Right-click and select Properties from the context menu. Set the connection type to ext. Click Apply and say yes to convert existing projects.
Now tell Eclipse to still use its built-in SSH client, open the Preferences dialog. Under Team > CVS > Ext Connection Method select Use another connection method type and select extssh.

2. Set the CVS_RSH environment variable to ssh.
Linux users will typically just include this in ~/.profile or ~/.bash_profile. Windows users have a harder time. First, they can not use Cygwin, because Cygwin's CVS client is incompatible with the Windows line endings used in the CVS meta data generated by Eclipse. So they must use a real Windows CVS client like TortoiseCVS. Tortoise has a command line client (cvs.exe). Plus it comes with an SSH client TortoisePlink.exe. So in the System Control Panel, under Advanced click the Environment Variables button and add the CVS_RSH variable and set it to the path to TortoisePlink.exe. You should also include the path to cvs.exe into the PATH variable.

Now you can use your CVS repository from Eclipse as well as from the command line.

posted on 2007-05-31 15:14 CEST in Code | 4 comments | permalink
Odi, I'm sorry but I never had to anything special to use command line cvs client (cvs.exe on windows) withing an Eclipse 3.2.1 project that has been checked out from cvs.

Once project is checked out I have normal file structure on disk (CVS/Root, CVS/Repository, CVS/Entries).

Admittedly I do get Apache lock problem
once in a while and perhaps switching method
can cure _that_, but it's a different prob.

Also, please right-click a folder or a file in Navigator view and try "Compare with another branch or version" menu item. This gives you lots of flexibility to diff your current code against tags. (There's a tricks how to make "Refresh tags" operation faster but that's again a different topic). No I'm not saying you can diff against date on branch but as for arbitrary tags looks like you can do it from Eclipse.

Anton Tagunov
While there are diff views in Eclipse, it's impossible to create patch files from them. So once you have committed there is no way to create a patch. At least not a simple one. That's why the command line is indispensible sometimes.

Happens to me quite often. At work we maintain a couple of branches (for production systems) of several projects. Sometimes a fix or feature is needed in the branches too and you get to know this only after you have committed. Thus the need to create patch files.

Of course life would be a little easier with changesets like git has.

Odi
Thanks for the CVS_RSH tip.
It's exactly what I was looking for!
The thread is old now. But is very useful

Thanks!