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 2018/01/11 12:51:53 UTC

svn commit: r1820873 - in /subversion/branches/shelve-checkpoint/subversion: include/svn_client.h libsvn_client/client.h libsvn_client/shelve.c svn/shelve-cmd.c

Author: julianfoad
Date: Thu Jan 11 12:51:52 2018
New Revision: 1820873

URL: http://svn.apache.org/viewvc?rev=1820873&view=rev
Log:
On the 'shelve-checkpoint' branch: formal correctness fixes in the new revprop support.

Modified:
    subversion/branches/shelve-checkpoint/subversion/include/svn_client.h
    subversion/branches/shelve-checkpoint/subversion/libsvn_client/client.h
    subversion/branches/shelve-checkpoint/subversion/libsvn_client/shelve.c
    subversion/branches/shelve-checkpoint/subversion/svn/shelve-cmd.c

Modified: subversion/branches/shelve-checkpoint/subversion/include/svn_client.h
URL: http://svn.apache.org/viewvc/subversion/branches/shelve-checkpoint/subversion/include/svn_client.h?rev=1820873&r1=1820872&r2=1820873&view=diff
==============================================================================
--- subversion/branches/shelve-checkpoint/subversion/include/svn_client.h (original)
+++ subversion/branches/shelve-checkpoint/subversion/include/svn_client.h Thu Jan 11 12:51:52 2018
@@ -6909,6 +6909,8 @@ svn_client_shelf_set_log_message(svn_cli
 
 /** Get the log message in @a shelf into @a *log_message.
  *
+ * Set @a *log_message to NULL if there is no log message.
+ *
  * @since New in 1.X.
  * @warning EXPERIMENTAL.
  */

Modified: subversion/branches/shelve-checkpoint/subversion/libsvn_client/client.h
URL: http://svn.apache.org/viewvc/subversion/branches/shelve-checkpoint/subversion/libsvn_client/client.h?rev=1820873&r1=1820872&r2=1820873&view=diff
==============================================================================
--- subversion/branches/shelve-checkpoint/subversion/libsvn_client/client.h (original)
+++ subversion/branches/shelve-checkpoint/subversion/libsvn_client/client.h Thu Jan 11 12:51:52 2018
@@ -1269,7 +1269,7 @@ svn_client__merge_locked(svn_client__con
 
 /** Set @a shelf's revprop @a prop_name to @a prop_val.
  *
- * (Initially only implements svn:log; others ignored.)
+ * If @a prop_val is NULL, delete the property (if present).
  */
 svn_error_t *
 svn_client__shelf_revprop_set(svn_client_shelf_t *shelf,
@@ -1277,9 +1277,12 @@ svn_client__shelf_revprop_set(svn_client
                                const svn_string_t *prop_val,
                                apr_pool_t *scratch_pool);
 
-/** Get @a shelf's revprop @a prop_name into @a prop_val.
+/** Get @a shelf's revprop @a prop_name into @a *prop_val.
  *
- * (Initially only implements svn:log; others get NULL.)
+ * If the property is not present, set @a *prop_val to NULL.
+ *
+ * The lifetime of the result is limited to that of @a shelf and/or
+ * of @a result_pool.
  */
 svn_error_t *
 svn_client__shelf_revprop_get(svn_string_t **prop_val,
@@ -1289,7 +1292,8 @@ svn_client__shelf_revprop_get(svn_string
 
 /** Get @a shelf's revprops into @a props.
  *
- * (Initially only implements svn:log.)
+ * The lifetime of the result is limited to that of @a shelf and/or
+ * of @a result_pool.
  */
 svn_error_t *
 svn_client__shelf_revprop_list(apr_hash_t **props,

Modified: subversion/branches/shelve-checkpoint/subversion/libsvn_client/shelve.c
URL: http://svn.apache.org/viewvc/subversion/branches/shelve-checkpoint/subversion/libsvn_client/shelve.c?rev=1820873&r1=1820872&r2=1820873&view=diff
==============================================================================
--- subversion/branches/shelve-checkpoint/subversion/libsvn_client/shelve.c (original)
+++ subversion/branches/shelve-checkpoint/subversion/libsvn_client/shelve.c Thu Jan 11 12:51:52 2018
@@ -173,11 +173,11 @@ shelf_write_revprops(svn_client_shelf_t
 
 svn_error_t *
 svn_client__shelf_revprop_set(svn_client_shelf_t *shelf,
-                               const char *prop_name,
-                               const svn_string_t *prop_val,
-                               apr_pool_t *scratch_pool)
+                              const char *prop_name,
+                              const svn_string_t *prop_val,
+                              apr_pool_t *scratch_pool)
 {
-  svn_hash_sets(shelf->revprops, prop_name,
+  svn_hash_sets(shelf->revprops, apr_pstrdup(shelf->pool, prop_name),
                 svn_string_dup(prop_val, shelf->pool));
   SVN_ERR(shelf_write_revprops(shelf, scratch_pool));
   return SVN_NO_ERROR;
@@ -185,9 +185,9 @@ svn_client__shelf_revprop_set(svn_client
 
 svn_error_t *
 svn_client__shelf_revprop_get(svn_string_t **prop_val,
-                               svn_client_shelf_t *shelf,
-                               const char *prop_name,
-                               apr_pool_t *result_pool)
+                              svn_client_shelf_t *shelf,
+                              const char *prop_name,
+                              apr_pool_t *result_pool)
 {
   *prop_val = svn_hash_gets(shelf->revprops, prop_name);
   return SVN_NO_ERROR;
@@ -554,7 +554,7 @@ svn_client_shelf_get_log_message(char **
   if (propval)
     *log_message = apr_pstrdup(result_pool, propval->data);
   else
-    *log_message = "";
+    *log_message = NULL;
   return SVN_NO_ERROR;
 }
 

Modified: subversion/branches/shelve-checkpoint/subversion/svn/shelve-cmd.c
URL: http://svn.apache.org/viewvc/subversion/branches/shelve-checkpoint/subversion/svn/shelve-cmd.c?rev=1820873&r1=1820872&r2=1820873&view=diff
==============================================================================
--- subversion/branches/shelve-checkpoint/subversion/svn/shelve-cmd.c (original)
+++ subversion/branches/shelve-checkpoint/subversion/svn/shelve-cmd.c Thu Jan 11 12:51:52 2018
@@ -163,9 +163,12 @@ shelves_list(const char *local_abspath,
 
           SVN_ERR(svn_client_shelf_get_log_message(&log_message, shelf,
                                                    scratch_pool));
-          SVN_ERR(svn_cmdline_printf(scratch_pool,
-                                     _(" %.50s\n"),
-                                     log_message));
+          if (log_message)
+            {
+              SVN_ERR(svn_cmdline_printf(scratch_pool,
+                                         _(" %.50s\n"),
+                                         log_message));
+            }
         }
 
       if (with_diffstat)