[Xfce4-commits] <thunar-vcs-plugin:master> Added support for subversion 1.7
Peter de Ridder
noreply at xfce.org
Sun Nov 6 17:04:01 CET 2011
Updating branch refs/heads/master
to 427fc58bdb0961ae00e9744a7d0b1284606b541e (commit)
from 159e4e715926fab3be205b90428b6af27213cff2 (commit)
commit 427fc58bdb0961ae00e9744a7d0b1284606b541e
Author: Peter de Ridder <peter at xfce.org>
Date: Sun Nov 6 16:59:28 2011 +0100
Added support for subversion 1.7
thunar-vcs-plugin/tvp-svn-backend.c | 249 ++++++++++++++++------------
thunar-vcs-plugin/tvp-svn-backend.h | 1 +
tvp-git-helper/tgh-common.c | 4 +-
tvp-svn-helper/tsh-blame.c | 43 +++--
tvp-svn-helper/tsh-commit.c | 17 ++-
tvp-svn-helper/tsh-common.c | 214 +++++++++++++++++++++----
tvp-svn-helper/tsh-common.h | 3 +
tvp-svn-helper/tsh-copy.c | 63 ++++---
tvp-svn-helper/tsh-delete.c | 51 ++++---
tvp-svn-helper/tsh-export.c | 47 +++---
tvp-svn-helper/tsh-file-selection-dialog.c | 75 ++++++---
tvp-svn-helper/tsh-import.c | 55 ++++---
tvp-svn-helper/tsh-log.c | 1 +
tvp-svn-helper/tsh-move.c | 51 ++++---
tvp-svn-helper/tsh-properties.c | 37 +++--
tvp-svn-helper/tsh-relocate.c | 91 ++++++-----
tvp-svn-helper/tsh-status.c | 45 +++---
tvp-svn-helper/tsh-switch.c | 85 ++++++-----
tvp-svn-helper/tsh-update.c | 81 +++++-----
19 files changed, 772 insertions(+), 441 deletions(-)
diff --git a/thunar-vcs-plugin/tvp-svn-backend.c b/thunar-vcs-plugin/tvp-svn-backend.c
index 66322d3..86e284e 100644
--- a/thunar-vcs-plugin/tvp-svn-backend.c
+++ b/thunar-vcs-plugin/tvp-svn-backend.c
@@ -22,6 +22,7 @@
#include <glib.h>
+#include <subversion-1/svn_version.h>
#include <subversion-1/svn_cmdline.h>
#include <subversion-1/svn_client.h>
#include <subversion-1/svn_pools.h>
@@ -130,138 +131,160 @@ gboolean
tvp_svn_backend_is_working_copy (const gchar *uri)
{
apr_pool_t *subpool;
- svn_error_t *err;
- int wc_format;
+ svn_error_t *err;
+ int wc_format;
gchar *path;
+#if CHECK_SVN_VERSION_G(1,7)
+ svn_wc_context_t *wc_ctx;
+#endif
- /* strip the "file://" part of the uri */
- if (strncmp (uri, "file://", 7) == 0)
- {
- uri += 7;
- }
+ /* strip the "file://" part of the uri */
+ if (strncmp (uri, "file://", 7) == 0)
+ {
+ uri += 7;
+ }
- path = g_strdup (uri);
+ path = g_strdup (uri);
- /* remove trailing '/' cause svn_wc_check_wc can't handle that */
- if (path[strlen (path) - 1] == '/')
- {
- path[strlen (path) - 1] = '\0';
- }
+ /* remove trailing '/' cause svn_wc_check_wc can't handle that */
+ if (path[strlen (path) - 1] == '/')
+ {
+ path[strlen (path) - 1] = '\0';
+ }
subpool = svn_pool_create (pool);
- /* check for the path is a working copy */
- err = svn_wc_check_wc (path, &wc_format, subpool);
+#if CHECK_SVN_VERSION(1,5) || CHECK_SVN_VERSION(1,6)
+ /* check for the path is a working copy */
+ err = svn_wc_check_wc (path, &wc_format, subpool);
+#else /* CHECK_SVN_VERSION(1,7) */
+ err = svn_wc_context_create (&wc_ctx, NULL, subpool, subpool);
+ if (!err)
+ {
+ err = svn_wc_check_wc2 (&wc_format, wc_ctx, path, subpool);
+ }
+#endif
svn_pool_destroy (subpool);
- g_free (path);
+ g_free (path);
- /* if an error occured or wc_format in not set it is no working copy */
- if(err || !wc_format)
- {
+ /* if an error occured or wc_format in not set it is no working copy */
+ if (err || !wc_format)
+ {
svn_error_clear (err);
- return FALSE;
- }
-
- return TRUE;
+ return FALSE;
+ }
+
+ return TRUE;
}
+#if CHECK_SVN_VERSION(1,5)
static void
status_callback2 (void *baton, const char *path, svn_wc_status2_t *status)
-{
- GSList **list = baton;
- TvpSvnFileStatus *entry = g_new (TvpSvnFileStatus, 1);
-
- entry->path = g_strdup (path);
- switch (status->text_status)
- {
- case svn_wc_status_normal:
- case svn_wc_status_added:
- case svn_wc_status_missing:
- case svn_wc_status_deleted:
- case svn_wc_status_replaced:
- case svn_wc_status_modified:
- case svn_wc_status_merged:
- case svn_wc_status_conflicted:
- case svn_wc_status_incomplete:
- entry->flag.version_control = 1;
- break;
- default:
- entry->flag.version_control = 0;
- break;
- }
-
- *list = g_slist_prepend (*list, entry);
-}
-
-
+#elif CHECK_SVN_VERSION(1,6)
static svn_error_t *
status_callback3 (void *baton, const char *path, svn_wc_status2_t *status, apr_pool_t *pool_)
+#else /* CHECK_SVN_VERSION(1,7) */
+static svn_error_t *
+status_callback (void *baton, const char *path, const svn_client_status_t *status, apr_pool_t *pool_)
+#endif
{
- status_callback2(baton, path, status);
- return SVN_NO_ERROR;
+ GSList **list = baton;
+ TvpSvnFileStatus *entry = g_new (TvpSvnFileStatus, 1);
+
+ entry->path = g_strdup (path);
+ switch (status->text_status)
+ {
+ case svn_wc_status_normal:
+ case svn_wc_status_added:
+ case svn_wc_status_missing:
+ case svn_wc_status_deleted:
+ case svn_wc_status_replaced:
+ case svn_wc_status_modified:
+ case svn_wc_status_merged:
+ case svn_wc_status_conflicted:
+ case svn_wc_status_incomplete:
+ entry->flag.version_control = 1;
+ break;
+ default:
+ entry->flag.version_control = 0;
+ break;
+ }
+
+ *list = g_slist_prepend (*list, entry);
+#if CHECK_SVN_VERSION_G(1,6)
+ return SVN_NO_ERROR;
+#endif
}
+
GSList *
tvp_svn_backend_get_status (const gchar *uri)
{
apr_pool_t *subpool;
- svn_error_t *err;
- svn_opt_revision_t revision = {svn_opt_revision_working};
- GSList *list = NULL;
+ svn_error_t *err;
+ svn_opt_revision_t revision = {svn_opt_revision_working};
+ GSList *list = NULL;
gchar *path;
- /* strip the "file://" part of the uri */
- if (strncmp (uri, "file://", 7) == 0)
- {
- uri += 7;
- }
+ /* strip the "file://" part of the uri */
+ if (strncmp (uri, "file://", 7) == 0)
+ {
+ uri += 7;
+ }
- path = g_strdup (uri);
+ path = g_strdup (uri);
- /* remove trailing '/' cause svn_client_status2 can't handle that */
- if (path[strlen (path) - 1] == '/')
- {
- path[strlen (path) - 1] = '\0';
- }
+ /* remove trailing '/' cause svn_client_status2 can't handle that */
+ if (path[strlen (path) - 1] == '/')
+ {
+ path[strlen (path) - 1] = '\0';
+ }
subpool = svn_pool_create (pool);
- /* get the status of all files in the directory */
+ /* get the status of all files in the directory */
#if CHECK_SVN_VERSION(1,5)
- err = svn_client_status3 (NULL, path, &revision, status_callback2, &list, svn_depth_immediates, TRUE, FALSE, TRUE, TRUE, NULL, ctx, subpool);
-#else /* CHECK_SVN_VERSION(1,6) */
- err = svn_client_status4 (NULL, path, &revision, status_callback3, &list, svn_depth_immediates, TRUE, FALSE, TRUE, TRUE, NULL, ctx, subpool);
+ err = svn_client_status3 (NULL, path, &revision, status_callback2, &list, svn_depth_immediates, TRUE, FALSE, TRUE, TRUE, NULL, ctx, subpool);
+#elif CHECK_SVN_VERSION(1,6)
+ err = svn_client_status4 (NULL, path, &revision, status_callback3, &list, svn_depth_immediates, TRUE, FALSE, TRUE, TRUE, NULL, ctx, subpool);
+#else /* CHECK_SVN_VERSION(1,7) */
+ err = svn_client_status5 (NULL, ctx, path, &revision, svn_depth_immediates, TRUE, FALSE, TRUE, TRUE, TRUE, NULL, status_callback, list, subpool);
#endif
svn_pool_destroy (subpool);
- g_free (path);
+ g_free (path);
- if (err)
- {
- GSList *iter;
- for (iter = list; iter; iter = iter->next)
- {
- g_free (iter->data);
- }
- g_slist_free (list);
+ if (err)
+ {
+ GSList *iter;
+ for (iter = list; iter; iter = iter->next)
+ {
+ g_free (iter->data);
+ }
+ g_slist_free (list);
svn_error_clear (err);
- return NULL;
- }
+ return NULL;
+ }
- return list;
+ return list;
}
+#if CHECK_SVN_VERSION(1,5) || CHECK_SVN_VERSION(1,6)
static svn_error_t *
info_callback (void *baton, const char *path, const svn_info_t *info, apr_pool_t *pool_)
+#else /* CHECK_SVN_VERSION(1,7) */
+static svn_error_t *
+info_callback (void *baton, const char *path, const svn_client_info2_t *info, apr_pool_t *pool_)
+#endif
{
TvpSvnInfo **pinfo = baton;
g_return_val_if_fail (*pinfo == NULL, SVN_NO_ERROR);
@@ -274,11 +297,24 @@ info_callback (void *baton, const char *path, const svn_info_t *info, apr_pool_t
(*pinfo)->modrev = info->last_changed_rev;
apr_ctime (((*pinfo)->moddate = g_new0(gchar, APR_CTIME_LEN)), info->last_changed_date);
(*pinfo)->modauthor = g_strdup (info->last_changed_author);
+#if CHECK_SVN_VERSION(1,5) || CHECK_SVN_VERSION(1,6)
if (((*pinfo)->has_wc_info = info->has_wc_info))
{
(*pinfo)->changelist = g_strdup (info->changelist);
- (*pinfo)->depth = info->depth;
+ (*pinfo)->depth = info->depth;
}
+#else /* CHECK_SVN_VERSION(1,7) */
+ if (info->wc_info)
+ {
+ (*pinfo)->has_wc_info = TRUE;
+ (*pinfo)->changelist = g_strdup (info->wc_info->changelist);
+ (*pinfo)->depth = info->wc_info->depth;
+ }
+ else
+ {
+ (*pinfo)->has_wc_info = FALSE;
+ }
+#endif
return SVN_NO_ERROR;
}
@@ -289,42 +325,47 @@ TvpSvnInfo *
tvp_svn_backend_get_info (const gchar *uri)
{
apr_pool_t *subpool;
- svn_error_t *err;
- svn_opt_revision_t revision = {svn_opt_revision_unspecified};
+ svn_error_t *err;
+ svn_opt_revision_t revision = {svn_opt_revision_unspecified};
TvpSvnInfo *info = NULL;
gchar *path;
- /* strip the "file://" part of the uri */
- if (strncmp (uri, "file://", 7) == 0)
- {
- uri += 7;
- }
+ /* strip the "file://" part of the uri */
+ if (strncmp (uri, "file://", 7) == 0)
+ {
+ uri += 7;
+ }
- path = g_strdup (uri);
+ path = g_strdup (uri);
- /* remove trailing '/' cause svn_client_info can't handle that */
- if (path[strlen (path) - 1] == '/')
- {
- path[strlen (path) - 1] = '\0';
- }
+ /* remove trailing '/' cause svn_client_info can't handle that */
+ if (path[strlen (path) - 1] == '/')
+ {
+ path[strlen (path) - 1] = '\0';
+ }
subpool = svn_pool_create (pool);
- /* get svn info for this file or directory */
- err = svn_client_info2 (path, &revision, &revision, info_callback, &info, svn_depth_empty, NULL, ctx, subpool);
+#if CHECK_SVN_VERSION(1,5) || CHECK_SVN_VERSION(1,6)
+ /* get svn info for this file or directory */
+ err = svn_client_info2 (path, &revision, &revision, info_callback, &info, svn_depth_empty, NULL, ctx, subpool);
+#else /* CHECK_SVN_VERSION(1,7) */
+ /* get svn info for this file or directory */
+ err = svn_client_info3 (path, &revision, &revision, svn_depth_empty, FALSE, TRUE, NULL, info_callback, &info, ctx, subpool);
+#endif
svn_pool_destroy (subpool);
- g_free (path);
+ g_free (path);
- if (err)
- {
+ if (err)
+ {
tvp_svn_info_free (info);
svn_error_clear (err);
- return NULL;
- }
+ return NULL;
+ }
- return info;
+ return info;
}
diff --git a/thunar-vcs-plugin/tvp-svn-backend.h b/thunar-vcs-plugin/tvp-svn-backend.h
index 4a1a24d..ed865cc 100644
--- a/thunar-vcs-plugin/tvp-svn-backend.h
+++ b/thunar-vcs-plugin/tvp-svn-backend.h
@@ -61,6 +61,7 @@ TvpSvnInfo *tvp_svn_backend_get_info (const gchar *uri);
void tvp_svn_info_free (TvpSvnInfo *info);
#define CHECK_SVN_VERSION(major, minor) ((major == SVN_VER_MAJOR) && (minor == SVN_VER_MINOR))
+#define CHECK_SVN_VERSION_G(major, minor) ((major < SVN_VER_MAJOR) || ((major == SVN_VER_MAJOR) && (minor <= SVN_VER_MINOR)))
G_END_DECLS;
diff --git a/tvp-git-helper/tgh-common.c b/tvp-git-helper/tgh-common.c
index 6e66d88..f137f43 100644
--- a/tvp-git-helper/tgh-common.c
+++ b/tvp-git-helper/tgh-common.c
@@ -128,13 +128,12 @@ tgh_common_prefix (gchar **files)
{
gchar **iter;
gchar *prefix;
- guint prefix_len, match;
+ guint match;
if (files == NULL || files[0] == NULL)
return NULL;
prefix = g_strdup (files[0]);
- prefix_len = strlen (prefix);
for (iter = &files[1]; *iter; iter++)
{
@@ -142,7 +141,6 @@ tgh_common_prefix (gchar **files)
prefix[match] = '\0';
if (match == 0)
break;
- prefix_len = match;
}
return prefix;
diff --git a/tvp-svn-helper/tsh-blame.c b/tvp-svn-helper/tsh-blame.c
index ac48ace..419b40b 100644
--- a/tvp-svn-helper/tsh-blame.c
+++ b/tvp-svn-helper/tsh-blame.c
@@ -29,6 +29,7 @@
#include <libxfce4util/libxfce4util.h>
+#include <subversion-1/svn_version.h>
#include <subversion-1/svn_client.h>
#include <subversion-1/svn_pools.h>
@@ -47,14 +48,14 @@ struct thread_args {
static gpointer blame_thread (gpointer user_data)
{
- struct thread_args *args = user_data;
+ struct thread_args *args = user_data;
svn_opt_revision_t revision, start, end;
svn_diff_file_options_t diff_options;
- svn_error_t *err;
- svn_client_ctx_t *ctx = args->ctx;
- apr_pool_t *subpool, *pool = args->pool;
- TshBlameDialog *dialog = args->dialog;
- gchar *file = args->file;
+ svn_error_t *err;
+ svn_client_ctx_t *ctx = args->ctx;
+ apr_pool_t *subpool, *pool = args->pool;
+ TshBlameDialog *dialog = args->dialog;
+ gchar *file = args->file;
GtkWidget *error;
gchar *error_str;
@@ -66,33 +67,37 @@ static gpointer blame_thread (gpointer user_data)
start.kind = svn_opt_revision_number;
start.value.number = 0;
end.kind = svn_opt_revision_head;
- if ((err = svn_client_blame4(file, &revision, &start, &end, &diff_options, FALSE, FALSE, tsh_blame_func2, dialog, ctx, subpool)))
- {
+#if CHECK_SVN_VERSION_S(1,6)
+ if ((err = svn_client_blame4(file, &revision, &start, &end, &diff_options, FALSE, FALSE, tsh_blame_func2, dialog, ctx, subpool)))
+#else /* CHECK_SVN_VERSION(1,7) */
+ if ((err = svn_client_blame5(file, &revision, &start, &end, &diff_options, FALSE, FALSE, tsh_blame_func3, dialog, ctx, subpool)))
+#endif
+ {
svn_pool_destroy (subpool);
error_str = tsh_strerror(err);
- gdk_threads_enter();
- tsh_blame_dialog_done (dialog);
+ gdk_threads_enter();
+ tsh_blame_dialog_done (dialog);
error = gtk_message_dialog_new(GTK_WINDOW(dialog), GTK_DIALOG_DESTROY_WITH_PARENT | GTK_DIALOG_MODAL, GTK_MESSAGE_ERROR, GTK_BUTTONS_OK, _("Blame failed"));
gtk_message_dialog_format_secondary_text(GTK_MESSAGE_DIALOG(error), "%s", error_str);
tsh_dialog_start(GTK_DIALOG(error), FALSE);
- gdk_threads_leave();
+ gdk_threads_leave();
g_free(error_str);
- svn_error_clear(err);
+ svn_error_clear(err);
tsh_reset_cancel();
- return GINT_TO_POINTER (FALSE);
- }
+ return GINT_TO_POINTER (FALSE);
+ }
svn_pool_destroy (subpool);
- gdk_threads_enter();
- tsh_blame_dialog_done (dialog);
- gdk_threads_leave();
-
+ gdk_threads_enter();
+ tsh_blame_dialog_done (dialog);
+ gdk_threads_leave();
+
tsh_reset_cancel();
- return GINT_TO_POINTER (TRUE);
+ return GINT_TO_POINTER (TRUE);
}
GThread *tsh_blame (gchar **files, svn_client_ctx_t *ctx, apr_pool_t *pool)
diff --git a/tvp-svn-helper/tsh-commit.c b/tvp-svn-helper/tsh-commit.c
index fc9a4bb..7c7ae0e 100644
--- a/tvp-svn-helper/tsh-commit.c
+++ b/tvp-svn-helper/tsh-commit.c
@@ -29,6 +29,7 @@
#include <libxfce4util/libxfce4util.h>
+#include <subversion-1/svn_version.h>
#include <subversion-1/svn_client.h>
#include <subversion-1/svn_pools.h>
@@ -52,7 +53,6 @@ static gpointer commit_thread (gpointer user_data)
struct thread_args *args = user_data;
gboolean result = TRUE;
svn_error_t *err;
- svn_commit_info_t *commit_info;
apr_array_header_t *paths;
svn_client_ctx_t *ctx = args->ctx;
apr_pool_t *subpool, *pool = args->pool;
@@ -66,8 +66,11 @@ static gpointer commit_thread (gpointer user_data)
gint size_indirect = 0;
gboolean recursive = TRUE;
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);
@@ -120,7 +123,11 @@ static gpointer commit_thread (gpointer user_data)
APR_ARRAY_PUSH (paths, const char *) = info->path;
}
+#if CHECK_SVN_VERSION_S(1,6)
if ((err = svn_client_delete3(NULL, paths, FALSE, FALSE, NULL, ctx, subpool)))
+#else /* CHECK_SVN_VERSION(1,7) */
+ if ((err = svn_client_delete4(paths, FALSE, FALSE, NULL, NULL, NULL, ctx, subpool)))
+#endif
{
svn_pool_destroy (subpool);
@@ -177,7 +184,11 @@ static gpointer commit_thread (gpointer user_data)
APR_ARRAY_PUSH (paths, const char *) = ""; // current directory
}
+#if CHECK_SVN_VERSION_S(1,6)
if ((err = svn_client_commit4(&commit_info, paths, recursive?svn_depth_infinity:svn_depth_empty, FALSE, FALSE, NULL, NULL, ctx, subpool)))
+#else /* CHECK_SVN_VERSION(1,7) */
+ if ((err = svn_client_commit5(paths, recursive?svn_depth_infinity:svn_depth_empty, FALSE, FALSE, FALSE, NULL, NULL, tsh_commit_func2, dialog, ctx, subpool)))
+#endif
{
svn_pool_destroy (subpool);
@@ -193,6 +204,7 @@ static gpointer commit_thread (gpointer user_data)
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);
@@ -202,13 +214,16 @@ static gpointer commit_thread (gpointer user_data)
{
message = _("Nothing to do");
}
+#endif
svn_pool_destroy (subpool);
}
gdk_threads_enter();
+#if CHECK_SVN_VERSION_S(1,6)
if (result)
tsh_notify_dialog_add(dialog, _("Completed"), message, NULL);
+#endif
tsh_notify_dialog_done (dialog);
gdk_threads_leave();
diff --git a/tvp-svn-helper/tsh-common.c b/tvp-svn-helper/tsh-common.c
index cfb7c0c..d7609a1 100644
--- a/tvp-svn-helper/tsh-common.c
+++ b/tvp-svn-helper/tsh-common.c
@@ -31,6 +31,7 @@
#include <apr_lib.h>
+#include <subversion-1/svn_version.h>
#include <subversion-1/svn_cmdline.h>
#include <subversion-1/svn_client.h>
#include <subversion-1/svn_pools.h>
@@ -574,12 +575,42 @@ tsh_action_to_string(svn_wc_notify_action_t action)
N_("Tree conflict"),
N_("External failed"),
#endif
+#if CHECK_SVN_VERSION_G(1,7)
+ N_("Started"),
+ N_("Skipped obstruction"),
+ N_("Skipped working only"),
+ N_("Skipped access denied"),
+ N_("External removed"),
+ N_("Shadowed add"),
+ N_("Shadowed update"),
+ N_("Shadowed delete"),
+ N_("Merge record info"),
+ N_("Upgraded path"),
+ N_("Merge record info begin"),
+ N_("Merge elide info"),
+ N_("Patch"),
+ N_("Applied hunk"),
+ N_("Rejected hunk"),
+ N_("Hunk already applied"),
+ N_("Copied"),
+ N_("Copied replaced"),
+ N_("URL redirect"),
+ N_("Path nonexistent"),
+ N_("Exclude"),
+ N_("Conflict"),
+ N_("Missing"),
+ N_("Out of date"),
+ N_("No parent"),
+ N_("Locked"),
+ N_("Forbidden by server"),
+ N_("Skipped conflicted"),
+#endif
};
const gchar *action_string = N_("Unknown");
- switch(action)
- {
+ switch(action)
+ {
case svn_wc_notify_add:
case svn_wc_notify_copy:
case svn_wc_notify_delete:
@@ -623,9 +654,39 @@ tsh_action_to_string(svn_wc_notify_action_t action)
case svn_wc_notify_tree_conflict:
case svn_wc_notify_failed_external:
#endif
+#if CHECK_SVN_VERSION_G(1,7)
+ case svn_wc_notify_update_started:
+ case svn_wc_notify_update_skip_obstruction:
+ case svn_wc_notify_update_skip_working_only:
+ case svn_wc_notify_update_skip_access_denied:
+ case svn_wc_notify_update_external_removed:
+ case svn_wc_notify_update_shadowed_add:
+ case svn_wc_notify_update_shadowed_update:
+ case svn_wc_notify_update_shadowed_delete:
+ case svn_wc_notify_merge_record_info:
+ case svn_wc_notify_upgraded_path:
+ case svn_wc_notify_merge_record_info_begin:
+ case svn_wc_notify_merge_elide_info:
+ case svn_wc_notify_patch:
+ case svn_wc_notify_patch_applied_hunk:
+ case svn_wc_notify_patch_rejected_hunk:
+ case svn_wc_notify_patch_hunk_already_applied:
+ case svn_wc_notify_commit_copied:
+ case svn_wc_notify_commit_copied_replaced:
+ case svn_wc_notify_url_redirect:
+ case svn_wc_notify_path_nonexistent:
+ case svn_wc_notify_exclude:
+ case svn_wc_notify_failed_conflict:
+ case svn_wc_notify_failed_missing:
+ case svn_wc_notify_failed_out_of_date:
+ case svn_wc_notify_failed_no_parent:
+ case svn_wc_notify_failed_locked:
+ case svn_wc_notify_failed_forbidden_by_server:
+ case svn_wc_notify_skip_conflicted:
+#endif
action_string = action_table[action];
break;
- }
+ }
return _(action_string);
}
@@ -640,13 +701,16 @@ tsh_notify_state_to_string(enum svn_wc_notify_state_t state)
N_("Obstructed"),
N_("Changed"),
N_("Merged"),
- N_("Conflicted")
+ N_("Conflicted"),
+#if CHECK_SVN_VERSION_G(1,7)
+ N_("Source missing"),
+#endif
};
const gchar *state_string = N_("Unknown");
- switch(state)
- {
+ switch(state)
+ {
case svn_wc_notify_state_inapplicable:
case svn_wc_notify_state_unknown:
case svn_wc_notify_state_unchanged:
@@ -655,9 +719,12 @@ tsh_notify_state_to_string(enum svn_wc_notify_state_t state)
case svn_wc_notify_state_changed:
case svn_wc_notify_state_merged:
case svn_wc_notify_state_conflicted:
+#if CHECK_SVN_VERSION_G(1,7)
+ case svn_wc_notify_state_source_missing:
+#endif
state_string = state_table[state];
break;
- }
+ }
return _(state_string);
}
@@ -787,6 +854,19 @@ tsh_status_func3(void *baton, const char *path, svn_wc_status2_t *status, apr_po
return SVN_NO_ERROR;
}
+svn_error_t *
+tsh_status_func(void *baton, const char *path, const svn_client_status_t *status, apr_pool_t *pool)
+{
+ TshStatusDialog *dialog = TSH_STATUS_DIALOG (baton);
+
+ gdk_threads_enter();
+ if (tsh_status_dialog_get_show_unversioned (dialog) || status->versioned)
+ tsh_status_dialog_add(dialog, path, tsh_status_to_string(status->text_status), tsh_status_to_string(status->prop_status), tsh_status_to_string(status->repos_text_status), tsh_status_to_string(status->repos_prop_status));
+ gdk_threads_leave();
+
+ return SVN_NO_ERROR;
+}
+
svn_error_t*
tsh_log_msg_func2(const char **log_msg, const char **tmp_file, const apr_array_header_t *commit_items, void *baton, apr_pool_t *pool)
{
@@ -942,6 +1022,38 @@ tsh_blame_func2 (void *baton, apr_int64_t line_no, svn_revnum_t revision, const
}
svn_error_t *
+tsh_blame_func3 (void *baton, svn_revnum_t start_revision, svn_revnum_t end_revision, apr_int64_t line_no, svn_revnum_t revision, apr_hash_t *revprops, svn_revnum_t merged_revision, apr_hash_t *merged_rev_props, const char *merged_path, const char *line, svn_boolean_t local_change, apr_pool_t *pool)
+{
+ apr_time_t date_val;
+ svn_string_t *value;
+ gchar *author = NULL;
+ gchar *date = NULL;
+ TshBlameDialog *dialog = TSH_BLAME_DIALOG (baton);
+
+ value = apr_hash_get(revprops, SVN_PROP_REVISION_AUTHOR, APR_HASH_KEY_STRING);
+ if(value)
+ author = g_strndup (value->data, value->len);
+
+ value = apr_hash_get(revprops, SVN_PROP_REVISION_DATE, APR_HASH_KEY_STRING);
+ if(value)
+ {
+ date = g_strndup (value->data, value->len);
+ svn_time_from_cstring(&date_val, date, pool);
+ g_free(date);
+ apr_ctime((date = g_new0(gchar, APR_CTIME_LEN)), date_val);
+ }
+
+ gdk_threads_enter();
+ tsh_blame_dialog_add(dialog, line_no, revision, author, date, line);
+ gdk_threads_leave();
+
+ g_free(author);
+ g_free(date);
+
+ return SVN_NO_ERROR;
+}
+
+svn_error_t *
tsh_proplist_func (void *baton, const char *path, apr_hash_t *prop_hash, apr_pool_t *pool)
{
TshPropertiesDialog *dialog = TSH_PROPERTIES_DIALOG (baton);
@@ -962,6 +1074,39 @@ tsh_proplist_func (void *baton, const char *path, apr_hash_t *prop_hash, apr_poo
return SVN_NO_ERROR;
}
+svn_error_t *
+tsh_commit_func2 (const svn_commit_info_t *commit_info, void *baton, apr_pool_t *pool)
+{
+ TshNotifyDialog *dialog = TSH_NOTIFY_DIALOG (baton);
+ gchar buffer[256];
+ gchar *message;
+
+ if(commit_info->post_commit_err)
+ {
+ gdk_threads_enter();
+ tsh_notify_dialog_add(dialog, _("Error"), commit_info->post_commit_err, NULL);
+ gdk_threads_leave();
+ }
+ else
+ {
+ if(SVN_IS_VALID_REVNUM(commit_info->revision))
+ {
+ g_snprintf(buffer, 256, _("At revision: %ld"), commit_info->revision);
+ message = buffer;
+ }
+ else
+ {
+ message = _("Local action");
+ }
+
+ gdk_threads_enter();
+ tsh_notify_dialog_add(dialog, _("Completed"), message, NULL);
+ gdk_threads_leave();
+ }
+
+ return SVN_NO_ERROR;
+}
+
gchar *
tsh_strerror(svn_error_t *err)
{
@@ -1018,34 +1163,45 @@ gchar *
tsh_is_working_copy (const gchar *uri, apr_pool_t *pool)
{
gchar *path;
- svn_error_t *err;
- int wc_format;
+ svn_error_t *err;
+ int wc_format;
+#if CHECK_SVN_VERSION_G(1,7)
+ svn_wc_context_t *wc_ctx;
+#endif
- /* strip the "file://" part of the uri */
- if (strncmp (uri, "file://", 7) == 0)
- {
- uri += 7;
- }
+ /* strip the "file://" part of the uri */
+ if (strncmp (uri, "file://", 7) == 0)
+ {
+ uri += 7;
+ }
- path = g_strdup (uri);
+ path = g_strdup (uri);
- /* remove trailing '/' cause svn_wc_check_wc can't handle that */
- if (path[strlen (path) - 1] == '/')
- {
- path[strlen (path) - 1] = '\0';
- }
+ /* remove trailing '/' cause svn_wc_check_wc can't handle that */
+ if (path[strlen (path) - 1] == '/')
+ {
+ path[strlen (path) - 1] = '\0';
+ }
- /* check for the path is a working copy */
- err = svn_wc_check_wc (path, &wc_format, pool);
+#if CHECK_SVN_VERSION_S(1,6)
+ /* check for the path is a working copy */
+ err = svn_wc_check_wc (path, &wc_format, pool);
+#else /* CHECK_SVN_VERSION(1,7) */
+ err = svn_wc_context_create (&wc_ctx, NULL, pool, pool);
+ if (!err)
+ {
+ err = svn_wc_check_wc2 (&wc_format, wc_ctx, path, pool);
+ }
+#endif
- /* if an error occured or wc_format in not set it is no working copy */
- if(err || !wc_format)
- {
+ /* if an error occured or wc_format in not set it is no working copy */
+ if(err || !wc_format)
+ {
g_free (path);
svn_error_clear (err);
- return NULL;
- }
-
- return path;
+ return NULL;
+ }
+
+ return path;
}
diff --git a/tvp-svn-helper/tsh-common.h b/tvp-svn-helper/tsh-common.h
index 00e7baf..b070c96 100644
--- a/tvp-svn-helper/tsh-common.h
+++ b/tvp-svn-helper/tsh-common.h
@@ -32,10 +32,13 @@ gboolean tsh_create_context (svn_client_ctx_t**, apr_pool_t*, svn_error_t**);
void tsh_notify_func2 (void *, const svn_wc_notify_t *, apr_pool_t *);
void tsh_status_func2 (void *, const char *, svn_wc_status2_t *);
svn_error_t *tsh_status_func3 (void *, const char *, svn_wc_status2_t *, apr_pool_t *);
+svn_error_t *tsh_status_func (void *, const char *, const svn_client_status_t *, apr_pool_t *);
svn_error_t *tsh_log_msg_func2 (const char **, const char **, const apr_array_header_t *, void *, apr_pool_t *);
svn_error_t *tsh_log_func (void *, svn_log_entry_t *, apr_pool_t *);
svn_error_t *tsh_blame_func2 (void *, apr_int64_t, svn_revnum_t, const char *, const char *, svn_revnum_t, const char *, const char *, const char *, const char *, apr_pool_t *);
+svn_error_t *tsh_blame_func3 (void *, svn_revnum_t, svn_revnum_t, apr_int64_t, svn_revnum_t, apr_hash_t *, svn_revnum_t, apr_hash_t *, const char *, const char *, svn_boolean_t, apr_pool_t *);
svn_error_t *tsh_proplist_func (void *, const char *, apr_hash_t *, apr_pool_t *);
+svn_error_t *tsh_commit_func2 (const svn_commit_info_t *, void *, apr_pool_t *);
gchar *tsh_strerror (svn_error_t *);
diff --git a/tvp-svn-helper/tsh-copy.c b/tvp-svn-helper/tsh-copy.c
index 3aadf25..a5dfb7c 100644
--- a/tvp-svn-helper/tsh-copy.c
+++ b/tvp-svn-helper/tsh-copy.c
@@ -30,6 +30,7 @@
#include <libxfce4util/libxfce4util.h>
+#include <subversion-1/svn_version.h>
#include <subversion-1/svn_client.h>
#include <subversion-1/svn_pools.h>
@@ -49,53 +50,58 @@ struct thread_args {
static gpointer copy_thread (gpointer user_data)
{
- struct thread_args *args = user_data;
- svn_error_t *err;
+ struct thread_args *args = user_data;
+ svn_error_t *err;
svn_opt_revision_t revision;
- svn_commit_info_t *commit_info;
apr_array_header_t *paths;
svn_client_copy_source_t copy_source;
- svn_client_ctx_t *ctx = args->ctx;
- apr_pool_t *subpool, *pool = args->pool;
+ 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 *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);
+ g_free (args);
subpool = svn_pool_create (pool);
- paths = apr_array_make (subpool, 1, sizeof (svn_client_copy_source_t *));
+ paths = apr_array_make (subpool, 1, sizeof (svn_client_copy_source_t *));
revision.kind = svn_opt_revision_unspecified;
- copy_source.path = from;
- copy_source.revision = &revision;
- copy_source.peg_revision = &revision;
- APR_ARRAY_PUSH (paths, svn_client_copy_source_t *) = ©_source;
+ copy_source.path = from;
+ copy_source.revision = &revision;
+ copy_source.peg_revision = &revision;
+ APR_ARRAY_PUSH (paths, svn_client_copy_source_t *) = ©_source;
#if CHECK_SVN_VERSION(1,5)
- if ((err = svn_client_copy4(&commit_info, paths, to, FALSE, FALSE, NULL, ctx, subpool)))
-#else /* CHECK_SVN_VERSION(1,6) */
- if ((err = svn_client_copy5(&commit_info, paths, to, FALSE, FALSE, FALSE, NULL, ctx, subpool)))
+ if ((err = svn_client_copy4(&commit_info, paths, to, FALSE, FALSE, NULL, ctx, subpool)))
+#elif CHECK_SVN_VERSION(1,6)
+ if ((err = svn_client_copy5(&commit_info, paths, to, FALSE, FALSE, FALSE, NULL, ctx, subpool)))
+#else /* CHECK_SVN_VERSION(1,7) */
+ if ((err = svn_client_copy6(paths, to, FALSE, FALSE, FALSE, NULL, tsh_commit_func2, dialog, ctx, subpool)))
#endif
- {
+ {
svn_pool_destroy (subpool);
error_str = tsh_strerror(err);
- gdk_threads_enter();
+ gdk_threads_enter();
tsh_notify_dialog_add(dialog, _("Failed"), error_str, NULL);
- tsh_notify_dialog_done (dialog);
- gdk_threads_leave();
+ tsh_notify_dialog_done (dialog);
+ gdk_threads_leave();
g_free(error_str);
- svn_error_clear(err);
+ svn_error_clear(err);
tsh_reset_cancel();
- return GINT_TO_POINTER (FALSE);
- }
+ 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);
@@ -105,16 +111,19 @@ static gpointer copy_thread (gpointer user_data)
{
message = _("Local copy");
}
+#endif
svn_pool_destroy (subpool);
- gdk_threads_enter();
+ gdk_threads_enter();
+#if CHECK_SVN_VERSION_S(1,6)
tsh_notify_dialog_add(dialog, _("Completed"), message, NULL);
- tsh_notify_dialog_done (dialog);
- gdk_threads_leave();
+#endif
+ tsh_notify_dialog_done (dialog);
+ gdk_threads_leave();
tsh_reset_cancel();
- return GINT_TO_POINTER (TRUE);
+ return GINT_TO_POINTER (TRUE);
}
GThread *tsh_copy (gchar **files, svn_client_ctx_t *ctx, apr_pool_t *pool)
diff --git a/tvp-svn-helper/tsh-delete.c b/tvp-svn-helper/tsh-delete.c
index b7c8863..c5f3b54 100644
--- a/tvp-svn-helper/tsh-delete.c
+++ b/tvp-svn-helper/tsh-delete.c
@@ -29,6 +29,7 @@
#include <libxfce4util/libxfce4util.h>
+#include <subversion-1/svn_version.h>
#include <subversion-1/svn_client.h>
#include <subversion-1/svn_pools.h>
@@ -49,20 +50,22 @@ struct thread_args {
static gpointer delete_thread (gpointer user_data)
{
- struct thread_args *args = user_data;
- svn_error_t *err;
- svn_commit_info_t *commit_info;
+ 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;
+ svn_client_ctx_t *ctx = args->ctx;
+ apr_pool_t *subpool, *pool = args->pool;
+ TshNotifyDialog *dialog = args->dialog;
gchar **files = args->files;
gint size, i;
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);
+ g_free (args);
size = files?g_strv_length(files):0;
@@ -84,22 +87,27 @@ static gpointer delete_thread (gpointer user_data)
APR_ARRAY_PUSH (paths, const char *) = ""; // current directory
}
- if ((err = svn_client_delete3(&commit_info, paths, FALSE, FALSE, NULL, ctx, subpool)))
- {
+#if CHECK_SVN_VERSION_S(1,6)
+ if ((err = svn_client_delete3(&commit_info, paths, FALSE, FALSE, NULL, ctx, subpool)))
+#else /* CHECK_SVN_VERSION(1,7) */
+ if ((err = svn_client_delete4(paths, FALSE, FALSE, NULL, tsh_commit_func2, dialog, ctx, subpool)))
+#endif
+ {
svn_pool_destroy (subpool);
error_str = tsh_strerror(err);
- gdk_threads_enter();
+ gdk_threads_enter();
tsh_notify_dialog_add(dialog, _("Failed"), error_str, NULL);
- tsh_notify_dialog_done (dialog);
- gdk_threads_leave();
+ tsh_notify_dialog_done (dialog);
+ gdk_threads_leave();
g_free(error_str);
- svn_error_clear(err);
+ svn_error_clear(err);
tsh_reset_cancel();
- return GINT_TO_POINTER (FALSE);
- }
+ return GINT_TO_POINTER (FALSE);
+ }
+#if CHECK_SVN_VERSION_S(1,6)
if(commit_info && SVN_IS_VALID_REVNUM(commit_info->revision))
{
g_snprintf(buffer, 256, _("At revision: %ld"), commit_info->revision);
@@ -109,16 +117,19 @@ static gpointer delete_thread (gpointer user_data)
{
message = _("Local delete");
}
+#endif
svn_pool_destroy (subpool);
- gdk_threads_enter();
+ gdk_threads_enter();
+#if CHECK_SVN_VERSION_S(1,6)
tsh_notify_dialog_add(dialog, _("Completed"), message, NULL);
- tsh_notify_dialog_done (dialog);
- gdk_threads_leave();
-
+#endif
+ tsh_notify_dialog_done (dialog);
+ gdk_threads_leave();
+
tsh_reset_cancel();
- return GINT_TO_POINTER (TRUE);
+ return GINT_TO_POINTER (TRUE);
}
GThread *tsh_delete (gchar **files, svn_client_ctx_t *ctx, apr_pool_t *pool)
diff --git a/tvp-svn-helper/tsh-export.c b/tvp-svn-helper/tsh-export.c
index 098e9be..24a0c03 100644
--- a/tvp-svn-helper/tsh-export.c
+++ b/tvp-svn-helper/tsh-export.c
@@ -29,6 +29,7 @@
#include <libxfce4util/libxfce4util.h>
+#include <subversion-1/svn_version.h>
#include <subversion-1/svn_client.h>
#include <subversion-1/svn_pools.h>
@@ -49,46 +50,50 @@ struct thread_args {
static gpointer export_thread (gpointer user_data)
{
- struct thread_args *args = user_data;
+ struct thread_args *args = user_data;
svn_opt_revision_t peg_revision, revision;
- svn_error_t *err;
- svn_client_ctx_t *ctx = args->ctx;
- apr_pool_t *subpool, *pool = args->pool;
- TshNotifyDialog *dialog = args->dialog;
- gchar *path = args->path;
- gchar *url = args->url;
+ svn_error_t *err;
+ svn_client_ctx_t *ctx = args->ctx;
+ apr_pool_t *subpool, *pool = args->pool;
+ TshNotifyDialog *dialog = args->dialog;
+ gchar *path = args->path;
+ gchar *url = args->url;
gchar *error_str;
- g_free (args);
+ g_free (args);
subpool = svn_pool_create (pool);
peg_revision.kind = svn_opt_revision_unspecified;
revision.kind = svn_opt_revision_head;
- if ((err = svn_client_export4(NULL, url, path, &peg_revision, &revision, TRUE, FALSE, svn_depth_infinity, NULL, ctx, subpool)))
- {
+#if CHECK_SVN_VERSION_S(1,6)
+ if ((err = svn_client_export4(NULL, url, path, &peg_revision, &revision, TRUE, FALSE, svn_depth_infinity, NULL, ctx, subpool)))
+#else /* CHECK_SVN_VERSION(1,7) */
+ if ((err = svn_client_export5(NULL, url, path, &peg_revision, &revision, TRUE, FALSE, FALSE, svn_depth_infinity, NULL, ctx, subpool)))
+#endif
+ {
svn_pool_destroy (subpool);
error_str = tsh_strerror(err);
- gdk_threads_enter();
+ gdk_threads_enter();
tsh_notify_dialog_add(dialog, _("Failed"), error_str, NULL);
- tsh_notify_dialog_done (dialog);
- gdk_threads_leave();
+ tsh_notify_dialog_done (dialog);
+ gdk_threads_leave();
g_free(error_str);
- svn_error_clear(err);
+ svn_error_clear(err);
tsh_reset_cancel();
- return GINT_TO_POINTER (FALSE);
- }
+ return GINT_TO_POINTER (FALSE);
+ }
svn_pool_destroy (subpool);
- gdk_threads_enter();
- tsh_notify_dialog_done (dialog);
- gdk_threads_leave();
-
+ gdk_threads_enter();
+ tsh_notify_dialog_done (dialog);
+ gdk_threads_leave();
+
tsh_reset_cancel();
- return GINT_TO_POINTER (TRUE);
+ return GINT_TO_POINTER (TRUE);
}
GThread *tsh_export (gchar **files, svn_client_ctx_t *ctx, apr_pool_t *pool)
diff --git a/tvp-svn-helper/tsh-file-selection-dialog.c b/tvp-svn-helper/tsh-file-selection-dialog.c
index 4391b96..1197ec7 100644
--- a/tvp-svn-helper/tsh-file-selection-dialog.c
+++ b/tvp-svn-helper/tsh-file-selection-dialog.c
@@ -23,6 +23,7 @@
#include <libxfce4util/libxfce4util.h>
#include <gtk/gtk.h>
+#include <subversion-1/svn_version.h>
#include <subversion-1/svn_client.h>
#include <subversion-1/svn_pools.h>
@@ -30,8 +31,13 @@
#include "tsh-tree-common.h"
#include "tsh-file-selection-dialog.h"
+#if CHECK_SVN_VERSION(1,5)
static void tsh_file_selection_status_func2 (void *, const char *, svn_wc_status2_t *);
+#elif CHECK_SVN_VERSION(1,6)
static svn_error_t *tsh_file_selection_status_func3 (void *, const char *, svn_wc_status2_t *, apr_pool_t *);
+#else /* CHECK_SVN_VERSION(1,7) */
+static svn_error_t *tsh_file_selection_status_func (void *, const char *, const svn_client_status_t *, apr_pool_t *);
+#endif
static void selection_cell_toggled (GtkCellRendererToggle *, gchar *, gpointer);
static void selection_all_toggled (GtkToggleButton *, gpointer);
@@ -158,25 +164,25 @@ GtkWidget*
tsh_file_selection_dialog_new (const gchar *title, GtkWindow *parent, GtkDialogFlags flags, gchar **files, TshFileSelectionFlags selection_flags, svn_client_ctx_t *ctx, apr_pool_t *pool)
{
svn_opt_revision_t revision;
- svn_error_t *err;
+ svn_error_t *err;
apr_pool_t *subpool;
- TshFileSelectionDialog *dialog = g_object_new (TSH_TYPE_FILE_SELECTION_DIALOG, NULL);
+ TshFileSelectionDialog *dialog = g_object_new (TSH_TYPE_FILE_SELECTION_DIALOG, NULL);
- if(title)
- gtk_window_set_title (GTK_WINDOW(dialog), title);
+ if(title)
+ gtk_window_set_title (GTK_WINDOW(dialog), title);
- if(parent)
- gtk_window_set_transient_for (GTK_WINDOW(dialog), parent);
+ if(parent)
+ gtk_window_set_transient_for (GTK_WINDOW(dialog), parent);
- if(flags & GTK_DIALOG_MODAL)
- gtk_window_set_modal (GTK_WINDOW(dialog), TRUE);
+ if(flags & GTK_DIALOG_MODAL)
+ gtk_window_set_modal (GTK_WINDOW(dialog), TRUE);
- if(flags & GTK_DIALOG_DESTROY_WITH_PARENT)
- gtk_window_set_destroy_with_parent (GTK_WINDOW(dialog), TRUE);
+ if(flags & GTK_DIALOG_DESTROY_WITH_PARENT)
+ gtk_window_set_destroy_with_parent (GTK_WINDOW(dialog), TRUE);
- if(flags & GTK_DIALOG_NO_SEPARATOR)
- gtk_dialog_set_has_separator (GTK_DIALOG(dialog), FALSE);
+ if(flags & GTK_DIALOG_NO_SEPARATOR)
+ gtk_dialog_set_has_separator (GTK_DIALOG(dialog), FALSE);
dialog->flags = selection_flags;
@@ -189,16 +195,18 @@ tsh_file_selection_dialog_new (const gchar *title, GtkWindow *parent, GtkDialogF
{
#if CHECK_SVN_VERSION(1,5)
if((err = svn_client_status3(NULL, *files, &revision, tsh_file_selection_status_func2, dialog, (selection_flags&TSH_FILE_SELECTION_FLAG_RECURSIVE)?svn_depth_infinity:svn_depth_immediates, selection_flags&TSH_FILE_SELECTION_FLAG_UNCHANGED, FALSE, selection_flags&TSH_FILE_SELECTION_FLAG_IGNORED, TRUE, NULL, ctx, subpool)))
-#else /* CHECK_SVN_VERSION(1,6) */
+#elif CHECK_SVN_VERSION(1,6)
if((err = svn_client_status4(NULL, *files, &revision, tsh_file_selection_status_func3, dialog, (selection_flags&TSH_FILE_SELECTION_FLAG_RECURSIVE)?svn_depth_infinity:svn_depth_immediates, selection_flags&TSH_FILE_SELECTION_FLAG_UNCHANGED, FALSE, selection_flags&TSH_FILE_SELECTION_FLAG_IGNORED, TRUE, NULL, ctx, subpool)))
+#else /* CHECK_SVN_VERSION(1,7) */
+ if((err = svn_client_status5(NULL, ctx, *files, &revision, (selection_flags&TSH_FILE_SELECTION_FLAG_RECURSIVE)?svn_depth_infinity:svn_depth_immediates, selection_flags&TSH_FILE_SELECTION_FLAG_UNCHANGED, FALSE, selection_flags&TSH_FILE_SELECTION_FLAG_IGNORED, TRUE, TRUE, NULL, tsh_file_selection_status_func, dialog, subpool)))
#endif
{
- svn_pool_destroy (subpool);
+ svn_pool_destroy (subpool);
- gtk_widget_unref(GTK_WIDGET(dialog));
+ gtk_widget_unref(GTK_WIDGET(dialog));
- svn_error_clear(err);
- return NULL; //FIXME: needed ??
+ svn_error_clear(err);
+ return NULL; //FIXME: needed ??
}
files++;
}
@@ -207,8 +215,10 @@ tsh_file_selection_dialog_new (const gchar *title, GtkWindow *parent, GtkDialogF
{
#if CHECK_SVN_VERSION(1,5)
if((err = svn_client_status3(NULL, "", &revision, tsh_file_selection_status_func2, dialog, (selection_flags&TSH_FILE_SELECTION_FLAG_RECURSIVE)?svn_depth_infinity:svn_depth_immediates, selection_flags&TSH_FILE_SELECTION_FLAG_UNCHANGED, FALSE, selection_flags&TSH_FILE_SELECTION_FLAG_IGNORED, TRUE, NULL, ctx, subpool)))
-#else /* CHECK_SVN_VERSION(1,6) */
+#elif CHECK_SVN_VERSION(1,6)
if((err = svn_client_status4(NULL, "", &revision, tsh_file_selection_status_func3, dialog, (selection_flags&TSH_FILE_SELECTION_FLAG_RECURSIVE)?svn_depth_infinity:svn_depth_immediates, selection_flags&TSH_FILE_SELECTION_FLAG_UNCHANGED, FALSE, selection_flags&TSH_FILE_SELECTION_FLAG_IGNORED, TRUE, NULL, ctx, subpool)))
+#else /* CHECK_SVN_VERSION(1,7) */
+ if((err = svn_client_status5(NULL, ctx, "", &revision, (selection_flags&TSH_FILE_SELECTION_FLAG_RECURSIVE)?svn_depth_infinity:svn_depth_immediates, selection_flags&TSH_FILE_SELECTION_FLAG_UNCHANGED, FALSE, selection_flags&TSH_FILE_SELECTION_FLAG_IGNORED, TRUE, TRUE, NULL, tsh_file_selection_status_func, dialog, subpool)))
#endif
{
svn_pool_destroy (subpool);
@@ -313,13 +323,25 @@ get_parent_status(GtkTreeModel *model, GtkTreeIter *iter)
return status;
}
+#if CHECK_SVN_VERSION(1,5)
static void
tsh_file_selection_status_func2(void *baton, const char *path, svn_wc_status2_t *status)
+#elif CHECK_SVN_VERSION(1,6)
+static svn_error_t*
+tsh_file_selection_status_func3(void *baton, const char *path, svn_wc_status2_t *status, apr_pool_t *pool)
+#else /* CHECK_SVN_VERSION(1,7) */
+static svn_error_t*
+tsh_file_selection_status_func (void *baton, const char *path, const svn_client_status_t *status, apr_pool_t *pool)
+#endif
{
TshFileSelectionDialog *dialog = TSH_FILE_SELECTION_DIALOG (baton);
gboolean add = FALSE;
+#if CHECK_SVN_VERSION_S(1,6)
if (status->entry)
+#else /* CHECK_SVN_VERSION(1,7) */
+ if (status->versioned)
+#endif
{
if (dialog->flags & TSH_FILE_SELECTION_FLAG_CONFLICTED)
if (status->text_status == svn_wc_status_conflicted || status->prop_status == svn_wc_status_conflicted)
@@ -345,7 +367,11 @@ tsh_file_selection_status_func2(void *baton, const char *path, svn_wc_status2_t
gint file_status = TSH_FILE_STATUS_OTHER;
TshFileStatus parent_status;
+#if CHECK_SVN_VERSION_S(1,6)
if (G_LIKELY (status->entry))
+#else /* CHECK_SVN_VERSION(1,7) */
+ if (G_LIKELY (status->versioned))
+#endif
{
if (status->text_status == svn_wc_status_added)
{
@@ -383,7 +409,11 @@ tsh_file_selection_status_func2(void *baton, const char *path, svn_wc_status2_t
if (parent_status == TSH_FILE_STATUS_UNCHANGED)
enable = FALSE;
}
+#if CHECK_SVN_VERSION_S(1,6)
else if (status->entry && status->text_status != svn_wc_status_missing)
+#else /* CHECK_SVN_VERSION(1,7) */
+ else if (status->versioned && status->text_status != svn_wc_status_missing)
+#endif
{
if (parent_status != TSH_FILE_STATUS_INVALID)
enable = FALSE;
@@ -425,13 +455,10 @@ tsh_file_selection_status_func2(void *baton, const char *path, svn_wc_status2_t
break;
}
}
-}
-static svn_error_t*
-tsh_file_selection_status_func3(void *baton, const char *path, svn_wc_status2_t *status, apr_pool_t *pool)
-{
- tsh_file_selection_status_func2(baton, path, status);
- return SVN_NO_ERROR;
+#if CHECK_SVN_VERSION_G(1,6)
+ return SVN_NO_ERROR;
+#endif
}
static void
diff --git a/tvp-svn-helper/tsh-import.c b/tvp-svn-helper/tsh-import.c
index b9d9784..1d1e38e 100644
--- a/tvp-svn-helper/tsh-import.c
+++ b/tvp-svn-helper/tsh-import.c
@@ -29,6 +29,7 @@
#include <libxfce4util/libxfce4util.h>
+#include <subversion-1/svn_version.h>
#include <subversion-1/svn_client.h>
#include <subversion-1/svn_pools.h>
@@ -50,48 +51,58 @@ struct thread_args {
static gpointer import_thread (gpointer user_data)
{
- struct thread_args *args = user_data;
- svn_error_t *err;
- svn_commit_info_t *commit_info;
- svn_client_ctx_t *ctx = args->ctx;
- apr_pool_t *subpool, *pool = args->pool;
- TshNotifyDialog *dialog = args->dialog;
- gchar *path = args->path;
- gchar *url = args->url;
+ struct thread_args *args = user_data;
+ svn_error_t *err;
+ svn_client_ctx_t *ctx = args->ctx;
+ apr_pool_t *subpool, *pool = args->pool;
+ TshNotifyDialog *dialog = args->dialog;
+ gchar *path = args->path;
+ gchar *url = args->url;
gchar *error_str;
+#if CHECK_SVN_VERSION_S(1,6)
+ svn_commit_info_t *commit_info;
gchar buffer[256];
+#endif
- g_free (args);
+ g_free (args);
subpool = svn_pool_create (pool);
- if ((err = svn_client_import3(&commit_info, path, url, svn_depth_infinity, FALSE, FALSE, NULL, ctx, subpool)))
- {
+#if CHECK_SVN_VERSION_S(1,6)
+ if ((err = svn_client_import3(&commit_info, path, url, svn_depth_infinity, FALSE, FALSE, NULL, ctx, subpool)))
+#else /* CHECK_SVN_VERSION(1,7) */
+ if ((err = svn_client_import4(path, url, svn_depth_infinity, FALSE, FALSE, NULL, tsh_commit_func2, dialog, ctx, subpool)))
+#endif
+ {
svn_pool_destroy (subpool);
error_str = tsh_strerror(err);
- gdk_threads_enter();
+ gdk_threads_enter();
tsh_notify_dialog_add(dialog, _("Failed"), error_str, NULL);
- tsh_notify_dialog_done (dialog);
- gdk_threads_leave();
+ tsh_notify_dialog_done (dialog);
+ gdk_threads_leave();
g_free(error_str);
- svn_error_clear(err);
+ svn_error_clear(err);
tsh_reset_cancel();
- return GINT_TO_POINTER (FALSE);
- }
+ return GINT_TO_POINTER (FALSE);
+ }
+#if CHECK_SVN_VERSION_S(1,6)
g_snprintf(buffer, 256, _("At revision: %ld"), commit_info->revision);
+#endif
svn_pool_destroy (subpool);
- gdk_threads_enter();
+ gdk_threads_enter();
+#if CHECK_SVN_VERSION_S(1,6)
tsh_notify_dialog_add(dialog, _("Completed"), buffer, NULL);
- tsh_notify_dialog_done (dialog);
- gdk_threads_leave();
-
+#endif
+ tsh_notify_dialog_done (dialog);
+ gdk_threads_leave();
+
tsh_reset_cancel();
- return GINT_TO_POINTER (TRUE);
+ return GINT_TO_POINTER (TRUE);
}
GThread *tsh_import (gchar **files, svn_client_ctx_t *ctx, apr_pool_t *pool)
diff --git a/tvp-svn-helper/tsh-log.c b/tvp-svn-helper/tsh-log.c
index 4ae9e42..79c32df 100644
--- a/tvp-svn-helper/tsh-log.c
+++ b/tvp-svn-helper/tsh-log.c
@@ -29,6 +29,7 @@
#include <libxfce4util/libxfce4util.h>
+#include <subversion-1/svn_version.h>
#include <subversion-1/svn_client.h>
#include <subversion-1/svn_pools.h>
#include <subversion-1/svn_props.h>
diff --git a/tvp-svn-helper/tsh-move.c b/tvp-svn-helper/tsh-move.c
index 4ad6cf0..a079244 100644
--- a/tvp-svn-helper/tsh-move.c
+++ b/tvp-svn-helper/tsh-move.c
@@ -30,6 +30,7 @@
#include <libxfce4util/libxfce4util.h>
+#include <subversion-1/svn_version.h>
#include <subversion-1/svn_client.h>
#include <subversion-1/svn_pools.h>
@@ -49,43 +50,50 @@ struct thread_args {
static gpointer move_thread (gpointer user_data)
{
- struct thread_args *args = user_data;
- svn_error_t *err;
- svn_commit_info_t *commit_info;
+ 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;
+ 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 *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);
+ g_free (args);
subpool = svn_pool_create (pool);
- paths = apr_array_make (subpool, 1, sizeof (const char *));
+ paths = apr_array_make (subpool, 1, sizeof (const char *));
- APR_ARRAY_PUSH (paths, const char *) = from;
+ APR_ARRAY_PUSH (paths, const char *) = from;
- if ((err = svn_client_move5(&commit_info, paths, to, FALSE, FALSE, FALSE, NULL, ctx, subpool)))
- {
+#if CHECK_SVN_VERSION_S(1,6)
+ if ((err = svn_client_move5(&commit_info, paths, to, FALSE, FALSE, FALSE, NULL, ctx, subpool)))
+#else /* CHECK_SVN_VERSION(1,7) */
+ if ((err = svn_client_move6(paths, to, FALSE, FALSE, NULL, tsh_commit_func2, dialog, ctx, subpool)))
+#endif
+ {
svn_pool_destroy (subpool);
error_str = tsh_strerror(err);
- gdk_threads_enter();
+ gdk_threads_enter();
tsh_notify_dialog_add(dialog, _("Failed"), error_str, NULL);
- tsh_notify_dialog_done (dialog);
- gdk_threads_leave();
+ tsh_notify_dialog_done (dialog);
+ gdk_threads_leave();
g_free(error_str);
- svn_error_clear(err);
+ svn_error_clear(err);
tsh_reset_cancel();
- return GINT_TO_POINTER (FALSE);
- }
+ 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);
@@ -95,16 +103,19 @@ static gpointer move_thread (gpointer user_data)
{
message = _("Local move");
}
+#endif
svn_pool_destroy (subpool);
- gdk_threads_enter();
+ 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();
tsh_reset_cancel();
- return GINT_TO_POINTER (TRUE);
+ return GINT_TO_POINTER (TRUE);
}
GThread *tsh_move (gchar **files, svn_client_ctx_t *ctx, apr_pool_t *pool)
diff --git a/tvp-svn-helper/tsh-properties.c b/tvp-svn-helper/tsh-properties.c
index c213ef0..0f63cd0 100644
--- a/tvp-svn-helper/tsh-properties.c
+++ b/tvp-svn-helper/tsh-properties.c
@@ -29,6 +29,7 @@
#include <libxfce4util/libxfce4util.h>
+#include <subversion-1/svn_version.h>
#include <subversion-1/svn_client.h>
#include <subversion-1/svn_pools.h>
@@ -50,19 +51,22 @@ struct thread_args {
static gpointer properties_thread (gpointer user_data)
{
- struct thread_args *args = user_data;
+ struct thread_args *args = user_data;
svn_opt_revision_t revision;
- svn_error_t *err;
- svn_client_ctx_t *ctx = args->ctx;
- apr_pool_t *subpool, *pool = args->pool;
+ svn_error_t *err;
+ svn_client_ctx_t *ctx = args->ctx;
+ apr_pool_t *subpool, *pool = args->pool;
TshPropertiesDialog *dialog = args->dialog;
- gchar *path = args->path;
+ gchar *path = args->path;
gchar *set_key = args->set_key;
gchar *set_value = args->set_value;
gboolean depth = args->depth;
svn_string_t *value;
GtkWidget *error;
gchar *error_str;
+#if CHECK_SVN_VERSION_G(1,7)
+ apr_array_header_t *paths;
+#endif
args->set_key = NULL;
args->set_value = NULL;
@@ -73,7 +77,14 @@ static gpointer properties_thread (gpointer user_data)
{
value = set_value?svn_string_create(set_value, subpool):NULL;
+#if CHECK_SVN_VERSION_S(1,6)
if ((err = svn_client_propset3(NULL, set_key, value, path, depth, FALSE, SVN_INVALID_REVNUM, NULL, NULL, ctx, subpool)))
+#else /* CHECK_SVN_VERSION(1,7) */
+ paths = apr_array_make (subpool, 1, sizeof (const char *));
+ APR_ARRAY_PUSH (paths, const char *) = path;
+
+ if ((err = svn_client_propset_local(set_key, value, paths, depth, FALSE, NULL, ctx, subpool)))
+#endif
{
//svn_pool_destroy (subpool);
error_str = tsh_strerror(err);
@@ -95,24 +106,24 @@ static gpointer properties_thread (gpointer user_data)
g_free (set_value);
revision.kind = svn_opt_revision_unspecified;
- if ((err = svn_client_proplist3(path, &revision, &revision, svn_depth_empty, NULL, tsh_proplist_func, dialog, ctx, subpool)))
- {
+ if ((err = svn_client_proplist3(path, &revision, &revision, svn_depth_empty, NULL, tsh_proplist_func, dialog, ctx, subpool)))
+ {
svn_pool_destroy (subpool);
error_str = tsh_strerror(err);
- gdk_threads_enter();
+ gdk_threads_enter();
tsh_properties_dialog_done (dialog);
error = gtk_message_dialog_new(GTK_WINDOW(dialog), GTK_DIALOG_DESTROY_WITH_PARENT | GTK_DIALOG_MODAL, GTK_MESSAGE_ERROR, GTK_BUTTONS_OK, _("Properties failed"));
gtk_message_dialog_format_secondary_text(GTK_MESSAGE_DIALOG(error), "%s", error_str);
tsh_dialog_start(GTK_DIALOG(error), FALSE);
- gdk_threads_leave();
+ gdk_threads_leave();
g_free(error_str);
- svn_error_clear(err);
+ svn_error_clear(err);
tsh_reset_cancel();
- return GINT_TO_POINTER (FALSE);
- }
+ return GINT_TO_POINTER (FALSE);
+ }
svn_pool_destroy (subpool);
@@ -121,7 +132,7 @@ static gpointer properties_thread (gpointer user_data)
gdk_threads_leave();
tsh_reset_cancel();
- return GINT_TO_POINTER (TRUE);
+ return GINT_TO_POINTER (TRUE);
}
static void create_properties_thread (TshPropertiesDialog *dialog, struct thread_args *args)
diff --git a/tvp-svn-helper/tsh-relocate.c b/tvp-svn-helper/tsh-relocate.c
index c0d7a0c..dda868e 100644
--- a/tvp-svn-helper/tsh-relocate.c
+++ b/tvp-svn-helper/tsh-relocate.c
@@ -29,6 +29,7 @@
#include <libxfce4util/libxfce4util.h>
+#include <subversion-1/svn_version.h>
#include <subversion-1/svn_client.h>
#include <subversion-1/svn_pools.h>
@@ -49,73 +50,81 @@ struct thread_args {
static gpointer relocate_thread (gpointer user_data)
{
- struct thread_args *args = user_data;
- svn_error_t *err;
- svn_client_ctx_t *ctx = args->ctx;
- apr_pool_t *subpool, *pool = args->pool;
+ struct thread_args *args = user_data;
+ svn_error_t *err;
+ svn_client_ctx_t *ctx = args->ctx;
+ apr_pool_t *subpool, *pool = args->pool;
GtkWidget *dialog = args->dialog;
- gchar *path = args->path;
- gchar *from = args->from;
- gchar *to = args->to;
+ gchar *path = args->path;
+ gchar *from = args->from;
+ gchar *to = args->to;
gchar *error_str;
- g_free (args);
+ g_free (args);
subpool = svn_pool_create (pool);
- if ((err = svn_client_relocate(path, from, to, TRUE, ctx, subpool)))
- {
- svn_pool_destroy (subpool);
-
- error_str = tsh_strerror(err);
- gdk_threads_enter();
- gtk_widget_destroy(dialog);
- dialog = gtk_message_dialog_new(NULL, 0, GTK_MESSAGE_ERROR, GTK_BUTTONS_CLOSE, _("Relocate failed"));
- gtk_message_dialog_format_secondary_text(GTK_MESSAGE_DIALOG(dialog), "%s", error_str);
- tsh_dialog_start(GTK_DIALOG(dialog), TRUE);
- gdk_threads_leave();
- g_free(error_str);
-
- svn_error_clear(err);
- tsh_reset_cancel();
- return GINT_TO_POINTER (FALSE);
- }
+#if CHECK_SVN_VERSION_S(1,6)
+ if ((err = svn_client_relocate(path, from, to, TRUE, ctx, subpool)))
+#else /* CHECK_SVN_VERSION(1,7) */
+ if ((err = svn_client_relocate2(path, from, to, TRUE, ctx, subpool)))
+#endif
+ {
+ svn_pool_destroy (subpool);
+
+ error_str = tsh_strerror(err);
+ gdk_threads_enter();
+ gtk_widget_destroy(dialog);
+ dialog = gtk_message_dialog_new(NULL, 0, GTK_MESSAGE_ERROR, GTK_BUTTONS_CLOSE, _("Relocate failed"));
+ gtk_message_dialog_format_secondary_text(GTK_MESSAGE_DIALOG(dialog), "%s", error_str);
+ tsh_dialog_start(GTK_DIALOG(dialog), TRUE);
+ gdk_threads_leave();
+ g_free(error_str);
+
+ svn_error_clear(err);
+ tsh_reset_cancel();
+ return GINT_TO_POINTER (FALSE);
+ }
svn_pool_destroy (subpool);
- gdk_threads_enter();
+ gdk_threads_enter();
gtk_widget_destroy(dialog);
dialog = gtk_message_dialog_new(NULL, 0, GTK_MESSAGE_OTHER, GTK_BUTTONS_CLOSE, _("Relocate finished"));
tsh_dialog_start(GTK_DIALOG(dialog), TRUE);
- gdk_threads_leave();
+ gdk_threads_leave();
tsh_reset_cancel();
- return GINT_TO_POINTER (TRUE);
+ return GINT_TO_POINTER (TRUE);
}
GThread *tsh_relocate (gchar **files, svn_client_ctx_t *ctx, apr_pool_t *pool)
{
- struct thread_args *args;
+ struct thread_args *args;
const char *url = NULL;
gchar *repository = NULL;
gchar *from;
gchar *to;
GtkWidget *dialog;
gchar *path;
- apr_pool_t *subpool;
+ apr_pool_t *subpool;
path = files?files[0]:NULL;
subpool = svn_pool_create(pool);
+#if CHECK_SVN_VERSION_S(1,6)
svn_error_clear(svn_client_url_from_path(&url, path?path:"", subpool));
+#else /* CHECK_SVN_VERSION(1,7) */
+ svn_error_clear(svn_client_url_from_path2(&url, path?path:"", ctx, subpool, subpool));
+#endif
repository = g_strdup(url);
svn_pool_destroy(subpool);
- dialog = tsh_relocate_dialog_new (_("Relocate"), NULL, 0, repository, repository, path);
+ dialog = tsh_relocate_dialog_new (_("Relocate"), NULL, 0, repository, repository, path);
g_free(repository);
- if(gtk_dialog_run (GTK_DIALOG (dialog)) != GTK_RESPONSE_OK)
+ if(gtk_dialog_run (GTK_DIALOG (dialog)) != GTK_RESPONSE_OK)
{
gtk_widget_destroy (dialog);
return NULL;
@@ -125,20 +134,20 @@ GThread *tsh_relocate (gchar **files, svn_client_ctx_t *ctx, apr_pool_t *pool)
to = tsh_relocate_dialog_get_to(TSH_RELOCATE_DIALOG(dialog));
path = tsh_relocate_dialog_get_directory(TSH_RELOCATE_DIALOG(dialog));
- gtk_widget_destroy (dialog);
+ gtk_widget_destroy (dialog);
dialog = gtk_message_dialog_new(NULL, 0, GTK_MESSAGE_OTHER, GTK_BUTTONS_CANCEL, _("Relocating ..."));
- g_signal_connect (G_OBJECT (dialog), "response", G_CALLBACK (tsh_cancel), NULL);
+ g_signal_connect (G_OBJECT (dialog), "response", G_CALLBACK (tsh_cancel), NULL);
tsh_dialog_start(GTK_DIALOG(dialog), TRUE);
- args = g_malloc (sizeof (struct thread_args));
- args->ctx = ctx;
- args->pool = pool;
+ args = g_malloc (sizeof (struct thread_args));
+ args->ctx = ctx;
+ args->pool = pool;
args->dialog = dialog;
- args->path = path;
- args->from = from;
- args->to = to;
+ args->path = path;
+ args->from = from;
+ args->to = to;
- return g_thread_create (relocate_thread, args, TRUE, NULL);
+ return g_thread_create (relocate_thread, args, TRUE, NULL);
}
diff --git a/tvp-svn-helper/tsh-status.c b/tvp-svn-helper/tsh-status.c
index a160395..40206ad 100644
--- a/tvp-svn-helper/tsh-status.c
+++ b/tvp-svn-helper/tsh-status.c
@@ -29,6 +29,7 @@
#include <libxfce4util/libxfce4util.h>
+#include <subversion-1/svn_version.h>
#include <subversion-1/svn_client.h>
#include <subversion-1/svn_pools.h>
@@ -47,13 +48,13 @@ struct thread_args {
static gpointer status_thread (gpointer user_data)
{
- struct thread_args *args = user_data;
+ struct thread_args *args = user_data;
svn_opt_revision_t revision;
- svn_error_t *err;
- svn_client_ctx_t *ctx = args->ctx;
- apr_pool_t *subpool, *pool = args->pool;
- TshStatusDialog *dialog = args->dialog;
- gchar **files = args->files;
+ svn_error_t *err;
+ svn_client_ctx_t *ctx = args->ctx;
+ apr_pool_t *subpool, *pool = args->pool;
+ TshStatusDialog *dialog = args->dialog;
+ gchar **files = args->files;
svn_depth_t depth;
gboolean get_all;
gboolean update;
@@ -74,36 +75,38 @@ static gpointer status_thread (gpointer user_data)
revision.kind = svn_opt_revision_head;
#if CHECK_SVN_VERSION(1,5)
- if ((err = svn_client_status3(NULL, files?files[0]:"", &revision, tsh_status_func2, dialog, depth, get_all, update, no_ignore, ignore_externals, NULL, ctx, subpool)))
-#else /* CHECK_SVN_VERSION(1,6) */
- if ((err = svn_client_status4(NULL, files?files[0]:"", &revision, tsh_status_func3, dialog, depth, get_all, update, no_ignore, ignore_externals, NULL, ctx, subpool)))
+ if ((err = svn_client_status3(NULL, files?files[0]:"", &revision, tsh_status_func2, dialog, depth, get_all, update, no_ignore, ignore_externals, NULL, ctx, subpool)))
+#elif CHECK_SVN_VERSION(1,6)
+ if ((err = svn_client_status4(NULL, files?files[0]:"", &revision, tsh_status_func3, dialog, depth, get_all, update, no_ignore, ignore_externals, NULL, ctx, subpool)))
+#else /* CHECK_SVN_VERSION(1,7) */
+ if ((err = svn_client_status5(NULL, ctx, files?files[0]:"", &revision, depth, get_all, update, no_ignore, ignore_externals, TRUE, NULL, tsh_status_func, dialog, subpool)))
#endif
- {
+ {
svn_pool_destroy (subpool);
error_str = tsh_strerror(err);
- gdk_threads_enter();
- tsh_status_dialog_done (dialog);
+ gdk_threads_enter();
+ tsh_status_dialog_done (dialog);
error = gtk_message_dialog_new(GTK_WINDOW(dialog), GTK_DIALOG_DESTROY_WITH_PARENT | GTK_DIALOG_MODAL, GTK_MESSAGE_ERROR, GTK_BUTTONS_OK, _("Status failed"));
gtk_message_dialog_format_secondary_text(GTK_MESSAGE_DIALOG(error), "%s", error_str);
tsh_dialog_start(GTK_DIALOG(error), FALSE);
- gdk_threads_leave();
+ gdk_threads_leave();
g_free(error_str);
- svn_error_clear(err);
+ svn_error_clear(err);
tsh_reset_cancel();
- return GINT_TO_POINTER (FALSE);
- }
+ return GINT_TO_POINTER (FALSE);
+ }
svn_pool_destroy (subpool);
- gdk_threads_enter();
- tsh_status_dialog_done (dialog);
- gdk_threads_leave();
-
+ gdk_threads_enter();
+ tsh_status_dialog_done (dialog);
+ gdk_threads_leave();
+
tsh_reset_cancel();
- return GINT_TO_POINTER (TRUE);
+ return GINT_TO_POINTER (TRUE);
}
static void create_status_thread(TshStatusDialog *dialog, struct thread_args *args)
diff --git a/tvp-svn-helper/tsh-switch.c b/tvp-svn-helper/tsh-switch.c
index 0ee1508..9dd8180 100644
--- a/tvp-svn-helper/tsh-switch.c
+++ b/tvp-svn-helper/tsh-switch.c
@@ -29,6 +29,7 @@
#include <libxfce4util/libxfce4util.h>
+#include <subversion-1/svn_version.h>
#include <subversion-1/svn_client.h>
#include <subversion-1/svn_pools.h>
@@ -49,68 +50,76 @@ struct thread_args {
static gpointer switch_thread (gpointer user_data)
{
- struct thread_args *args = user_data;
+ struct thread_args *args = user_data;
svn_opt_revision_t revision;
- svn_error_t *err;
- svn_client_ctx_t *ctx = args->ctx;
- apr_pool_t *subpool, *pool = args->pool;
- TshNotifyDialog *dialog = args->dialog;
- gchar *path = args->path;
- gchar *url = args->url;
+ svn_error_t *err;
+ svn_client_ctx_t *ctx = args->ctx;
+ apr_pool_t *subpool, *pool = args->pool;
+ TshNotifyDialog *dialog = args->dialog;
+ gchar *path = args->path;
+ gchar *url = args->url;
gchar *error_str;
- g_free (args);
+ g_free (args);
subpool = svn_pool_create (pool);
revision.kind = svn_opt_revision_head;
- if ((err = svn_client_switch2(NULL, path, url, &revision, &revision, svn_depth_infinity, FALSE, FALSE, FALSE, ctx, subpool)))
- {
+#if CHECK_SVN_VERSION_S(1,6)
+ if ((err = svn_client_switch2(NULL, path, url, &revision, &revision, svn_depth_infinity, FALSE, FALSE, FALSE, ctx, subpool)))
+#else /* CHECK_SVN_VERSION(1,7) */
+ if ((err = svn_client_switch3(NULL, path, url, &revision, &revision, svn_depth_infinity, TRUE, FALSE, FALSE, FALSE, ctx, subpool)))
+#endif
+ {
svn_pool_destroy (subpool);
error_str = tsh_strerror(err);
- gdk_threads_enter();
+ gdk_threads_enter();
tsh_notify_dialog_add(dialog, _("Failed"), error_str, NULL);
- tsh_notify_dialog_done (dialog);
- gdk_threads_leave();
+ tsh_notify_dialog_done (dialog);
+ gdk_threads_leave();
g_free(error_str);
- svn_error_clear(err);
+ svn_error_clear(err);
tsh_reset_cancel();
- return GINT_TO_POINTER (FALSE);
- }
+ return GINT_TO_POINTER (FALSE);
+ }
svn_pool_destroy (subpool);
- gdk_threads_enter();
- tsh_notify_dialog_done (dialog);
- gdk_threads_leave();
-
+ gdk_threads_enter();
+ tsh_notify_dialog_done (dialog);
+ gdk_threads_leave();
+
tsh_reset_cancel();
- return GINT_TO_POINTER (TRUE);
+ return GINT_TO_POINTER (TRUE);
}
GThread *tsh_switch (gchar **files, svn_client_ctx_t *ctx, apr_pool_t *pool)
{
- GtkWidget *dialog;
- struct thread_args *args;
+ GtkWidget *dialog;
+ struct thread_args *args;
const char *url = NULL;
gchar *repository = NULL;
gchar *path;
- apr_pool_t *subpool;
+ apr_pool_t *subpool;
path = files?files[0]:NULL;
subpool = svn_pool_create(pool);
+#if CHECK_SVN_VERSION_S(1,6)
svn_error_clear(svn_client_url_from_path(&url, path?path:"", subpool));
+#else /* CHECK_SVN_VERSION(1,7) */
+ svn_error_clear(svn_client_url_from_path2(&url, path?path:"", ctx, subpool, subpool));
+#endif
repository = g_strdup(url);
svn_pool_destroy(subpool);
- dialog = tsh_transfer_dialog_new (_("Switch"), NULL, 0, repository, path);
+ dialog = tsh_transfer_dialog_new (_("Switch"), NULL, 0, repository, path);
g_free(repository);
- if(gtk_dialog_run (GTK_DIALOG (dialog)) != GTK_RESPONSE_OK)
+ if(gtk_dialog_run (GTK_DIALOG (dialog)) != GTK_RESPONSE_OK)
{
gtk_widget_destroy (dialog);
return NULL;
@@ -119,22 +128,22 @@ GThread *tsh_switch (gchar **files, svn_client_ctx_t *ctx, apr_pool_t *pool)
repository = tsh_transfer_dialog_get_reposetory(TSH_TRANSFER_DIALOG(dialog));
path = tsh_transfer_dialog_get_directory(TSH_TRANSFER_DIALOG(dialog));
- gtk_widget_destroy (dialog);
+ gtk_widget_destroy (dialog);
- dialog = tsh_notify_dialog_new (_("Switch"), NULL, 0);
+ dialog = tsh_notify_dialog_new (_("Switch"), NULL, 0);
g_signal_connect(dialog, "cancel-clicked", tsh_cancel, NULL);
- tsh_dialog_start (GTK_DIALOG (dialog), TRUE);
+ tsh_dialog_start (GTK_DIALOG (dialog), TRUE);
- ctx->notify_func2 = tsh_notify_func2;
- ctx->notify_baton2 = dialog;
+ ctx->notify_func2 = tsh_notify_func2;
+ ctx->notify_baton2 = dialog;
- args = g_malloc (sizeof (struct thread_args));
- args->ctx = ctx;
- args->pool = pool;
- args->dialog = TSH_NOTIFY_DIALOG (dialog);
- args->path = path;
- args->url = repository;
+ args = g_malloc (sizeof (struct thread_args));
+ args->ctx = ctx;
+ args->pool = pool;
+ args->dialog = TSH_NOTIFY_DIALOG (dialog);
+ args->path = path;
+ args->url = repository;
- return g_thread_create (switch_thread, args, TRUE, NULL);
+ return g_thread_create (switch_thread, args, TRUE, NULL);
}
diff --git a/tvp-svn-helper/tsh-update.c b/tvp-svn-helper/tsh-update.c
index 7f2510b..b625109 100644
--- a/tvp-svn-helper/tsh-update.c
+++ b/tvp-svn-helper/tsh-update.c
@@ -29,6 +29,7 @@
#include <libxfce4util/libxfce4util.h>
+#include <subversion-1/svn_version.h>
#include <subversion-1/svn_client.h>
#include <subversion-1/svn_pools.h>
@@ -47,64 +48,68 @@ struct thread_args {
static gpointer update_thread (gpointer user_data)
{
- struct thread_args *args = user_data;
+ struct thread_args *args = user_data;
svn_opt_revision_t revision;
- 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 **files = args->files;
- gint size, i;
+ 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 **files = args->files;
+ gint size, i;
gchar *error_str;
- g_free (args);
+ g_free (args);
- size = files?g_strv_length(files):0;
+ size = files?g_strv_length(files):0;
subpool = svn_pool_create (pool);
- if(size)
- {
- paths = apr_array_make (subpool, size, sizeof (const char *));
-
- for (i = 0; i < size; i++)
- {
- APR_ARRAY_PUSH (paths, const char *) = files[i];
- }
- }
- else
- {
- paths = apr_array_make (subpool, 1, sizeof (const char *));
-
- APR_ARRAY_PUSH (paths, const char *) = ""; // current directory
- }
+ if(size)
+ {
+ paths = apr_array_make (subpool, size, sizeof (const char *));
+
+ for (i = 0; i < size; i++)
+ {
+ APR_ARRAY_PUSH (paths, const char *) = files[i];
+ }
+ }
+ else
+ {
+ paths = apr_array_make (subpool, 1, sizeof (const char *));
+
+ APR_ARRAY_PUSH (paths, const char *) = ""; // current directory
+ }
revision.kind = svn_opt_revision_head;
- if ((err = svn_client_update3(NULL, paths, &revision, svn_depth_unknown, FALSE, FALSE, FALSE, ctx, subpool)))
- {
+#if CHECK_SVN_VERSION_S(1,6)
+ if ((err = svn_client_update3(NULL, paths, &revision, svn_depth_unknown, FALSE, FALSE, FALSE, ctx, subpool)))
+#else /* CHECK_SVN_VERSION(1,7) */
+ if ((err = svn_client_update4(NULL, paths, &revision, svn_depth_unknown, TRUE, FALSE, FALSE, FALSE, FALSE, ctx, subpool)))
+#endif
+ {
svn_pool_destroy (subpool);
error_str = tsh_strerror(err);
- gdk_threads_enter();
+ gdk_threads_enter();
tsh_notify_dialog_add(dialog, _("Failed"), error_str, NULL);
- tsh_notify_dialog_done (dialog);
- gdk_threads_leave();
+ tsh_notify_dialog_done (dialog);
+ gdk_threads_leave();
g_free(error_str);
- svn_error_clear(err);
+ svn_error_clear(err);
tsh_reset_cancel();
- return GINT_TO_POINTER (FALSE);
- }
+ return GINT_TO_POINTER (FALSE);
+ }
svn_pool_destroy (subpool);
- gdk_threads_enter();
- tsh_notify_dialog_done (dialog);
- gdk_threads_leave();
-
+ gdk_threads_enter();
+ tsh_notify_dialog_done (dialog);
+ gdk_threads_leave();
+
tsh_reset_cancel();
- return GINT_TO_POINTER (TRUE);
+ return GINT_TO_POINTER (TRUE);
}
GThread *tsh_update (gchar **files, svn_client_ctx_t *ctx, apr_pool_t *pool)
More information about the Xfce4-commits
mailing list