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 2016/11/08 16:08:36 UTC

Feature request: Restoring pristines

Hello!

It happened to me a couple of times that subversion complains that a pristine file is missing from the .svn directory.
AFAIK the only solution is to do a fresh checkout if this happens.

Would it be possible that subversion treats the .svn/pristine directory as a cache and simply fetches any missing files
when it needs them?
The information for this should be in the database.

Mit freundlichen Grüßen
Dr. Hartmut Niemann

Siemens AG
MO MLT LM EN CCI 1
Werner-von-Siemens-Str. 67
91052 Erlangen, Deutschland
Mobil: +49 173 5342327
mailto:hartmut.niemann@siemens.com
www.siemens.com/ingenuityforlife<https://siemens.com/ingenuityforlife>
[www.siemens.com/ingenuityforlife]
Siemens Aktiengesellschaft: Vorsitzender des Aufsichtsrats: Gerhard Cromme; Vorstand: Joe Kaeser, Vorsitzender; Roland Busch, Lisa Davis, Klaus Helmrich, Janina Kugel, Siegfried Russwurm, Ralf P. Thomas; Sitz der Gesellschaft: Berlin und München, Deutschland; Registergericht: Berlin Charlottenburg, HRB 12300, München, HRB 6684; WEEE-Reg.-Nr. DE 23691322

Re: Feature request: Restoring pristines

Posted by Johan Corveleyn <jc...@gmail.com>.
2016-11-08 17:08 GMT+01:00 Niemann, Hartmut <ha...@siemens.com>:
> Hello!
>
> It happened to me a couple of times that subversion complains that a pristine file is missing from the .svn directory.
> AFAIK the only solution is to do a fresh checkout if this happens.

Several years ago I also ran into this a couple of times (during the
svn 1.7 era -- possibly also when mixing native svn clients with
svnkit (java client)). I have not encountered it anymore since 1.9 at
least (and not using svnkit anymore).

Back then, I also discussed this on the users list [1], and learned
about the following repairing technique:

    $ svn up --set-depth exclude X
    $ svn up X

Or, if the working copy is locked and you cannot execute any svn
command anymore, and even cleanup fails, you might need the following
(you need an sqlite3 executable):

    $ sqlite3 .svn/wc.db "delete from work_queue"
    $ svn cleanup
    $ svn up --set-depth exclude X
    $ svn up X

Apart from 'svn up --set-depth exclude X', sometimes also 'svn up -r0
X' works to fix similar wc-corruptions.

FWIW, there were several other interesting mail discussions on the
dev-list about this and other (in theory repairable) working copy
corruptions. See [2], [3], and [4]. Most people agreed that such
repairing features in core svn would be very useful, but unfortunately
the ideas never got anywhere.

> Would it be possible that subversion treats the .svn/pristine directory as a cache and simply fetches any missing files
> when it needs them?
> The information for this should be in the database.

Sounds a bit like the (very old) feature request for optional
pristines [5] (but then a non-intentional optionalilty) or other
similar feature-suggestions to avoid the disk space overhead of
pristine files. But it's an interesting suggestion.


[1] http://mail-archives.apache.org/mod_mbox/subversion-users/201203.mbox/%3CCAB84uBUv7dV9wY25W-oMYUvZvh5vXVm2RhuZpjRt8VjpeJm6GA@mail.gmail.com%3E

[2] http://mail-archives.apache.org/mod_mbox/subversion-dev/201206.mbox/%3CCAB84uBUJeZDHjhKP6Fz2hoU_g1oHUZyUq_wNVNC=pPyju7hVJw@mail.gmail.com%3E

[3] https://svn.haxx.se/dev/archive-2012-09/0304.shtml

[4] https://svn.haxx.se/dev/archive-2013-04/0426.shtml

[5] https://issues.apache.org/jira/browse/SVN-525

-- 
Johan

Re: Feature request: Restoring pristines

Posted by Ryan Schmidt <su...@ryandesign.com>.
> On Nov 8, 2016, at 10:08 AM, Niemann, Hartmut <ha...@siemens.com> wrote:
> 
> Hello!
>  
> It happened to me a couple of times that subversion complains that a pristine file is missing from the .svn directory.

