Пример #1
0
/* Return the detailed string representation of STATUS */
static const char *
generate_status_desc(enum svn_wc_status_kind status)
{
    switch (status)
    {
    case svn_wc_status_none:
        return "none";
    case svn_wc_status_normal:
        return "normal";
    case svn_wc_status_added:
        return "added";
    case svn_wc_status_missing:
        return "missing";
    case svn_wc_status_incomplete:
        return "incomplete";
    case svn_wc_status_deleted:
        return "deleted";
    case svn_wc_status_replaced:
        return "replaced";
    case svn_wc_status_modified:
        return "modified";
    case svn_wc_status_conflicted:
        return "conflicted";
    case svn_wc_status_obstructed:
        return "obstructed";
    case svn_wc_status_ignored:
        return "ignored";
    case svn_wc_status_external:
        return "external";
    case svn_wc_status_unversioned:
        return "unversioned";
    default:
        SVN_ERR_MALFUNCTION_NO_RETURN();
    }
}
Пример #2
0
/* A default warning handling function.  */
static void
default_warning_func(void *baton, svn_error_t *err)
{
  /* The one unforgiveable sin is to fail silently.  Dumping to stderr
     or /dev/tty is not acceptable default behavior for server
     processes, since those may both be equivalent to /dev/null.  */
  SVN_ERR_MALFUNCTION_NO_RETURN();
}
Пример #3
0
/* APR cleanup function used to close the database when its pool is destroyed.
   DATA should be the svn_sqlite__db_t handle for the database. */
static apr_status_t
close_apr(void *data)
{
  svn_sqlite__db_t *db = data;
  svn_error_t *err = SVN_NO_ERROR;
  apr_status_t result;
  int i;

  /* Check to see if we've already closed this database. */
  if (db->db3 == NULL)
    return APR_SUCCESS;

  /* Finalize any prepared statements. */
  if (db->prepared_stmts)
    {
      for (i = 0; i < db->nbr_statements + STMT_INTERNAL_LAST; i++)
        {
          if (db->prepared_stmts[i])
            {
              if (i < db->nbr_statements
                  && db->prepared_stmts[i]->needs_reset)
                {
#ifdef SVN_DEBUG
                  const char *stmt_text = db->statement_strings[i];
                  SVN_UNUSED(stmt_text);

                  SVN_ERR_MALFUNCTION_NO_RETURN();
#else
                  err = svn_error_compose_create(err,
                            svn_sqlite__reset(db->prepared_stmts[i]));
#endif
                }
              err = svn_error_compose_create(
                        svn_sqlite__finalize(db->prepared_stmts[i]), err);
            }
        }
    }

  result = sqlite3_close(db->db3);

  /* If there's a pre-existing error, return it. */
  if (err)
    {
      result = err->apr_err;
      svn_error_clear(err);
      return result;
    }

  if (result != SQLITE_OK)
    return SQLITE_ERROR_CODE(result); /* ### lossy */

  db->db3 = NULL;

  return APR_SUCCESS;
}
Пример #4
0
/* Return TRUE iff changes to immediate children of the directory
   identified by PB, when those children are of node kind KIND, are
   allowed by the requested depth which this editor is trying to
   preserve.  EB is the edit baton.  */
static svn_boolean_t
okay_to_edit(struct edit_baton *eb,
             struct node_baton *pb,
             svn_node_kind_t kind)
{
  int effective_depth;

  /* If we've already filter out the parent directory, we necessarily
     are filtering out its children, too.  */
  if (pb->filtered)
    return FALSE;

  /* Calculate the effective depth of the parent directory.

     NOTE:  "Depth" in this sense is not the same as the Subversion
     magic depth keywords.  Here, we're talking about a literal,
     integral, stacked depth of directories.

     The root of the edit is generally depth=1, subdirectories thereof
     depth=2, and so on.  But if we have an edit target -- which means
     that the real target of the edit operation isn't the root
     directory, but is instead some immediate child thereof -- we have
     to adjust our calculated effected depth such that the target
     itself is depth=1 (as are its siblings, which we trust aren't
     present in the edit at all), immediate subdirectories thereof are
     depth=2, and so on.
  */
  effective_depth = pb->dir_depth - (eb->has_target ? 1 : 0);
  switch (eb->requested_depth)
    {
    case svn_depth_empty:
      return (effective_depth <= 0);
    case svn_depth_files:
      return ((effective_depth <= 0)
              || (kind == svn_node_file && effective_depth == 1));
    case svn_depth_immediates:
      return (effective_depth <= 1);
    case svn_depth_unknown:
    case svn_depth_exclude:
    case svn_depth_infinity:
      /* Shouldn't reach; see svn_delta_depth_filter_editor() */
    default:
      SVN_ERR_MALFUNCTION_NO_RETURN();
    }
}
Пример #5
0
/* Unicode normalizing collation for WC paths */
static int
collate_ucs_nfd(void *baton,
                int len1, const void *key1,
                int len2, const void *key2)
{
  svn_sqlite__db_t *db = baton;
  int result;

  if (svn_utf__normcmp(key1, len1, key2, len2,
                       &db->sqlext_buf1, &db->sqlext_buf2, &result))
    {
      /* There is really nothing we can do here if an error occurs
         during Unicode normalizetion, and attempting to recover could
         result in the wc.db index being corrupted. Presumably this
         can only happen if the index already contains invalid UTF-8
         strings, which should never happen in any case ... */
      SVN_ERR_MALFUNCTION_NO_RETURN();
    }

  return result;
}