subversion-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From stef...@apache.org
Subject svn commit: r1717438 - in /subversion/trunk/subversion/libsvn_fs_x: fs_x.c revprops.c transaction.c
Date Tue, 01 Dec 2015 13:33:19 GMT
Author: stefan2
Date: Tue Dec  1 13:33:19 2015
New Revision: 1717438

URL: http://svn.apache.org/viewvc?rev=1717438&view=rev
Log:
In FSX, use the new proplist serialization for revprops as well.

* subversion/libsvn_fs_x/fs_x.c
  (write_revision_zero): Create revprop for r0 using the new API.

* subversion/libsvn_fs_x/revprops.c
  (parse_revprop,
   write_non_packed_revprop,
   write_packed_revprop): Call the new internal API instead of
                          the old hash serializer.

* subversion/libsvn_fs_x/transaction.c
  (get_txn_proplist): Call the new proplist parser and make the
                      function signature more suitable for that.
  (set_txn_proplist): Call the new serializer.
  (svn_fs_x__change_txn_props): Update caller.
  (write_final_revprop): Call the new serializer.
  (svn_fs_x__txn_proplist): Update caller.

Modified:
    subversion/trunk/subversion/libsvn_fs_x/fs_x.c
    subversion/trunk/subversion/libsvn_fs_x/revprops.c
    subversion/trunk/subversion/libsvn_fs_x/transaction.c

Modified: subversion/trunk/subversion/libsvn_fs_x/fs_x.c
URL: http://svn.apache.org/viewvc/subversion/trunk/subversion/libsvn_fs_x/fs_x.c?rev=1717438&r1=1717437&r2=1717438&view=diff
==============================================================================
--- subversion/trunk/subversion/libsvn_fs_x/fs_x.c (original)
+++ subversion/trunk/subversion/libsvn_fs_x/fs_x.c Tue Dec  1 13:33:19 2015
@@ -33,6 +33,7 @@
 
 #include "cached_data.h"
 #include "id.h"
+#include "low_level.h"
 #include "rep-cache.h"
 #include "revprops.h"
 #include "transaction.h"
@@ -935,12 +936,13 @@ write_revision_zero(svn_fs_t *fs,
 
   revprops = svn_stringbuf_create_empty(scratch_pool);
   stream = svn_stream_from_stringbuf(revprops, scratch_pool);
-  SVN_ERR(svn_hash_write2(proplist, stream, SVN_HASH_TERMINATOR,
-                          scratch_pool));
+  SVN_ERR(svn_fs_x__write_properties(stream, proplist, scratch_pool));
   SVN_ERR(svn_stream_close(stream));
 
-  SVN_ERR(svn_io_file_create(svn_fs_x__path_revprops(fs, 0, scratch_pool),
-                             revprops->data, scratch_pool));
+  SVN_ERR(svn_io_file_create_bytes(svn_fs_x__path_revprops(fs, 0,
+                                                           scratch_pool),
+                                   revprops->data, revprops->len,
+                                   scratch_pool));
 
   return SVN_NO_ERROR;
 }

Modified: subversion/trunk/subversion/libsvn_fs_x/revprops.c
URL: http://svn.apache.org/viewvc/subversion/trunk/subversion/libsvn_fs_x/revprops.c?rev=1717438&r1=1717437&r2=1717438&view=diff
==============================================================================
--- subversion/trunk/subversion/libsvn_fs_x/revprops.c (original)
+++ subversion/trunk/subversion/libsvn_fs_x/revprops.c Tue Dec  1 13:33:19 2015
@@ -29,6 +29,7 @@
 #include "svn_sorts.h"
 
 #include "fs_x.h"
+#include "low_level.h"
 #include "revprops.h"
 #include "util.h"
 #include "transaction.h"
