You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@subversion.apache.org by ju...@apache.org on 2017/10/26 11:33:37 UTC

svn commit: r1813388 - in /subversion/branches/shelve/subversion: include/svn_client.h libsvn_client/shelve.c

Author: julianfoad
Date: Thu Oct 26 11:33:37 2017
New Revision: 1813388

URL: http://svn.apache.org/viewvc?rev=1813388&view=rev
Log:
On the 'shelve' branch: Add an API to tell quickly whether there are any
shelved changes, so a GUI such as TortoiseSVN can decide whether to
show an 'unshelve' option.

This initial provision of the API isn't O(1) fast.

* subversion/include/svn_client.h,
  subversion/libssvn_client/shelve.c
  (svn_client_shelves_any): New.

Modified:
    subversion/branches/shelve/subversion/include/svn_client.h
    subversion/branches/shelve/subversion/libsvn_client/shelve.c

Modified: subversion/branches/shelve/subversion/include/svn_client.h
URL: http://svn.apache.org/viewvc/subversion/branches/shelve/subversion/include/svn_client.h?rev=1813388&r1=1813387&r2=1813388&view=diff
==============================================================================
--- subversion/branches/shelve/subversion/include/svn_client.h (original)
+++ subversion/branches/shelve/subversion/include/svn_client.h Thu Oct 26 11:33:37 2017
@@ -6782,6 +6782,22 @@ svn_client_shelves_list(apr_hash_t **she
                         apr_pool_t *result_pool,
                         apr_pool_t *scratch_pool);
 
+/* Set @a *any_shelved to indicate if there are any shelved changes in this WC.
+ *
+ * This shall provide the answer fast, regardless of how many changes
+ * are stored, unlike svn_client_shelves_list().
+ *
+ * ### Initial implementation isn't O(1) fast -- it just calls
+ *     svn_client_shelves_list().
+ *
+ * @since New in 1.11.
+ */
+svn_error_t *
+svn_client_shelves_any(svn_boolean_t *any_shelved,
+                       const char *local_abspath,
+                       svn_client_ctx_t *ctx,
+                       apr_pool_t *scratch_pool);
+
 /** Write local changes to a patch file at @a name.
  *
  * @a wc_root_abspath: The WC root dir.

Modified: subversion/branches/shelve/subversion/libsvn_client/shelve.c
URL: http://svn.apache.org/viewvc/subversion/branches/shelve/subversion/libsvn_client/shelve.c?rev=1813388&r1=1813387&r2=1813388&view=diff
==============================================================================
--- subversion/branches/shelve/subversion/libsvn_client/shelve.c (original)
+++ subversion/branches/shelve/subversion/libsvn_client/shelve.c Thu Oct 26 11:33:37 2017
@@ -409,3 +409,16 @@ svn_client_shelves_list(apr_hash_t **she
   return SVN_NO_ERROR;
 }
 
+svn_error_t *
+svn_client_shelves_any(svn_boolean_t *any_shelved,
+                       const char *local_abspath,
+                       svn_client_ctx_t *ctx,
+                       apr_pool_t *scratch_pool)
+{
+  apr_hash_t *shelved_patch_infos;
+
+  SVN_ERR(svn_client_shelves_list(&shelved_patch_infos, local_abspath,
+                                  ctx, scratch_pool, scratch_pool));
+  *any_shelved = apr_hash_count(shelved_patch_infos) != 0;
+  return SVN_NO_ERROR;
+}