You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@subversion.apache.org by Greg Stein <gs...@gmail.com> on 2011/04/12 18:55:46 UTC

Re: svn commit: r1091495 - in /subversion/trunk/subversion/libsvn_wc: wc.h workqueue.c

On Apr 12, 2011 12:43 PM, <ph...@apache.org> wrote:
>
> Author: philip
> Date: Tue Apr 12 16:43:23 2011
> New Revision: 1091495
>
> URL: http://svn.apache.org/viewvc?rev=1091495&view=rev
> Log:
> Document timestamp repair function and use it during post-commit.
>
> * subversion/libsvn_wc/wc.h
>  (svn_wc__internal_file_modified_p): Document timestamp repair.
>
> * subversion/libsvn_wc/workqueue.c
>  (log_do_committed): Don't explicitly record fileinfo after
>   calling svn_wc__internal_file_modified_p.
>
> Modified:
>    subversion/trunk/subversion/libsvn_wc/wc.h
>    subversion/trunk/subversion/libsvn_wc/workqueue.c
>
> Modified: subversion/trunk/subversion/libsvn_wc/wc.h
> URL:
http://svn.apache.org/viewvc/subversion/trunk/subversion/libsvn_wc/wc.h?rev=1091495&r1=1091494&r2=1091495&view=diff
>
==============================================================================
> --- subversion/trunk/subversion/libsvn_wc/wc.h (original)
> +++ subversion/trunk/subversion/libsvn_wc/wc.h Tue Apr 12 16:43:23 2011
> @@ -391,6 +391,9 @@ void svn_wc__compat_call_notify_func(voi
>  * If LOCAL_ABSPATH does not exist, consider it unmodified.  If it exists
>  * but is not under revision control (not even scheduled for
>  * addition), return the error SVN_ERR_ENTRY_NOT_FOUND.
> + *
> + * If the text is unmodified and a write-lock is held this function
> + * will repair "broken" timestamps and filesizes.

I don't understand what is repaired. The database, or the file. If the file,
then how do we repair its filesize?

This notion of "repair" is equally fuzzy in the later portions of this
commit.

(Sorry; not on laptop to repond entirely properly here...)

>  */
>  svn_error_t *
>  svn_wc__internal_file_modified_p(svn_boolean_t *modified_p,
>
> Modified: subversion/trunk/subversion/libsvn_wc/workqueue.c
> URL:
http://svn.apache.org/viewvc/subversion/trunk/subversion/libsvn_wc/workqueue.c?rev=1091495&r1=1091494&r2=1091495&view=diff
>
==============================================================================
> --- subversion/trunk/subversion/libsvn_wc/workqueue.c (original)
> +++ subversion/trunk/subversion/libsvn_wc/workqueue.c Tue Apr 12 16:43:23
2011
> @@ -736,9 +736,6 @@ log_do_committed(svn_wc__db_t *db,
>       || kind == svn_wc__db_kind_symlink)
>     {
>       svn_boolean_t overwrote_working;
> -      apr_finfo_t finfo;
> -      svn_filesize_t translated_size;
> -      apr_time_t last_mod_time;
>
>       SVN_ERR(svn_wc__db_global_commit(db, local_abspath,
>                                        new_revision, changed_rev,
> @@ -767,44 +764,32 @@ log_do_committed(svn_wc__db_t *db,
>                                      cancel_func, cancel_baton,
>                                      pool));
>
> -      SVN_ERR(svn_io_stat(&finfo, local_abspath,
> -                          APR_FINFO_MIN | APR_FINFO_LINK, pool));
> -
>       /* We will compute and modify the size and timestamp */
> -
> -      translated_size = finfo.size;
> -
>       if (overwrote_working)
>         {
> -          last_mod_time = finfo.mtime;
> +          apr_finfo_t finfo;
> +
> +          SVN_ERR(svn_io_stat(&finfo, local_abspath,
> +                              APR_FINFO_MIN | APR_FINFO_LINK, pool));
> +          SVN_ERR(svn_wc__db_global_record_fileinfo(db, local_abspath,
> +                                                    finfo.size,
finfo.mtime,
> +                                                    pool));
>         }
>       else
>         {
>           svn_boolean_t modified;
> -          /* The working copy file hasn't been overwritten, meaning
> -             we need to decide which timestamp to use. */
>
> -          /* Compare the texts. We just removed the translated size
> -             and working time from the nodes record by calling
> -             svn_wc__db_global_commit , so we can just use
> -             svn_wc__internal_file_modified_p's internal logic
> -             to determine if we should mark the file as unmodified */
> +          /* The working copy file hasn't been overwritten.  We just
> +           removed the translated size and working time from the nodes
> +           record by calling svn_wc__db_global_commit, so we can use
> +           svn_wc__internal_file_modified_p's internal logic to
> +           "repair" them if the file is unmodified */
>           SVN_ERR(svn_wc__internal_file_modified_p(&modified, NULL, NULL,
>                                                    db, local_abspath,
>                                                    TRUE, FALSE, pool));
>
> -          /* If they are the same, use the working file's timestamp,
> -             else use epoch. */
> -          if (modified)
> -            return SVN_NO_ERROR; /* Don't record fileinfo */
> -
> -          last_mod_time = finfo.mtime;
>         }
> -
> -      return svn_error_return(svn_wc__db_global_record_fileinfo(
> -                                db, local_abspath,
> -                                translated_size, last_mod_time,
> -                                pool));
> +      return SVN_NO_ERROR;
>     }
>
>   /* It's not a file, so it's a directory. */
>
>

Re: svn commit: r1091495 - in /subversion/trunk/subversion/libsvn_wc: wc.h workqueue.c

Posted by Greg Stein <gs...@gmail.com>.
On Tue, Apr 12, 2011 at 13:34, C. Michael Pilato <cm...@collab.net> wrote:
> On 04/12/2011 01:08 PM, Philip Martin wrote:
>> Greg Stein <gs...@gmail.com> writes:
>>
>>>> + * If the text is unmodified and a write-lock is held this function
>>>> + * will repair "broken" timestamps and filesizes.
>>>
>>> I don't understand what is repaired. The database, or the file. If the file,
>>> then how do we repair its filesize?
>>>
>>> This notion of "repair" is equally fuzzy in the later portions of this
>>> commit.
>>
>> "Timestamp repair" is the term that has been used since it was introduced
>> in 1.2.  I'll look at writing it down somewhere.

Yeah... I've generally glossed over it when running into it, and then
called it "record fileinfo" when writing wc_db code. The latter is
much clearer, I believe.

>
> See r1091512.

Thanks. It is much clearer now!

I'd still prefer to stick to "record fileinfo" when possible, though.
There is no ambiguity about *what* is being "repaired" (ie. it could
have been use_commit_times, so we would *set* the file's timestamp...
I just didn't know).

Cheers,
-g

Re: svn commit: r1091495 - in /subversion/trunk/subversion/libsvn_wc: wc.h workqueue.c

Posted by "C. Michael Pilato" <cm...@collab.net>.
On 04/12/2011 01:08 PM, Philip Martin wrote:
> Greg Stein <gs...@gmail.com> writes:
> 
>>> + * If the text is unmodified and a write-lock is held this function
>>> + * will repair "broken" timestamps and filesizes.
>>
>> I don't understand what is repaired. The database, or the file. If the file,
>> then how do we repair its filesize?
>>
>> This notion of "repair" is equally fuzzy in the later portions of this
>> commit.
> 
> "Timestamp repair" is the term that has been used since it was introduced
> in 1.2.  I'll look at writing it down somewhere.

See r1091512.

-- 
C. Michael Pilato <cm...@collab.net>
CollabNet   <>   www.collab.net   <>   Distributed Development On Demand


Re: svn commit: r1091495 - in /subversion/trunk/subversion/libsvn_wc: wc.h workqueue.c

Posted by Philip Martin <ph...@wandisco.com>.
Greg Stein <gs...@gmail.com> writes:

>> + * If the text is unmodified and a write-lock is held this function
>> + * will repair "broken" timestamps and filesizes.
>
> I don't understand what is repaired. The database, or the file. If the file,
> then how do we repair its filesize?
>
> This notion of "repair" is equally fuzzy in the later portions of this
> commit.

"Timestamp repair" is the term that has been used since it was introduced
in 1.2.  I'll look at writing it down somewhere.

-- 
Philip