I’ve been bored at work, and figured I could search for a way to perform CVS operations from inside VS.Net. Nothing fancy, like the kind of integration VS does with VSS, just a way to maybe do a CVS diff from inside VS without having to browse to that directory and do it.

Since we use TortoiseCVS at work, it makes these things a lot easier, but still the part about locating a file inside a huge directory structure is a real time killer. I started by looking at what cvs.exe in the TortoiseCVS directory could do, but it required the server and CVS Root to be specified, didn’t like absolute paths and had pathnames the Unix way. Even if you hardcoded those and call cvs-diff, it still shows you the diff in the console, and not in my diff tool. Getting that done would involve writing a macro to check out the file to a temporary location and then calling the diff.

Then I happened to come across TortoiseAct here and then in a mailing list thread. And guess what, all we need to do is pass the required action and the filename to TortoiseAct, and it takes care of everything: the CVS server and root,  authentication, checking out to a temporary location and opening my favourite diff tool.

The next step is to add it as an external tool in VS.Net. For example, to invoke CVS Diff, you must create a new External Tool with the Command being the path to the TortoiseAct exe (which for me is “C:\Program Files\TortoiseCVS\TortoiseAct.exe”), and the Arguments being “CVSDiff -l $(ItemPath)”. The file TortoiseMenus.config has a list of other commands that TortoiseAct can run. Now it’s just a matter of opening a file in the VS.Net editor, and starting the CVSDiff external tool!

Advertisements