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

Re: svn commit: r1073366 - in /subversion/trunk: notes/wc-ng/pristine-store subversion/libsvn_wc/wc-queries.sql subversion/libsvn_wc/wc_db_pristine.c

From: Branko Čibej <brane_at_e-reka.si>
Date: Sat, 26 Feb 2011 20:26:36 +0100

On 26.02.2011 10:50, Ivan Zhakov wrote:
> 2011/2/26 Branko Čibej <brane_at_e-reka.si>:
>> On 26.02.2011 07:32, Ivan Zhakov wrote:
>>> Problem of re-installing file over marked for deletion file can be
>>> solved using the following trick:
>>> 1. Rename file to temporary name.
>>> 2. Delete it
>> (If the proper share bits are set.)
> Sure.

It turns out that the FILE_SHARE_DELETE bit is the one that allows renames.

>> Yes, that'd work, but if there's a way to unmark the deletion bit,
>> that's even better, since then you'd not even have to create another
>> file (with identical contents).
> I'm not aware how to unmark deletion bit on Windows.

You're right, there's no way to do it from user space. I suppose then
that the easiest thing to do on Windows would be this: when a pristine
needs to be deleted, instead of just deleting it, rename it to some
unique random name within the same directory, and delete that. This way,
you don't need extra logic for the "reinstate" step, nor do you have to
ever check if there are open handles to the file. Rename (clearing the
way for reinstate) and delete (the file goes away when all handles are
closed) and apr_file_open already sets all the required share bits.

BTW Julian, have you considered making the pristine files read-only
(once they're written of course)? If yes, then be aware that in order to
delete and/or rename a file on Windows, you have to first clear the
read-only bit. I think we have utility functions for that in
libsvn_subr, but it's worth a check.

-- Brane
Received on 2011-02-26 20:27:14 CET

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