Changing your CVS host

February 5th, 2009    1 Comment

What do you do if the host name of your CVS server changes? For example, here’s my case. I checked out a whole lot of CVS modules from the repository while my laptop was on the domain. Now however, thanks to Vista SP1 not playing with an antiquated NT domain, the laptop can’t join the domain so to connect to a server I need to qualify its name with a domain. So, whereas I checked out the modules using the hostname “cvshost”, I now need to use “cvshost.mydomain.co.uk”.

Unfortunately, TortoiseCVS has no way to change the host names for modules you’ve already checked out. WinCVS can, supposedly, do this thanks to a macro. However, WinCVS stubbornly tells me I don’t have Python installed (I do) and therefore won’t let me use macros.

The solution is to just go through all the CVS “Root” files and change the host name. The Root file lives in the CVS directory at each level within a checked out module. This would be a laborious task by hand, but if you have SUA (Microsoft’s Subsystem for UNIX Applications) and Perl installed it’s easy. Just pull up a Korn shell and browse to the directory within which your checked out CVS modules live.

Run the following command.

find . -name 'Root' -print0 | xargs -0 perl -pi -e 's/oldhostname/newhostname/g'

For example, I ran the command:

find . -name 'Root' -print0 | xargs -0 perl -pi -e 's/cvshost/cvshost.mydomain.co.uk/g'

Which changed the Contents of the Root file from:

:pserver:achristie@cvshost:/company/repository

to:

:pserver:achristie@cvshost.mydomain.co.uk:/company/repository

Comments

  1. User Gravatar Julius Kabugu said:

    August 22nd, 2011 at 10:26 pm (#)

    The problem with this method is that when you try to commit or update, etc... cvs will report that there is no version in the folder. Strange but happened to me and I had to check out each module again and merge the current working with the newly checked out.

Leave a comment