Jan 5, 2009

Changing CVS Repository location on Unix (Solaris)

CVS is very simple (for the experienced user) at the same time very confusing (for the novice user). With a plethora of tools available on windows, a task like changing the Repository location or repointing to a new server (in the event of a server change) for an already existing (checked out) project; is pretty straightforward.

For example in Eclipse for an existing project checked out from CVS,
We will have to first setup the new CVS Repository.
1> Window > Open Perspective > Other ... > CVS Repository Exploring > OK
2> RightClick on the left pane and select New > Repository location.
3> Enter all the details for the new location and save it.

Then when you want to change the project's repository or server location...
1> RightClick on the project folder
2> Select Properties
3> Select the CVS option on the left pane
4> Select the 'Change Sharing' button on the right pane
5> In the resulting window, you should see the new repository location > select it otherwise uncheck the 'compatible locations' options and then select the new repository location.
6> Click ok.

Eclipse will now change the sharing and repoint your existing project checked out from serverA/repositoryA to serverB/repositoryB.

Although on Unix based systems, we normally do not have a UI enabled tool to repoint CVS.
In this case, we will have to manipulate the core CVS folders and change the entries in there. CVS keeps information in 3 files in a folder called 'CVS'. These files are...
1> Root
2> Entries
3> Repository
This 'CVS' folder is placed in every single folder of your project.
So to change the Root location from serverA.com to serverB.com we will have to modify the Root file in all these folders. This could be thousands. Fortunately its Unix and it has an unbeatable army of commands, shell scripts and tools.
* To change the Repository location as well we will have to change the Repository file.
So here are the commands that we should execute sequentially to acheive our goal (repoint CVS to new server and/or repository)

$ su root (if needed)
$ cd
$ find . -print | grep 'CVS/R' | xargs perl -pi -e 's/serverA.com/serverB.com/go'
$ find . -print | grep 'CVS/R' | xargs perl -pi -e 's|/repositoryFullPathA|/repositoryFullPathB|go'
$ cd ..
$ chown -R
$ cvs login
$ cvs update –d

Your update will be pulled from the new CVS server/repository 'B' location.

Whatsapp Button works on Mobile Device only

Start typing and press Enter to search