Friday, December 05, 2008

Adding a computer to subversion repository (through subclipse)

All of this is done through Eclipse using Subclipse Project.


Assume there is a subversion repository already in place with documents in it. The repository was established with a certain version of documents from computer ONE. At the same time, computer TWO has a copy of those documents and it is not connected to the repository. Documents on computer TWO are edited before connecting the computer to the repository. Now, I would like to create a connection from computer TWO to the repository but I cannot simply issue a 'checkout' command because documents on computer TWO are the more recent version of the ones that are in the repository. While one would think this is a simple task (for a beginner w.r.t. subverion at least), it is not!
In order to achieve desired functionality, the following can be done (all of these are done on computer TWO):
1. From Windows Explored, move entire contents of the project directory to some temporary directory
2. From Eclipse (i.e., subclipse), checkout the desired project (go to SVN Repository Exploring perspective, browse to the desired project, right-click on trunk, tag (or similar) directory that wants to be checked out within the browser, and select Checkout)
3. Follow the checkout wizard and chose to 'Check out as a project in the workspace' and give it the name that matches the desired project name. After clicking Finish, it will tell you that the specified project exists and contents will be deleted. Click OK.
4. After checking out the documents has completed, go back to the Windows Explorer and copy contents of the temporary directory into the project directory
5. Refresh the project tree view in Eclipse. Right-click project name in Eclipse and select Team->'Synchronize with Repository'. This will open Team Synchronizing perspective (or ask you to do so) and show you differences from the new document versions with the ones in the repository.
6. Commit the new version into the repository by selecting documents, right-clicking and choosing Commit command.

From now on, both of the computers should be able to update/commit changes as needed.


If anyone reads this and knows a better way of doing it, please leave a comment explaining how because, in my current opinion, whoever designed document repositories to have the interface different from that of a simple drag&drop is an idiot.

No comments: