You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@subversion.apache.org by Stefan Küng <to...@gmail.com> on 2006/03/25 09:52:46 UTC

how to corrupt the working copy

Hi,

Attached is a recipe on how to get a corrupt working copy, doing only 
updates.
Basically, it happens if you try to update your working copy, but have 
one file 'locked' by another application so that subversion can't write 
to that file.
(with version 1.3.0)

@echo off
set ROOT=D:/test
set REPONAME=lockrepo
set WCNAME=lock
set REPO=file:///%ROOT%/%REPONAME%
set WC=%ROOT%/%WCNAME%

cd %ROOT%
if exist %REPONAME% rd /s /q %REPONAME%
if exist %WCNAME% rd /s /q %WCNAME%
if exist %WCNAME%2 rd /s /q %WCNAME%2

mkdir %REPONAME%
svnadmin create %REPONAME%
mkdir %WCNAME%
cd %WCNAME%
echo file1 > file1
echo file2 > file2
cd ..
svn import %WCNAME% %REPO% -m ""
rd /s /q %WCNAME%
svn co %REPO% %WCNAME%
svn co %REPO% %WCNAME%2
echo test > %WCNAME%\file1
echo test > %WCNAME%\file2
svn ci %WCNAME% -m ""
echo
echo now open the file in %WCNAME%2\file2 exclusively, so Subversion 
can't write to it.
:: important: you must open file2 here. With file1, everything would be 
fine.
pause
svn up %WCNAME%2
echo
echo now close the file %WCNAME%2\file2.
pause
svn up %WCNAME%2
svn cleanup %WCNAME%2


Now, when executing 'svn cleanup' as suggested by the 'svn update', 
you'll get:
svn: In directory 'lock2'
svn: Can't copy 'lock2\.svn\tmp\text-base\file1.svn-base' to 
'lock2\file1.2.tmp' : the system can't find the specified file.

Frome here, there's no way to recover the working copy without digging 
into the .svn folder (which I always tell users to *never* do).

Stefan

-- 
        ___
   oo  // \\      "De Chelonian Mobile"
  (_,\/ \_/ \     TortoiseSVN
    \ \_/_\_/>    The coolest Interface to (Sub)Version Control
    /_/   \_\     http://tortoisesvn.tigris.org

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@subversion.tigris.org
For additional commands, e-mail: dev-help@subversion.tigris.org

Re: how to corrupt the working copy

Posted by Marcus Rueckert <da...@web.de>.
On 2006-03-25 11:05:36 +0100, Stefan Küng wrote:
> If you need an utility to lock a file exclusively so no other app can 
> open it: I've uploaded my own little tool here:
> http://mapcar.org/tsvn-snapshots/Flock.exe
> 
> To lock a file, simply drag it on the small window. To remove the lock, 
> select the file and hit the delete button.

I am not sure if it already has a bug entry or something like that. but
this issue is definitely known. timo ran more than once into it. when
people had files in photoshop open and ran "svn up" on the WC.

darix

-- 
           openSUSE - SUSE Linux is my linux
               openSUSE is good for you
                   www.opensuse.org

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@subversion.tigris.org
For additional commands, e-mail: dev-help@subversion.tigris.org

Re: how to corrupt the working copy

Posted by Stefan Küng <to...@gmail.com>.
If you need an utility to lock a file exclusively so no other app can 
open it: I've uploaded my own little tool here:
http://mapcar.org/tsvn-snapshots/Flock.exe

To lock a file, simply drag it on the small window. To remove the lock, 
select the file and hit the delete button.

Stefan

-- 
        ___
   oo  // \\      "De Chelonian Mobile"
  (_,\/ \_/ \     TortoiseSVN
    \ \_/_\_/>    The coolest Interface to (Sub)Version Control
    /_/   \_\     http://tortoisesvn.tigris.org

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@subversion.tigris.org
For additional commands, e-mail: dev-help@subversion.tigris.org