Index: subversion/libsvn_subr/auth.c
===================================================================
--- subversion/libsvn_subr/auth.c	(revision 35037)
+++ subversion/libsvn_subr/auth.c	(working copy)
@@ -27,6 +27,7 @@
 #include "svn_config.h"
 #include "svn_private_config.h"
 #include "svn_dso.h"
+#include "svn_cmdline.h"
 
 /* The good way to think of this machinery is as a set of tables.
 
@@ -381,6 +382,7 @@
                                         apr_pool_t *pool)
 {
   *provider = NULL;
+  svn_cmdline_prompt_baton2_t *pb = NULL;
 
   if (apr_strnatcmp(provider_name, "gnome_keyring") == 0 ||
       apr_strnatcmp(provider_name, "kwallet") == 0)
@@ -423,10 +425,22 @@
             {
               if (strcmp(provider_type, "simple") == 0)
                 {
-                  svn_auth_simple_provider_func_t provider_function;
-                  provider_function = (svn_auth_simple_provider_func_t)
-                    provider_function_symbol;
-                  provider_function(provider, pool);
+                  if (strcmp(provider_name, "gnome_keyring") == 0)
+                    {
+                      svn_auth_unlock_provider_func_t provider_function;
+                      provider_function = (svn_auth_unlock_provider_func_t)
+                        provider_function_symbol;
+                      provider_function(provider,
+                                        svn_cmdline_auth_unlock_prompt,
+                                        pb, pool);
+                    }
+                  else
+                    {
+                      svn_auth_simple_provider_func_t provider_function;
+                      provider_function = (svn_auth_simple_provider_func_t)
+                        provider_function_symbol;
+                      provider_function(provider, pool);
+                    }
                 }
               else if (strcmp(provider_type, "ssl_client_cert_pw") == 0)
                 {
Index: subversion/libsvn_subr/prompt.c
===================================================================
--- subversion/libsvn_subr/prompt.c	(revision 35037)
+++ subversion/libsvn_subr/prompt.c	(working copy)
@@ -508,3 +508,22 @@
 {
   return svn_cmdline_prompt_user2(result, prompt_str, NULL, pool);
 }
+
+
+/* This implements 'svn_auth_unlock_prompt_func_t'. */
+svn_error_t *
+svn_cmdline_auth_unlock_prompt(char **keyring_password,
+                               const char *keyring_name,
+                               void *baton,
+                               apr_pool_t *pool)
+{
+  const char *password;
+  const char *pass_prompt;
+  svn_cmdline_prompt_baton2_t *pb = baton;
+
+  pass_prompt = apr_psprintf(pool, _("Password for [%s] GNOME keyring: "),
+                             keyring_name);
+  SVN_ERR(prompt(&password, pass_prompt, TRUE, pb, pool));
+  *keyring_password = apr_pstrdup(pool, password);
+  return SVN_NO_ERROR;
+}
Index: subversion/libsvn_auth_gnome_keyring/gnome_keyring.c
===================================================================
--- subversion/libsvn_auth_gnome_keyring/gnome_keyring.c	(revision 35037)
+++ subversion/libsvn_auth_gnome_keyring/gnome_keyring.c	(working copy)
@@ -42,6 +42,14 @@
 /* GNOME Keyring simple provider, puts passwords in GNOME Keyring        */
 /*-----------------------------------------------------------------------*/
 
+/* Baton type for the GNOME Keyring simple provider. */
+typedef struct
+{
+  svn_auth_unlock_prompt_func_t unlock_prompt_func;
+  void *unlock_prompt_baton;
+} unlock_prompt_provider_baton_t;
+
+
 struct gnome_keyring_baton
 {
   const char *keyring_name;
@@ -141,11 +149,9 @@
   return;
 }
 
-/* If the default keyring is locked, prompts for keyring password and
- * unlocks the keyring. Returns default keyring name if successfully
- * unlocked, else NULL. */
+/* Returns the default keyring name. */
 static char*
-gnome_keyring_unlock_keyring(apr_pool_t *pool)
+get_default_keyring_name(apr_pool_t *pool)
 {
   char *def = NULL;
   struct gnome_keyring_baton key_info;
@@ -166,9 +172,24 @@
       return NULL;
     }
 
