예제 #1
0
파일: utils.c 프로젝트: Ranga123/test1
svn_error_t *
sbox_wc_move(svn_test__sandbox_t *b, const char *src, const char *dst)
{
  svn_client_ctx_t *ctx;
  apr_array_header_t *paths = apr_array_make(b->pool, 1,
                                             sizeof(const char *));

  SVN_ERR(svn_client_create_context2(&ctx, NULL, b->pool));
  ctx->wc_ctx = b->wc_ctx;
  APR_ARRAY_PUSH(paths, const char *) = sbox_wc_path(b, src);
  return svn_client_move7(paths, sbox_wc_path(b, dst),
                          FALSE /* move_as_child */,
                          FALSE /* make_parents */,
                          TRUE /* allow_mixed_revisions */,
                          FALSE /* metadata_only */,
                          NULL /* revprop_table */,
                          NULL, NULL, /* commit callback */
                          ctx, b->pool);
}
예제 #2
0
static gpointer move_thread (gpointer user_data)
{
  struct thread_args *args = user_data;
  svn_error_t *err;
  apr_array_header_t *paths;
  svn_client_ctx_t *ctx = args->ctx;
  apr_pool_t *subpool, *pool = args->pool;
  TshNotifyDialog *dialog = args->dialog;
  gchar *from = args->from;
  gchar *to = args->to;
  gchar *error_str;
#if CHECK_SVN_VERSION_S(1,6)
  svn_commit_info_t *commit_info;
  gchar *message;
  gchar buffer[256];
#endif

  g_free (args);

  subpool = svn_pool_create (pool);

  paths = apr_array_make (subpool, 1, sizeof (const char *));

  APR_ARRAY_PUSH (paths, const char *) = from;

#if CHECK_SVN_VERSION_G(1,8)
  if ((err = svn_client_move7(paths, to, FALSE, FALSE, TRUE, FALSE, NULL,
                              tsh_commit_func2, dialog, ctx, subpool)))
#elif CHECK_SVN_VERSION_G(1,7)
  if ((err = svn_client_move6(paths, to, FALSE, FALSE, NULL, tsh_commit_func2,
                              dialog, ctx, subpool)))
#else
  if ((err = svn_client_move5(&commit_info, paths, to, FALSE, FALSE, FALSE,
                              NULL, ctx, subpool)))
#endif
  {
    svn_pool_destroy (subpool);

    error_str = tsh_strerror(err);

G_GNUC_BEGIN_IGNORE_DEPRECATIONS
    gdk_threads_enter();
    tsh_notify_dialog_add(dialog, _("Failed"), error_str, NULL);
    tsh_notify_dialog_done (dialog);
    gdk_threads_leave();
G_GNUC_END_IGNORE_DEPRECATIONS

    g_free(error_str);

    svn_error_clear(err);
    tsh_reset_cancel();
    return GINT_TO_POINTER (FALSE);
  }

#if CHECK_SVN_VERSION_S(1,6)
  if(SVN_IS_VALID_REVNUM(commit_info->revision))
  {
    g_snprintf(buffer, 256, _("At revision: %ld"), commit_info->revision);
    message = buffer;
  }
  else
  {
    message = _("Local move");
  }
#endif

  svn_pool_destroy (subpool);

G_GNUC_BEGIN_IGNORE_DEPRECATIONS
  gdk_threads_enter();
#if CHECK_SVN_VERSION_S(1,6)
  tsh_notify_dialog_add(dialog, _("Completed"), message, NULL);
#endif
  tsh_notify_dialog_done (dialog);
  gdk_threads_leave();
G_GNUC_END_IGNORE_DEPRECATIONS

  tsh_reset_cancel();
  return GINT_TO_POINTER (TRUE);
}