Svn 1.7 - How to switch working copy to relocated repo when working copy has non-existent revision

937 Views Asked by At

There was an svn project in svn repo http://svn/repoA/path1/ . Call this original repo.

This was copied to http://svn/repoA/path2 . Call this new repo.

A local working copy on one of our machines, checked out from original repo, was updated after this copy occurred.

Then original repo was deleted.

We now wish to reintegrate the working copy into new repo.

svn switch is suitable for this. Running inside the project base directory:

svn switch http://svn/repoA/path2

However, switch complains because the project has a revision number which does not exist in new repo.

In svn 1.6 I would have changed the revision number in .svn/entries recursively under the project base dir, where it is stored as plaintext.

In svn 1.7 such information seems to be stored opaquely (encoded in some way) into .svn/wc.db or other new files.

My question is: how can I force the working copy to think it's an existing revision on the copied revision history so that I can switch it to the cloned repo folder and thereafter update it?

2

There are 2 best solutions below

0
On

You know you were not suppose to touch those .svn directories. I bet you also open the back of electronic appliances even though there's a label that clearly says Warning: No user serviceable parts inside. Do not open unless sudden death by electrocution is desired.

Yes, I do too.

You can still do a svn status on the old working directory to find your changed files, and then copy those over to the new working directory. An svn status will work even though the old repository doesn't exist.

Or, you can checkout a new working copy in another directory, delete all the old .svn directories from the old working copy, and then just copy all of those files over to the new working directory. You can then do an svn status to find what changed, and fix those issues.

1
On

A SVN switch would normally remove files that don't exist in the new repo and add files that do exist in the new repo. However, in your case there is no equivalent revision to switch to. As such, svn switch really isn't the right tool for this job.

Look into svn import to rebuild the old "original" server repo from the checked out working repo.

In the event that you REALLY want to do it they way you formerly did, keep in mind that SVN now uses fewer .svn directories. Look to the root of your checkout for the one .svn directory that matters. Also keep in mind that most of the information is no longer structured with text files, but instead in SQLLite binary databases. Modifying the database entries with a SQLLite compatible database client is possible; however, it is very unrecommended. You run a much greater risk of turning your working repository into a pile of goo than you did with the old text files.

If the intent was to remove a lot of revision history, but you want the reivsion number to match, you need to rebuild repo1 such that it is missing the undesirable history, but the revision numbers match. To do so,

svnadmin dump /path/to/repo2 -r<start>:<end> > svn.dump
svnadmin create /path/to/repo1
svnadmin load /path/to/repo1 < svn.dump

Or in my fake example, rev 8323 is the last bit of history to be kept, and the current rev is 9929.

svnadmin dump /path/to/repo2 -r8323:9929 > svn.dump
svnadmin create /path/to/repo1
svnadmin load /path/to/repo1 < svn.dump