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

Re: saving time stamps of files - HELP please

From: P.Marek <pmarek_at_cpan.org>
Date: 2003-05-19 10:11:47 CEST

> > Regarding the patch:
> >
> > Can you write a log message (see HACKING, and run 'svn log' on the
> > Subversion repository to see examples)? Also, it's easier for us to
> > apply patches when they are relative to the top of the source tree.
> Oh, I forgot to say: if this is regarding a particular issue, please
> include the issue number in the log message (and maybe the subject
> line?).
I'll do what I can. I even wrote some lines in the doc/book/ch06.xml :-!

But for now I've got a problem. I'm not very familiar with subversion as I
started coding Friday.

In file subversion/libsvn_client/commit_util.c in function do_item_commit()
there I've inserted this:

 if (ctx->cancel_func)
   SVN_ERR (ctx->cancel_func (ctx->cancel_baton));

 /* Validation. */
 if (item->state_flags & SVN_CLIENT_COMMIT_ITEM_IS_COPY)
     if (! copyfrom_url)
       return svn_error_createf
         (SVN_ERR_BAD_URL, NULL,
          "Commit item '%s' has copy flag but no copyfrom url", url);
     if (! SVN_IS_VALID_REVNUM (item->revision))
       return svn_error_createf
          "Commit item '%s' has copy flag but an invalid revision", url);

 /* Get the parent dir_baton. */
 parent_baton = ((void **) db_stack->elts)[*stack_ptr - 1];

>>>> INSERT starts here
 /* Save the new timestamp of files */
 if (kind == svn_node_file)
     apr_time_t tstamp;
     svn_string_t time_str;
     apr_pool_t *cpool = item->wcprop_changes->pool;
     svn_prop_t *prop = apr_palloc (cpool, sizeof (*prop));

     SVN_ERR (svn_io_file_affected_time (&tstamp, item->path, pool));
     /* Maybe the new property value should be compared against the
        old and only set if it changed?? */

     time_str.data = svn_time_to_cstring (tstamp, pool);
     time_str.len = strlen(time_str.data);

     /* HELP please - is there a high level function like this one? */
     SVN_ERR (svn_wc_prop_set (SVN_PROP_TEXT_TIME, &time_str, item->path,
                               parent_access, pool));

     /* OR - won't work, is an array */
     apr_hash_set (file_mods, item->url, APR_HASH_KEY_STRING, (void *)mod);

     /* OR - won't work, would have to search for an existing property */
     prop->name = apr_pstrdup (cpool, name);
         prop->value = svn_string_ncreate (time_str.data, time_str.value,
     *((svn_prop_t **) apr_array_push (item->wcprop_changes)) = prop;

     /* END HELP */

     item->state_flags |= SVN_CLIENT_COMMIT_ITEM_PROP_MODS;
>>>> INSERT ends here

 /* If a feedback table was supplied by the application layer,
    describe what we're about to do to this item. */
 if (ctx->notify_func)

My problem is: which is the recommended way to search the array for a property
and add/change the value? I don't think I'll have to code that by hand - I'm
pretty sure there is a function to do that, rrrright ???? :-)

As of now I've covered
 - add finished
 - export finished
 - a note in doc/book/ch06.xml finished
 - commit in progress
 - on wc update the newer of the stamps is taken - which is mostly pointless,
   as this file will be committed if it had changed locally and then it'll get
   another timestamp.
 - import is next

Note: when I say finished, I BELIEVE it's finished. You may disagree. That's
why I'll post a complete patch when I'm finished for review and possible
So: Is there something I've forgotten? (as of the list above)? I think holes
will be uncovered when my patch is posted, but is there something to be seen

To unsubscribe, e-mail: dev-unsubscribe@subversion.tigris.org
For additional commands, e-mail: dev-help@subversion.tigris.org
Received on Mon May 19 10:13:01 2003

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

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