[svn.haxx.se] · SVN Dev · SVN Users · SVN Org · TSVN Dev · TSVN Users · Subclipse Dev · Subclipse Users · this month's index

Re: svn 1.7: how to recover from a lost pristine file

From: Philip Martin <philip.martin_at_wandisco.com>
Date: Wed, 28 Mar 2012 15:24:04 +0100

Johan Corveleyn <jcorvel_at_gmail.com> writes:

> Thanks for your help, Philip.
>
> $ sqlite3 .svn/wc.db "select * from work_queue"
> 1|(file-install trunk/rootdir/the/file/with/missing/pristine.java 1 0 1 1)
>
>> These may show something:
>>
>>  sqlite3 wc/.svn/wc.db "select * from nodes where local_relpath = '/the/file/with/missing/pristine.java'"
>>
>>  sqlite3 wc/.svn/wc.db "select * from nodes where checksum like '%6d6e0892990e945b03a15b8e518dbef26848dc75'"
>
> Both of the above show the same:
> 1|the/file/with/missing/pristine.java|0|the/file/with/missing|1|trunk/rootdir/the/file/with/missing/pristine.java|176219|normal|||file|(svn:eol-style
> native)||$sha1$6d6e0892990e945b03a15b8e518dbef26848dc75||175563|1332375850493000|username|56722|1332709446087164||
>
>>  sqlite3 wc/.svn/wc.db "select * from pristine where checksum like '%6d6e0892990e945b03a15b8e518dbef26848dc75'"
>
> That shows nothing.

That really is broken. By the time the file-install wq item exists
there should be a pristine row with the checksum as well as the pristine
file. So just adding the missing file would not be enough, you need to
add the pristine row as well.

You might be able to restore the missing file. Probably easiest to
checkout a temporary copy of the parent using --depth=empty, then update
the one file required. Now in the temporary wc

 sqlite3 .svn/wc.db "select * from pristine"

should show the required row. In the broken wc

 sqlite3 .svn/wc.db "insert into pristine values (sha1, null, size, 1, md5)

then copy/move the pristine file itself from the temporary wc to the
broken wc.

>> Depending on what the work_queue shows you may be able to further
>> corrupt your working copy and then recover by doing this:
>>
>>  sqlite .svn/wc.db "delete from work_queue"
>>  svn up -r0 file
>>
>> IMPORTANT! Deleting the work_queue does generally make the working copy
>> invalid, it is then up to you to ensure it returns to a valid state.
>
> Heh :-). I'll give it a try (I'll wait a while, in case you have
> something more to add given my feedback ...).

You have the checksum in the nodes row, so you will probably need to
delete that nodes row as well.

> Is this a situation from which svn could ultimately become self-healing?

I suppose it might get fixed as a side-effect of somebody implementing
"optional pristine" but generally wq items are not supposed to fail.

-- 
Philip
Received on 2012-03-28 16:24:45 CEST

This is an archived mail posted to the Subversion Users mailing list.

This site is subject to the Apache Privacy Policy and the Apache Public Forum Archive Policy.