Why did the pristine files disappear? Who deleted them? As far as I know, it wouldn't have been Subversion.




Re: Feature request: Restoring pristines

Posted by Branko Čibej <br...@apache.org>.
On 10.11.2016 17:19, Daniel Shahaf wrote:
> Stefan Hett wrote on Thu, Nov 10, 2016 at 11:52:43 +0100:
>> On 11/10/2016 8:08 AM, Cooke, Mark wrote:
>>>> -----Original Message-----
>>>> From: Stefan [mailto:luke1410@posteo.de]
>>>> Sent: 09 November 2016 21:43
>>>> To: users@subversion.apache.org
>>>> Subject: Re: Feature request: Restoring pristines
>>>>
>>>> On 11/9/2016 21:22, Branko \u010cibej wrote:
>>>>> On 08.11.2016 21:51, Stefan wrote:
>>>>>> I didn't test this, but
>>>>> This is how all down-voted stackoverflow answers start. :)
>>>>>
>>>>> -- Brane
>>>>>
>>>> OK, I see. Tested and it doesn't work. ;-)
>>>>
>>>> Certainly sounds like a reasonable request for an improvement to have at
>>>> least svn co auto correct the case of missing pristine files, as far as
>>>> I'm concerned.
>>>>
>>>> Regards,
>>>> Stefan
>>> Would this not fit better as part of `update` rather than `checkout` over an existing working copy?
>>>
>>> ~ mark c
>>>
>> IMO it should be part of both, since both operations (aka: svn update as
>> well as svn checkout) will error out, if a pristine would be required but
>> missing (and this is some error, the operation could easily resolve without
>> user interaction).
>>
> I thought of 'cleanup' as the appropriate place, since fixing violated
> invariants should be opt-in;

An option that makes 'svn cleanup' connect to the repository? Cleanup
has always been a local-only command.

-- Brane


Re: Feature request: Restoring pristines

Posted by Daniel Shahaf <d....@daniel.shahaf.name>.
Stefan Hett wrote on Thu, Nov 10, 2016 at 11:52:43 +0100:
> On 11/10/2016 8:08 AM, Cooke, Mark wrote:
> >>-----Original Message-----
> >>From: Stefan [mailto:luke1410@posteo.de]
> >>Sent: 09 November 2016 21:43
> >>To: users@subversion.apache.org
> >>Subject: Re: Feature request: Restoring pristines
> >>
> >>On 11/9/2016 21:22, Branko \u010cibej wrote:
> >>>On 08.11.2016 21:51, Stefan wrote:
> >>>>I didn't test this, but
> >>>This is how all down-voted stackoverflow answers start. :)
> >>>
> >>>-- Brane
> >>>
> >>OK, I see. Tested and it doesn't work. ;-)
> >>
> >>Certainly sounds like a reasonable request for an improvement to have at
> >>least svn co auto correct the case of missing pristine files, as far as
> >>I'm concerned.
> >>
> >>Regards,
> >>Stefan
> >Would this not fit better as part of `update` rather than `checkout` over an existing working copy?
> >
> >~ mark c
> >
> IMO it should be part of both, since both operations (aka: svn update as
> well as svn checkout) will error out, if a pristine would be required but
> missing (and this is some error, the operation could easily resolve without
> user interaction).
> 

I thought of 'cleanup' as the appropriate place, since fixing violated
invariants should be opt-in;

However, let's not bikeshed about the UI.  My concern about this change
is that by the time a pristine is absent, one invariant is no longer
holding so there may be additional problems.  I.e., there's no guarantee
that after running �svn cleanup --reinvariant=missing-pristines� the wc
will be in a valid state.

That said, the feature might be useful in certain cases and ought to be
pretty easy to implement, so perhaps someone will write it?  It might
even make sense to write it as an external script, at least at first, to
(a)�shake out any bugs, (b)�allow users of 1.9 and older to use it.

