views:

287

answers:

2

I did not use the hotcopy to back up my Subversion repository. We use Visual SVN Server (latest) with tortoise. I copied C:\Repositories and backed that up a few days ago and now I want to restore it.

I'm able to use the repository now with the backed up Repository folder copied over.

and then I guess now I have manually go through everyone's local project on the team to see who has the lates revision? If so that will take me hours.

anyone know if this is the right way or only way? Is it really this manual? I guess it would be because everyone has different changes locally.

+1  A: 

Any changes that were made since the backup are not present in the repository, and everyone will have to do a fresh checkout from the restored repository. (The revision numbers have changed, and you'll have a mess if you don't.)

As for salvaging any changes from developer's local copies, yes, that's going to be rather manual. However, "diff" and "patch" are your friends. If you aren't familiar with cygwin, you'll want to get that and get the diff, patch, diffutils, and patchutils packages so you have the 'diff' command and the 'patch' command. You can use the "diff" command to create a file containing the delta between one copy of the source tree and another. You'll want to use it like this:

diff -urN --exclude=.svn fresh_check_from_new_repo old_working_copy > developer1changes.patch

Do that for each developer's working copy. You can take those files and apply the changes to a fresh checkout using the "patch" command like this:

cd working_copy
patch -p1 -i ...../developer1changes.patch

You will now have a working copy with their changes. (Though without their svn adds, svn rms, and property changes.) From there, determine what needs to be committed.

You can use the "filterdiff" command to take the patch file and filter portions of the changes out, pipe that to patch, and it will apply just those changes.

edit: Another option: for each developer, create a branch and checkout that branch, then copy their local copy over the files in that new working copy and commit.

That gets all the work in the repository where it won't get lost. You will then have to deal with conflicts when trying to merge the branches into trunk. At that point, you should be able to use the gui tools to select which changes to keep or toss.

But the short answer is: you've got a lot of work to do since you don't have a very recent backup of the repo... so once y'all are able to work again, setup a much more frequent backup schedule.

retracile
if I'm using tortoise, where do I go to use the command line tool?
CoffeeAddict
wow that's a lot of stuff to figure out. That would take me a long time as well.
CoffeeAddict
Well, perhaps you should then balance the value of the changes made by all developers in the time since the last backup against the value of your time to learn these tools.But these tools are very powerful, and useful in many other situations that occur during development, so I would encourage you to learn them regardless.
retracile
I like Si's approach above, no need to do any of this if that works out. I could just do what he's saying for each developer and walla!
CoffeeAddict
+4  A: 

How about this approach, each developer:

  1. Does an TortoiseSVN -> Export of their now invalid working copy to a temporary location
  2. Gets a fresh checkout from the restored repository
  3. Copies the exported working copy (i.e. no .svn dirs), over the top of the new working copy
  4. Update and commit as per usual

Note that you may get more merge conflicts than usual, but they can be resolved in the usual manner.

Si
I do not see how that could work. If I take my boss's and export it. copy it and replace, it's going to replace it sure. I can check it in sure. But then I'm going to have to do the same thing. I can get latest and I can export mine but then I can't just copy and paste mine over the latest update, because how is SVN going to bring up the merge tool when I do this? I'd be plain copying/replacing unless maybe even though I copy/replace, when I check it back in th en I get the merge conflicts you're spacking of from the last check-in that I did with my boss's files?
CoffeeAddict
I mean do you get merge conflicts when you check in? I dont' thinks so, it's only when you check out. So if I paste all mine OVER and check in, I'm not going to get conflicts? right? or will I?
CoffeeAddict
See point 4. Update and then Commit. The Update (where merge conflicts can happen) is in case other developers also touch this code and commit before you. Can I suggest you try it out on one of the developers PC's to get an idea of what I mean.
Si
will give it a try, I have nothing to lose. That would be great if this works vs. everyone's idea of having to do a diff list. This would be a great alternative.
CoffeeAddict
on point #3 there will have to be some manual copying meaning I can't just blanket copy the entire exported over top the checked out code...that would rid all my .svn folders. I'll have to go through each folder and manually copy each set of files over...I can't copy entire folders from the exported over to replace folders in the checked out version of the restored repository.
CoffeeAddict
it did not work. I copied and replaced some files to that newly checked out repo that I had restored. Checked in the changes, appeared to have gone thorugh. But when I get latest again then show log, I see nothing of that change. I have created a new post for this problem
CoffeeAddict
I think just the history isn't showing the commit
CoffeeAddict
problem was history was cached. I updated the cache and disabled the cache.
CoffeeAddict
so it's sorted? The export removes the .svn folders, which is why you can then blanket copy over a fresh checkout, but you probably figured that out already.
Si