You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@subversion.apache.org by Ivan Zhakov <iv...@visualsvn.com> on 2011/03/01 20:07:58 UTC

Re: svn commit: r1075942 - in /subversion/trunk: notes/wc-ng/pristine-store subversion/libsvn_wc/wc_db.h subversion/libsvn_wc/wc_db_pristine.c subversion/tests/libsvn_wc/pristine-store-test.c

On Tue, Mar 1, 2011 at 20:47,  <ju...@apache.org> wrote:
> Author: julianfoad
> Date: Tue Mar  1 17:47:04 2011
> New Revision: 1075942
>
> URL: http://svn.apache.org/viewvc?rev=1075942&view=rev
> Log:
> Make the pristine text store guarantee that a pristine text stream being
> read will remain readable even if the text is deleted from the store.  To
> ensure that a recently deleted pristine file can be reinstated, on Windows
> we rename it to a new unique name before deleting it.  This is probably not
> the most efficient way to work on Windows.
>
[...]

> + * On Windows, the file will not disappear immediately from the directory if
> + * it is still being read so the best thing to do is first rename it to a
> + * unique name. */
> +static svn_error_t *
> +remove_file(const char *file_abspath,
> +            svn_wc__db_wcroot_t *wcroot,
> +            svn_boolean_t ignore_enoent,
> +            apr_pool_t *scratch_pool)
> +{
> +#if 1 /*def WIN32*/
I think it should be "#ifdef WIN32". Isn't it?

> +  svn_error_t *err;
> +  const char *temp_abspath;
> +  const char *temp_dir_abspath
> +    = pristine_get_tempdir(wcroot, scratch_pool, scratch_pool);
> +
> +  /* To rename the file to a unique name in the temp dir, first create a
> +   * uniquely named file in the temp dir and then overwrite it. */
> +  SVN_ERR(svn_io_open_unique_file3(NULL, &temp_abspath, temp_dir_abspath,
> +                                   svn_io_file_del_none,
> +                                   scratch_pool, scratch_pool));
> +  err = svn_io_file_rename(file_abspath, temp_abspath, scratch_pool);
> +  if (err && ignore_enoent && APR_STATUS_IS_ENOENT(err->apr_err))
> +    svn_error_clear(err);
> +  else
> +    SVN_ERR(err);
> +  file_abspath = temp_abspath;
> +#endif
> +
> +  SVN_ERR(svn_io_remove_file2(file_abspath, ignore_enoent, scratch_pool));
> +
> +  return SVN_NO_ERROR;
> +}
> +
[...]


-- 
Ivan Zhakov
VisualSVN Team

Re: svn commit: r1075942 - in /subversion/trunk: notes/wc-ng/pristine-store subversion/libsvn_wc/wc_db.h subversion/libsvn_wc/wc_db_pristine.c subversion/tests/libsvn_wc/pristine-store-test.c

Posted by Ivan Zhakov <iv...@visualsvn.com>.
On Tue, Mar 1, 2011 at 23:30, Julian Foad <ju...@wandisco.com> wrote:
> On Tue, 2011-03-01 at 21:00 +0100, Stefan Sperling wrote:
>> On Tue, Mar 01, 2011 at 10:07:58PM +0300, Ivan Zhakov wrote:
>> > On Tue, Mar 1, 2011 at 20:47,  <ju...@apache.org> wrote:
>> > > Author: julianfoad
>> > > Date: Tue Mar  1 17:47:04 2011
>> > > New Revision: 1075942
>> > >
>> > > URL: http://svn.apache.org/viewvc?rev=1075942&view=rev
>> > > Log:
>> > > Make the pristine text store guarantee that a pristine text stream being
>> > > read will remain readable even if the text is deleted from the store.  To
>> > > ensure that a recently deleted pristine file can be reinstated, on Windows
>> > > we rename it to a new unique name before deleting it.  This is probably not
>> > > the most efficient way to work on Windows.
>> > >
>> > [...]
>>
>> > > +#if 1 /*def WIN32*/
>> > I think it should be "#ifdef WIN32". Isn't it?
>>
>> Looks very much like that to me, too.
>> I've made this change in r1076006 because Julian doesn't seem to
>> be around at the moment.
>
> Thanks Ivan and Stefan.  Yes, that's what it was meant to be.
>
> It's nice to have had it tested on Linux as well though!
>
> BTW, should it also check for OS/2?
I don't have experience with OS/2, may be someone else know OS/2 behavior.

-- 
Ivan Zhakov

Re: svn commit: r1075942 - in /subversion/trunk: notes/wc-ng/pristine-store subversion/libsvn_wc/wc_db.h subversion/libsvn_wc/wc_db_pristine.c subversion/tests/libsvn_wc/pristine-store-test.c

Posted by Julian Foad <ju...@wandisco.com>.
On Tue, 2011-03-01 at 21:00 +0100, Stefan Sperling wrote:
> On Tue, Mar 01, 2011 at 10:07:58PM +0300, Ivan Zhakov wrote:
> > On Tue, Mar 1, 2011 at 20:47,  <ju...@apache.org> wrote:
> > > Author: julianfoad
> > > Date: Tue Mar  1 17:47:04 2011
> > > New Revision: 1075942
> > >
> > > URL: http://svn.apache.org/viewvc?rev=1075942&view=rev
> > > Log:
> > > Make the pristine text store guarantee that a pristine text stream being
> > > read will remain readable even if the text is deleted from the store.  To
> > > ensure that a recently deleted pristine file can be reinstated, on Windows
> > > we rename it to a new unique name before deleting it.  This is probably not
> > > the most efficient way to work on Windows.
> > >
> > [...]
>  
> > > +#if 1 /*def WIN32*/
> > I think it should be "#ifdef WIN32". Isn't it?
> 
> Looks very much like that to me, too.
> I've made this change in r1076006 because Julian doesn't seem to
> be around at the moment.

Thanks Ivan and Stefan.  Yes, that's what it was meant to be.

It's nice to have had it tested on Linux as well though!

BTW, should it also check for OS/2?

- Julian



Re: svn commit: r1075942 - in /subversion/trunk: notes/wc-ng/pristine-store subversion/libsvn_wc/wc_db.h subversion/libsvn_wc/wc_db_pristine.c subversion/tests/libsvn_wc/pristine-store-test.c

Posted by Stefan Sperling <st...@elego.de>.
On Tue, Mar 01, 2011 at 10:07:58PM +0300, Ivan Zhakov wrote:
> On Tue, Mar 1, 2011 at 20:47,  <ju...@apache.org> wrote:
> > Author: julianfoad
> > Date: Tue Mar  1 17:47:04 2011
> > New Revision: 1075942
> >
> > URL: http://svn.apache.org/viewvc?rev=1075942&view=rev
> > Log:
> > Make the pristine text store guarantee that a pristine text stream being
> > read will remain readable even if the text is deleted from the store.  To
> > ensure that a recently deleted pristine file can be reinstated, on Windows
> > we rename it to a new unique name before deleting it.  This is probably not
> > the most efficient way to work on Windows.
> >
> [...]
 
> > +#if 1 /*def WIN32*/
> I think it should be "#ifdef WIN32". Isn't it?

Looks very much like that to me, too.
I've made this change in r1076006 because Julian doesn't seem to
be around at the moment.