You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@subversion.apache.org by "Niemann, Hartmut" <ha...@siemens.com> on 2013/03/27 10:21:01 UTC

restoring a working copy from backup: can the pristine directory be recreated?

Hello!

If I backup a working copy, the .svn folder and especially the pristine directory there, where subversion stores the base version of each file, takes lots of space.

I used to exclude the .svn directory from this backup, but now I had to restore my hard drive with all its working data and found it annoying to have to recreate every working copy. 

If subversion could retrieve a broken or missing pristine file, which it can't now in tortoise SVN 1.7.11, it would be sufficient to backup the files in the .svn directory, which would save almost half the space.

Is there any way to repair/refresh a pristine directory in subversion? Or is a fresh checkout the only option?

With best regards

Hartmut
 

Re: restoring a working copy from backup: can the pristine directory be recreated?

Posted by Daniel Shahaf <d....@daniel.shahaf.name>.
The .svn/pristine/ directory should be recreatable given wc.db and a
network connection to the server.  I don't know if anyone has
implemented that.  (The main catch is that the pristine files need to be
in repository-normal form.)

Niemann, Hartmut wrote on Wed, Mar 27, 2013 at 10:21:01 +0100:
> Hello!
> 
> If I backup a working copy, the .svn folder and especially the pristine directory there, where subversion stores the base version of each file, takes lots of space.
> 
> I used to exclude the .svn directory from this backup, but now I had to restore my hard drive with all its working data and found it annoying to have to recreate every working copy. 
> 
> If subversion could retrieve a broken or missing pristine file, which it can't now in tortoise SVN 1.7.11, it would be sufficient to backup the files in the .svn directory, which would save almost half the space.
> 
> Is there any way to repair/refresh a pristine directory in subversion? Or is a fresh checkout the only option?
> 
> With best regards
> 
> Hartmut
>  

Re: restoring a working copy from backup: can the pristine directory be recreated?

Posted by Stefan Sperling <st...@elego.de>.
On Wed, Mar 27, 2013 at 03:36:35PM +0100, Andreas Krey wrote:
> On Wed, 27 Mar 2013 10:21:01 +0000, Niemann, Hartmut wrote:
> ...
> > Is there any way to repair/refresh a pristine directory in subversion? Or is a fresh checkout the only option?
> 
> You could just do a fresh checkout and then untar your backup onto
> that sandbox.

Working copies can be mixed-revision, which makes this approach very fragile.
http://svnbook.red-bean.com/en/1.7/svn.basic.in-action.html#svn.basic.in-action.mixedrevs
You'd have to save the output of svn info -R as well and recreate
the mixed-revision working copy before copying files from backup.

I would recommend to *commit* the working copy to a temporary branch
instead of backing it up. And worrying about backing up the repository,
not working copies.

Backup (if you have time to fix potential conflicts):

  svn co https://svn.example.com/svn/trunk
  cd trunk
  # make changes, realise you need to stash changes
  svn cp ^/trunk ^/branches/my-stash # create a single-rev copy of trunk
  svn sw ^/branches/my-stash   # switch working copy to stash branch
  # fix conflicts from incoming changes, if any
  svn commit

Backup (if you don't have time to fix potential conflicts):

  svn co https://svn.example.com/svn/trunk
  cd trunk
  # make changes, realise you need to stash changes
  svn cp . ^/branches/my-stash  # maybe commits a mixed-rev working copy
                                # but that is ok, we fix conflicts later

Restore:

  svn co https://svn.example.com/svn/my-stash
  cd my-stash
  svn merge ^/trunk
  # fix conflicts
  svn commit

  svn co https://svn.example.com/svn/trunk
  cd trunk
  svn merge --reintegrate ^/branches/my-stash
  # fix conflicts
  svn commit

You could probably omit the first block of commands, and try the
reintegrate merge right away.

Re: restoring a working copy from backup: can the pristine directory be recreated?

Posted by Andreas Krey <a....@gmx.de>.
On Wed, 27 Mar 2013 10:21:01 +0000, Niemann, Hartmut wrote:
...
> Is there any way to repair/refresh a pristine directory in subversion? Or is a fresh checkout the only option?

You could just do a fresh checkout and then untar your backup onto
that sandbox.

HOWEVER: You need to checkout the revision that was current when
the backup was made, and not a later that has committed changes
to the files in the sandbox. You'd undo those by unpacking the tar file.

Andreas

-- 
"Totally trivial. Famous last words."
From: Linus Torvalds <torvalds@*.org>
Date: Fri, 22 Jan 2010 07:29:21 -0800