@@ -412,13 +413,10 @@ parse_revprop(apr_hash_t **properties,
               apr_pool_t *result_pool,
               apr_pool_t *scratch_pool)
 {
-  svn_stream_t *stream = svn_stream_from_string(content, scratch_pool);
-  *properties = apr_hash_make(result_pool);
-
-  SVN_ERR_W(svn_hash_read2(*properties, stream, SVN_HASH_TERMINATOR,
-                           result_pool),
+  SVN_ERR_W(svn_fs_x__parse_properties(properties, content, result_pool),
             apr_psprintf(scratch_pool, "Failed to parse revprops for r%ld.",
                          revision));
+
   if (has_revprop_cache(fs, scratch_pool))
     {
       svn_fs_x__data_t *ffd = fs->fsap_data;
@@ -1023,9 +1021,9 @@ write_non_packed_revprop(const char **fi
   *tmp_path = apr_pstrcat(result_pool, *final_path, ".tmp", SVN_VA_NULL);
   SVN_ERR(svn_fs_x__batch_fsync_open_file(&file, batch, *tmp_path,
                                           scratch_pool));
+
   stream = svn_stream_from_aprfile2(file, TRUE, scratch_pool);
-  SVN_ERR(svn_hash_write2(proplist, stream, SVN_HASH_TERMINATOR,
-                          scratch_pool));
+  SVN_ERR(svn_fs_x__write_properties(stream, proplist, scratch_pool));
   SVN_ERR(svn_stream_close(stream));
 
   return SVN_NO_ERROR;
@@ -1295,8 +1293,7 @@ write_packed_revprop(const char **final_
   /* serialize the new revprops */
   serialized = svn_stringbuf_create_empty(scratch_pool);
   stream = svn_stream_from_stringbuf(serialized, scratch_pool);
-  SVN_ERR(svn_hash_write2(proplist, stream, SVN_HASH_TERMINATOR,
-                          scratch_pool));
+  SVN_ERR(svn_fs_x__write_properties(stream, proplist, scratch_pool));
   SVN_ERR(svn_stream_close(stream));
 
   /* calculate the size of the new data */

Modified: subversion/trunk/subversion/libsvn_fs_x/transaction.c
URL: http://svn.apache.org/viewvc/subversion/trunk/subversion/libsvn_fs_x/transaction.c?rev=1717438&r1=1717437&r2=1717438&view=diff
==============================================================================
--- subversion/trunk/subversion/libsvn_fs_x/transaction.c (original)
+++ subversion/trunk/subversion/libsvn_fs_x/transaction.c Tue Dec  1 13:33:19 2015
@@ -1373,16 +1373,16 @@ create_txn(svn_fs_txn_t **txn_p,
   return SVN_NO_ERROR;
 }
 
-/* Store the property list for transaction TXN_ID in PROPLIST.
-   Perform temporary allocations in SCRATCH_POOL. */
+/* Store the property list for transaction TXN_ID in *PROPLIST, allocated
+   from RESULT_POOL. Perform temporary allocations in SCRATCH_POOL. */
 static svn_error_t *
-get_txn_proplist(apr_hash_t *proplist,
+get_txn_proplist(apr_hash_t **proplist,
                  svn_fs_t *fs,
                  svn_fs_x__txn_id_t txn_id,
+                 apr_pool_t *result_pool,
                  apr_pool_t *scratch_pool)
 {
-  svn_stream_t *stream;
-  svn_error_t *err;
+  svn_stringbuf_t *content;
 
   /* Check for issue #3696. (When we find and fix the cause, we can change
    * this to an assertion.) */
@@ -1392,23 +1392,20 @@ get_txn_proplist(apr_hash_t *proplist,
                               "passed to get_txn_proplist()"));
 
   /* Open the transaction properties file. */
-  SVN_ERR(svn_stream_open_readonly(&stream,
+  SVN_ERR(svn_stringbuf_from_file2(&content,
                                    svn_fs_x__path_txn_props(fs, txn_id,
                                                             scratch_pool),
-                                   scratch_pool, scratch_pool));
+                                   result_pool));
 
   /* Read in the property list. */
-  err = svn_hash_read2(proplist, stream, SVN_HASH_TERMINATOR,
-                       scratch_pool);
-  if (err)
-    {
-      err = svn_error_compose_create(err, svn_stream_close(stream));
-      return svn_error_quick_wrapf(err,
-               _("malformed property list in transaction '%s'"),
-               svn_fs_x__path_txn_props(fs, txn_id, scratch_pool));
-    }
+  SVN_ERR_W(svn_fs_x__parse_properties(proplist,
+                                   svn_stringbuf__morph_into_string(content),
+                                   result_pool),
+            apr_psprintf(scratch_pool,
+                         _("malformed property list in transaction '%s'"),
+                         svn_fs_x__path_txn_props(fs, txn_id, scratch_pool)));
 
-  return svn_stream_close(stream);
+  return SVN_NO_ERROR;
 }
 
 /* Save the property list PROPS as the revprops for transaction TXN_ID
@@ -1428,7 +1425,7 @@ set_txn_proplist(svn_fs_t *fs,
                                                         scratch_pool),
                                  svn_io_file_del_none,
                                  scratch_pool, scratch_pool));
-  SVN_ERR(svn_hash_write2(props, stream, SVN_HASH_TERMINATOR, scratch_pool));
+  SVN_ERR(svn_fs_x__write_properties(stream, props, scratch_pool));
   SVN_ERR(svn_stream_close(stream));
 
   /* Replace the old file with the new one. */
@@ -1466,11 +1463,11 @@ svn_fs_x__change_txn_props(svn_fs_txn_t
 {
   fs_txn_data_t *ftd = txn->fsap_data;
   apr_pool_t *subpool = svn_pool_create(scratch_pool);
-  apr_hash_t *txn_prop = apr_hash_make(subpool);
+  apr_hash_t *txn_prop;
   int i;
   svn_error_t *err;
 
-  err = get_txn_proplist(txn_prop, txn->fs, ftd->txn_id, subpool);
+  err = get_txn_proplist(&txn_prop, txn->fs, ftd->txn_id, subpool, subpool);
   /* Here - and here only - we need to deal with the possibility that the
      transaction property file doesn't yet exist.  The rest of the
      implementation assumes that the file exists, but we're called to set the
@@ -3467,7 +3464,7 @@ write_final_revprop(const char **path,
 
   /* Write the new contents to the final revprops file. */
   stream = svn_stream_from_aprfile2(file, TRUE, scratch_pool);
-  SVN_ERR(svn_hash_write2(props, stream, SVN_HASH_TERMINATOR, scratch_pool));
+  SVN_ERR(svn_fs_x__write_properties(stream, props, scratch_pool));
   SVN_ERR(svn_stream_close(stream));
 
   return SVN_NO_ERROR;
@@ -4031,10 +4028,8 @@ svn_fs_x__txn_proplist(apr_hash_t **tabl
                        svn_fs_txn_t *txn,
                        apr_pool_t *pool)
 {
-  apr_hash_t *proplist = apr_hash_make(pool);
-  SVN_ERR(get_txn_proplist(proplist, txn->fs, svn_fs_x__txn_get_id(txn),
-                           pool));
-  *table_p = proplist;
+  SVN_ERR(get_txn_proplist(table_p, txn->fs, svn_fs_x__txn_get_id(txn),
+                           pool, pool));
 
   return SVN_NO_ERROR;
 }



Mime
View raw message