+  def = strdup(key_info.keyring_name);
+  callback_destroy_data_keyring((void*)&key_info);
+
+  return (def);
+}
+
+/* Returns TRUE if the KEYRING_NAME is locked. */
+static svn_boolean_t
+check_keyring_is_locked(const char *keyring_name)
+{
+  struct gnome_keyring_baton key_info;
+
+  key_info.info = NULL;
+  key_info.keyring_name = NULL;
+
   /* Get details about the default keyring. */
   key_info.loop = g_main_loop_new(NULL, FALSE);
-  gnome_keyring_get_info(key_info.keyring_name,
+  gnome_keyring_get_info(keyring_name,
         (GnomeKeyringOperationGetKeyringInfoCallback)callback_get_info_keyring,
         (void*)&key_info, NULL);
   g_main_loop_run(key_info.loop);
@@ -176,31 +197,49 @@
   if (key_info.info == NULL)
     {
       callback_destroy_data_keyring((void*)&key_info);
-      return NULL;
+      return FALSE;
     }
 
-  /* Check if default keyring is locked. */
+  /* Check if keyring is locked. */
   if (gnome_keyring_info_get_is_locked(key_info.info))
-    {
-      char *prompt;
-      svn_auth_cred_simple_t *cred;
-      apr_pool_t *subpool = svn_pool_create(pool);
+    return TRUE;
+  else
+    return FALSE;
+}
 
-      prompt = apr_psprintf(subpool, "[%s] keyring", key_info.keyring_name);
-      svn_cmdline_auth_simple_prompt(&cred, NULL, NULL, prompt, TRUE, subpool);
-      svn_pool_destroy(subpool);
+/* Unlock the KEYRING_NAME with the KEYRING_PASSWORD. */
+static void
+gnome_keyring_unlock_keyring(const char *keyring_name,
+                             const char *keyring_password,
+                             apr_pool_t *pool)
+{
+  struct gnome_keyring_baton key_info;
 
+  key_info.info = NULL;
+  key_info.keyring_name = NULL;
+
+  /* Get details about the default keyring. */
+  key_info.loop = g_main_loop_new(NULL, FALSE);
+  gnome_keyring_get_info(keyring_name,
+        (GnomeKeyringOperationGetKeyringInfoCallback)callback_get_info_keyring,
+        (void*)&key_info, NULL);
+  g_main_loop_run(key_info.loop);
+
+  if (key_info.info == NULL)
+    {
+      callback_destroy_data_keyring((void*)&key_info);
+      return;
+    }
+  else
+    {
       key_info.loop = g_main_loop_new(NULL, FALSE);
-      gnome_keyring_unlock(key_info.keyring_name, cred->password,
+      gnome_keyring_unlock(keyring_name, keyring_password,
                  (GnomeKeyringOperationDoneCallback)callback_done,
                  (void*)&key_info, NULL);
       g_main_loop_run(key_info.loop);
     }
-
-  def = strdup(key_info.keyring_name);
   callback_destroy_data_keyring((void*)&key_info);
-
-  return (def);
+  return;
 }
 
 /* Implementation of password_get_t that retrieves the password
@@ -231,7 +270,7 @@
       return FALSE;
     }
 
-  default_keyring = gnome_keyring_unlock_keyring(pool);
+  default_keyring = get_default_keyring_name(pool);
 
   GnomeKeyringResult result;
   GList *items;
@@ -310,7 +349,7 @@
       return FALSE;
     }
 
-  default_keyring = gnome_keyring_unlock_keyring(pool);
+  default_keyring = get_default_keyring_name(pool);
 
   GnomeKeyringResult result;
   guint32 item_id;
@@ -352,6 +391,25 @@
                                  const char *realmstring,
                                  apr_pool_t *pool)
 {
+  unlock_prompt_provider_baton_t *pb =
+    (unlock_prompt_provider_baton_t *)provider_baton;
+  char *keyring_password;
+  const char *default_keyring = get_default_keyring_name(pool);
+
+  if (check_keyring_is_locked(default_keyring))
+    {
+      if (pb->unlock_prompt_func)
+        {
+          SVN_ERR((*pb->unlock_prompt_func)
+                  (&keyring_password,
+                   default_keyring,
+                   pb->unlock_prompt_baton,
+                   pool));
+          gnome_keyring_unlock_keyring(default_keyring, keyring_password,
+                                       pool);
+        }
+    }
+
   return svn_auth__simple_first_creds_helper(credentials,
                                              iter_baton, provider_baton,
                                              parameters, realmstring,
@@ -369,6 +427,26 @@
                                 const char *realmstring,
                                 apr_pool_t *pool)
 {
+  unlock_prompt_provider_baton_t *pb =
+    (unlock_prompt_provider_baton_t *)provider_baton;
+
+  char *keyring_password;
+  const char *default_keyring = get_default_keyring_name(pool);
+
+  if (check_keyring_is_locked(default_keyring))
+    {
+      if (pb->unlock_prompt_func)
+        {
+          SVN_ERR((*pb->unlock_prompt_func)
+                  (&keyring_password,
+                   default_keyring,
+                   pb->unlock_prompt_baton,
+                   pool));
+          gnome_keyring_unlock_keyring(default_keyring, keyring_password,
+                                       pool);
+        }
+    }
+
   return svn_auth__simple_save_creds_helper(saved, credentials,
                                             provider_baton, parameters,
                                             realmstring,
@@ -397,16 +475,24 @@
 void
 svn_auth_get_gnome_keyring_simple_provider
     (svn_auth_provider_object_t **provider,
+     svn_auth_unlock_prompt_func_t unlock_prompt_func,
+     void *unlock_prompt_baton,
      apr_pool_t *pool)
 {
   svn_auth_provider_object_t *po = apr_pcalloc(pool, sizeof(*po));
+  unlock_prompt_provider_baton_t *pb = apr_pcalloc(pool, sizeof(*pb));
 
+  pb->unlock_prompt_func = unlock_prompt_func;
+  pb->unlock_prompt_baton = unlock_prompt_baton;
+
   po->vtable = &gnome_keyring_simple_provider;
+  po->provider_baton = pb;
   *provider = po;
 
   gnome_keyring_init();
 }
 
+
 
 /*-----------------------------------------------------------------------*/
 /* GNOME Keyring SSL client certificate passphrase provider,             */
Index: subversion/include/svn_cmdline.h
===================================================================
--- subversion/include/svn_cmdline.h	(revision 35037)
+++ subversion/include/svn_cmdline.h	(working copy)
@@ -304,6 +304,17 @@
                                              void *baton,
                                              apr_pool_t *pool);
 
+/** An implementation of @c svn_auth_unlock_prompt_func_t that
+ * prompts the user for default GNOME Keyring password.
+ *
+ * @since New in 1.6.
+ */
+svn_error_t *
+svn_cmdline_auth_unlock_prompt(char **keyring_password,
+                               const char *keyring_name,
+                               void *baton,
+                               apr_pool_t *pool);
+
 /** Set @a *ab to an authentication baton allocated from @a pool and
  * initialized with the standard set of authentication providers used
  * by the command line client.
Index: subversion/include/svn_auth.h
===================================================================
--- subversion/include/svn_auth.h	(revision 35037)
+++ subversion/include/svn_auth.h	(working copy)
@@ -529,6 +529,34 @@
    void *baton,
    apr_pool_t *pool);
 
+/** Called only by providers which unlocks GNOME Keyring.
+ * In this callback, clients should ask the user for default keyring
+ * @a keyring_name password.
+ *
+ * The answer is returned in @a *keyring_password.
+ * @a baton is an implementation-specific closure.
+ * All allocations should be done in @a pool.
+ *
+ * If this callback is NULL it is not called.
+ *
+ * @since New in 1.6
+ */
+typedef svn_error_t *(*svn_auth_unlock_prompt_func_t)
+  (char **keyring_password,
+   const char *keyring_name,
+   void *baton,
+   apr_pool_t *pool);
+
+/** The type of function returning GNOME Keyring authentication provider.
+ *
+ *  @since New in 1.6
+ */
+typedef void (*svn_auth_unlock_provider_func_t)
+  (svn_auth_provider_object_t **provider,
+   svn_auth_unlock_prompt_func_t unlock_prompt_func,
+   void *unlock_prompt_baton,
+   apr_pool_t *pool);
+
 
 /** Initialize an authentication system.
  *
@@ -952,6 +980,8 @@
 void
 svn_auth_get_gnome_keyring_simple_provider
     (svn_auth_provider_object_t **provider,
+     svn_auth_unlock_prompt_func_t unlock_prompt_func,
+     void *prompt_baton,
      apr_pool_t *pool);
 
 
