subversion-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Stefan Sperling <s...@elego.de>
Subject Re: restoring a working copy from backup: can the pristine directory be recreated?
Date Wed, 27 Mar 2013 14:52:55 GMT
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.

Mime
View raw message