Exemplo n.º 1
0
/* This implements svn_editor_cb_delete_t */
static svn_error_t *
delete_cb(void *baton,
          const char *relpath,
          svn_revnum_t revision,
          apr_pool_t *scratch_pool)
{
  struct ev2_baton *eb = baton;

  SVN_ERR(svn_editor_delete(eb->inner, relpath, revision));
  return SVN_NO_ERROR;
}
Exemplo n.º 2
0
static svn_error_t *
process_actions(void *edit_baton,
                const char *path,
                apr_array_header_t *actions,
                apr_pool_t *scratch_pool)
{
  struct ev2_edit_baton *eb = edit_baton;
  apr_hash_t *props = NULL;
  int i;

  /* Go through all of our actions, populating various datastructures
   * dependent on them. */
  for (i = 0; i < actions->nelts; i++)
    {
      const struct path_action *action = APR_ARRAY_IDX(actions, i,
                                                       struct path_action *);

      switch (action->action)
        {
          case ACTION_SET_PROP:
            {
              const struct prop_args *p_args = action->args;

              if (!props)
                {
                  /* Fetch the original props. We can then apply each of
                     the modifications to it.  */
                  SVN_ERR(eb->fetch_props_func(&props,
                                               eb->fetch_props_baton,
                                               path,
                                               scratch_pool, scratch_pool));
                }

              /* Note that p_args->value may be NULL.  */
              apr_hash_set(props, p_args->name, APR_HASH_KEY_STRING,
                           p_args->value);
              break;
            }

          case ACTION_DELETE:
            {
              svn_revnum_t *revnum = action->args;

              /* If we get a delete, we'd better not have gotten any
                 other actions for this path later, so we can go ahead
                 and call our handler. */
              SVN_ERR(svn_editor_delete(eb->editor, path, *revnum));
              break;
            }

          case ACTION_ADD:
            {
              /* ### do something  */
              break;
            }

          default:
            SVN_ERR_MALFUNCTION();
        }
    }

  /* We've now got a wholistic view of what has happened to this node,
   * so we can call our own editor APIs on it. */

  if (props)
    {
      /* We fetched and modified the props in some way. Apply 'em now that
         we have the new set.  */
      SVN_ERR(svn_editor_set_props(eb->editor, path, eb->target_revision,
                                   props, TRUE));
    }

  return SVN_NO_ERROR;
}