views:

525

answers:

6

Right now, my SVN repository is on my laptop's HDD (although I use a code hosting service for more "critical" personal projects) and I just copy the directory over on a weekly basis (which will eventually be scripted or perhaps I'll make an app for the hell of it). Am I at risk for corrupting my SVN repository? So far, I haven't had any problems with the original or the copy, but that doesn't mean that I'm not at risk in the future.

+3  A: 

AFAIK it is safe, but why not do export for a backup?

akalenuk
My repositories are actually in My Documents. I just copy everything in My Documents once a week. It's easier and quicker, but I should use export. That is what it's made for, isn't it?
Thomas Owens
Nope you should use dump, export is used to export the code without any of the versioning information.
levhita
+11  A: 

Consider using hot copy..

http://svnbook.red-bean.com/en/1.2/svn.ref.svnadmin.c.hotcopy.html

Benjamin W. Smith
Hot copy is the safest way to go, and restoring is easy too. Good call!
Abyss Knight
Thanks for the comment :)
Benjamin W. Smith
+1  A: 

You shouldn't be at risk of corrupting the main repository just doing a copy. However, the copy could be corrupted if something is locked at the time of the copy.

You could use an application such as SyncBackSE which can schedule the backup and uses shadow copy in case of locking.

Turnkey
+2  A: 

You may be safe, but only because you know that no one is accessing the repository on your laptop. However, svn (svnadmin) provides hot copy and dump commands that are as easy to run as your copy command, and they are "guaranteed safe".

gbarry
A: 

You wrote:

Right now, my SVN repository is on my laptop's HDD and I just copy the directory over on a weekly basis

A question for you: why?

Am I at risk for corrupting my SVN repository?

Not at all if your copy is just that: a copy. If your "copy" opens some file locked for writing you might be at risk (you said in a comment it something that looks like you are under windows, and it might happen on windows) - if there is another process trying to write something into the repos at the same time.

So far, I haven't had any problems with the original or the copy, but that doesn't mean that I'm not at risk in the future.

Real point is: are you copying for backup purpose? If so, a copy it might be useless (depending on the details of the restore process). See: http://svnbook.red-bean.com/en/1.5/svn.reposadmin.maint.html#svn.reposadmin.maint.migrate

So finally: use svnadmin dump

Davide
A: 

I used to use a flash disk and just created a file-based repo on it. The only downsides (besides forgetting it!) was the flash disk had to have the same drive letter at each PC, and the speed, it felt like a slow internet connection.

Else, it worked just fine.

leppie