The external script should be quite short; it just needs to check
SVN_WC__VERSION, then to run `svn info` and `svn cat`.  (That's assuming
the on-disk file is missing but the sqlite entry (in the PRISTINES
table) is still present.)

Cheers,

Daniel

Re: Feature request: Restoring pristines

Posted by Stefan Hett <st...@egosoft.com>.
On 11/10/2016 8:08 AM, Cooke, Mark wrote:
>> -----Original Message-----
>> From: Stefan [mailto:luke1410@posteo.de]
>> Sent: 09 November 2016 21:43
>> To: users@subversion.apache.org
>> Subject: Re: Feature request: Restoring pristines
>>
>> On 11/9/2016 21:22, Branko \u010cibej wrote:
>>> On 08.11.2016 21:51, Stefan wrote:
>>>> I didn't test this, but
>>> This is how all down-voted stackoverflow answers start. :)
>>>
>>> -- Brane
>>>
>> OK, I see. Tested and it doesn't work. ;-)
>>
>> Certainly sounds like a reasonable request for an improvement to have at
>> least svn co auto correct the case of missing pristine files, as far as
>> I'm concerned.
>>
>> Regards,
>> Stefan
> Would this not fit better as part of `update` rather than `checkout` over an existing working copy?
>
> ~ mark c
>
IMO it should be part of both, since both operations (aka: svn update as 
well as svn checkout) will error out, if a pristine would be required 
but missing (and this is some error, the operation could easily resolve 
without user interaction).

Why I pointed out svn co: IMO in this case it would be reasonable for 
the co command to check all required pristine files to verify they exist 
and are valid. That's certainly something you wouldn't want a simple svn 
up to do.

-- 
Regards,
Stefan Hett


RE: Feature request: Restoring pristines

Posted by "Cooke, Mark" <ma...@siemens.com>.
> -----Original Message-----
> From: Stefan [mailto:luke1410@posteo.de]
> Sent: 09 November 2016 21:43
> To: users@subversion.apache.org
> Subject: Re: Feature request: Restoring pristines
> 
> On 11/9/2016 21:22, Branko Čibej wrote:
> > On 08.11.2016 21:51, Stefan wrote:
> >> I didn't test this, but
> > This is how all down-voted stackoverflow answers start. :)
> >
> > -- Brane
> >
> OK, I see. Tested and it doesn't work. ;-)
> 
> Certainly sounds like a reasonable request for an improvement to have at
> least svn co auto correct the case of missing pristine files, as far as
> I'm concerned.
> 
> Regards,
> Stefan

Would this not fit better as part of `update` rather than `checkout` over an existing working copy?

~ mark c


Re: Feature request: Restoring pristines

Posted by Stefan <lu...@posteo.de>.
On 11/9/2016 21:22, Branko Čibej wrote:
> On 08.11.2016 21:51, Stefan wrote:
>> I didn't test this, but
> This is how all down-voted stackoverflow answers start. :)
>
> -- Brane
>
OK, I see. Tested and it doesn't work. ;-)

Certainly sounds like a reasonable request for an improvement to have at
least svn co auto correct the case of missing pristine files, as far as
I'm concerned.

Regards,
Stefan



Re: Feature request: Restoring pristines

Posted by Branko Čibej <br...@apache.org>.
On 08.11.2016 21:51, Stefan wrote:
> I didn't test this, but

This is how all down-voted stackoverflow answers start. :)

-- Brane



Re: Feature request: Restoring pristines

Posted by Stefan <lu...@posteo.de>.
On 11/8/2016 17:08, Niemann, Hartmut wrote:
>
> Hello!
>
>  
>
> It happened to me a couple of times that subversion complains that a
> pristine file is missing from the .svn directory.
>
> AFAIK the only solution is to do a fresh checkout if this happens.
>
>  
>
> Would it be possible that subversion treats the .svn/pristine
> directory as a cache and simply fetches any missing files
>
> when it needs them?
>
> The information for this should be in the database.
>
>  
>
I didn't test this, but wouldn't a checkout into the existing directory
do exactly what you ask? Aka: only transmit the missing pristine over
the wire while keeping the existing pristines as is?

Regards,
Stefan