Alien-SVN

 view release on metacpan or  search on metacpan

src/subversion/subversion/libsvn_ra_serf/log.c  view on Meta::CPAN

  svn_log_entry_receiver_t receiver;
  void *receiver_baton;

  /* pre-1.5 compatibility */
  svn_boolean_t want_author;
  svn_boolean_t want_date;
  svn_boolean_t want_message;
} log_context_t;

#define D_ "DAV:"
#define S_ SVN_XML_NAMESPACE
static const svn_ra_serf__xml_transition_t log_ttable[] = {
  { INITIAL, S_, "log-report", REPORT,
    FALSE, { NULL }, FALSE },

  /* Note that we have an opener here. We need to construct a new LOG_ENTRY
     to record multiple paths.  */
  { REPORT, S_, "log-item", ITEM,
    FALSE, { NULL }, TRUE },

  { ITEM, D_, SVN_DAV__VERSION_NAME, VERSION,
    TRUE, { NULL }, TRUE },

  { ITEM, D_, "creator-displayname", CREATOR,
    TRUE, { "?encoding", NULL }, TRUE },

  { ITEM, S_, "date", DATE,
    TRUE, { "?encoding", NULL }, TRUE },

  { ITEM, D_, "comment", COMMENT,
    TRUE, { "?encoding", NULL }, TRUE },

  { ITEM, S_, "revprop", REVPROP,
    TRUE, { "name", "?encoding", NULL }, TRUE },

  { ITEM, S_, "has-children", HAS_CHILDREN,
    FALSE, { NULL }, TRUE },

  { ITEM, S_, "subtractive-merge", SUBTRACTIVE_MERGE,
    FALSE, { NULL }, TRUE },

  { ITEM, S_, "added-path", ADDED_PATH,
    TRUE, { "?node-kind", "?text-mods", "?prop-mods",
            "?copyfrom-path", "?copyfrom-rev", NULL }, TRUE },

  { ITEM, S_, "replaced-path", REPLACED_PATH,
    TRUE, { "?node-kind", "?text-mods", "?prop-mods",
            "?copyfrom-path", "?copyfrom-rev", NULL }, TRUE },

  { ITEM, S_, "deleted-path", DELETED_PATH,
    TRUE, { "?node-kind", "?text-mods", "?prop-mods", NULL }, TRUE },

  { ITEM, S_, "modified-path", MODIFIED_PATH,
    TRUE, { "?node-kind", "?text-mods", "?prop-mods", NULL }, TRUE },

  { 0 }
};


/* Store CDATA into REVPROPS, associated with PROPNAME. If ENCODING is not
   NULL, then it must base "base64" and CDATA will be decoded first.

   NOTE: PROPNAME must live longer than REVPROPS.  */
static svn_error_t *
collect_revprop(apr_hash_t *revprops,
                const char *propname,
                const svn_string_t *cdata,
                const char *encoding)
{
  apr_pool_t *result_pool = apr_hash_pool_get(revprops);
  const svn_string_t *decoded;

  if (encoding)
    {
      /* Check for a known encoding type.  This is easy -- there's
         only one.  */
      if (strcmp(encoding, "base64") != 0)
        {
          return svn_error_createf(SVN_ERR_RA_DAV_MALFORMED_DATA, NULL,
                                   _("Unsupported encoding '%s'"),
                                   encoding);
        }

      decoded = svn_base64_decode_string(cdata, result_pool);
    }
  else
    {
      decoded = svn_string_dup(cdata, result_pool);
    }

  /* Caller has ensured PROPNAME has sufficient lifetime.  */
  svn_hash_sets(revprops, propname, decoded);

  return SVN_NO_ERROR;
}


/* Record ACTION on the path in CDATA into PATHS. Other properties about
   the action are pulled from ATTRS.  */
static svn_error_t *
collect_path(apr_hash_t *paths,
             char action,
             const svn_string_t *cdata,
             apr_hash_t *attrs)
{
  apr_pool_t *result_pool = apr_hash_pool_get(paths);
  svn_log_changed_path2_t *lcp;
  const char *copyfrom_path;
  const char *copyfrom_rev;
  const char *path;

  lcp = svn_log_changed_path2_create(result_pool);
  lcp->action = action;
  lcp->copyfrom_rev = SVN_INVALID_REVNUM;

  /* COPYFROM_* are only recorded for ADDED_PATH and REPLACED_PATH.  */
  copyfrom_path = svn_hash_gets(attrs, "copyfrom-path");
  copyfrom_rev = svn_hash_gets(attrs, "copyfrom-rev");
  if (copyfrom_path && copyfrom_rev)
    {
      svn_revnum_t rev = SVN_STR_TO_REV(copyfrom_rev);

      if (SVN_IS_VALID_REVNUM(rev))
        {
          lcp->copyfrom_path = apr_pstrdup(result_pool, copyfrom_path);
          lcp->copyfrom_rev = rev;
        }
    }

  lcp->node_kind = svn_node_kind_from_word(svn_hash_gets(attrs, "node-kind"));
  lcp->text_modified = svn_tristate__from_word(svn_hash_gets(attrs,
                                                             "text-mods"));
  lcp->props_modified = svn_tristate__from_word(svn_hash_gets(attrs,
                                                              "prop-mods"));

  path = apr_pstrmemdup(result_pool, cdata->data, cdata->len);
  svn_hash_sets(paths, path, lcp);

  return SVN_NO_ERROR;
}


/* Conforms to svn_ra_serf__xml_opened_t  */
static svn_error_t *
log_opened(svn_ra_serf__xml_estate_t *xes,
           void *baton,
           int entered_state,
           const svn_ra_serf__dav_props_t *tag,
           apr_pool_t *scratch_pool)
{
  log_context_t *log_ctx = baton;



( run in 0.959 second using v1.01-cache-2.11-cpan-df04353d9ac )