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

more dav questions for gstein

From: Ben Collins-Sussman <sussman_at_collab.net>
Date: 2002-01-03 19:23:43 CET

So I'm teaching mod_dav_svn/liveprops.c to respond to new DAV
properties, and one of the case statements already exists:

case DAV_PROPID_version_name:
      /* only defined for Version Resources and Baselines */
      /* ### whoops. also defined for VCRs. deal with it later. */
      if (resource->type != DAV_RESOURCE_TYPE_VERSION)
        return DAV_PROP_INSERT_NOTSUPP;
      if (resource->baselined)
        {
          /* just the revision number for baselines */
          value = apr_psprintf(p, "%ld", resource->info->root.rev);
        }
      else if (resource->info->node_id != NULL)
        {
          svn_stringbuf_t *id = svn_fs_unparse_id(resource->info->node_id, p);

          /* use ":ID" */
          value = apr_psprintf(p, ":%s", id->data);
        }
      else
        {
          /* assert: repos_path != NULL */

          /* use "REV:PATH" */
          value = apr_psprintf(p, "%ld:%s",
                               resource->info->root.rev,
                               resource->info->repos_path);
        }
      break;

Apparently, up till now, this property has only been coming down on
baseline collection PROPFINDs... I think. But now I want this
property to come down with regular files and directories -- whenever
we do a PROPFIND <allprop/> during normal checkouts and updates. I'm
confused as to how this logic look. My first attempt was to simplify:

    case DAV_PROPID_version_name:
      /* only defined for Version Resources and Baselines */
      /* ### whoops. also defined for VCRs. deal with it later. */
      if (resource->type != DAV_RESOURCE_TYPE_VERSION)
        return DAV_PROP_INSERT_NOTSUPP;

      if (resource->baselined)
        {
          /* just the revision number for baselines */
          value = apr_psprintf(p, "%ld", resource->info->root.rev);
        }
      else
        {
          svn_revnum_t committed_rev = SVN_INVALID_REVNUM;
          
          /* Get the CR field out of the node's skel. Notice that the
             root object might be an ID root -or- a revision root. */
          serr = svn_fs_node_created_rev(&committed_rev,
                                         resource->info->root.root,
                                         DAV_SVN_REPOS_PATH(resource), p);
          if (serr != NULL)
            {
              /* ### what to do? */
              value = "###error###";
              break;
            }
          
          /* Convert the revision into a quoted string */
          s = apr_psprintf(p, "%ld", committed_rev);
          value = apr_xml_quote_string(p, s, 1);
        }
        break;

But this doesn't work; during checkouts and updates, I'm getting the
new date and author props, but this one doesn't show up at all! I
think my confusion is coming from not understanding the taxonomy of
DAV resources very well:

typedef enum {
    DAV_RESOURCE_TYPE_UNKNOWN,

    DAV_RESOURCE_TYPE_REGULAR, /* file or collection; could be
                                         * unversioned, or version selector,
                                         * or baseline selector */

    DAV_RESOURCE_TYPE_VERSION, /* version or baseline URL */

    DAV_RESOURCE_TYPE_HISTORY, /* version or baseline history URL */

    DAV_RESOURCE_TYPE_WORKING, /* working resource URL */

    DAV_RESOURCE_TYPE_WORKSPACE, /* workspace URL */

    DAV_RESOURCE_TYPE_ACTIVITY, /* activity URL */

    DAV_RESOURCE_TYPE_PRIVATE /* repository-private type */

} dav_resource_type;

Gstein, can you explain to me how this case statement should be
structured?

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@subversion.tigris.org
For additional commands, e-mail: dev-help@subversion.tigris.org
Received on Sat Oct 21 14:36:54 2006

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.