Hi!

I'm letting the func return the old struct in the same manner as
svn_wc__cd2_to_cd() works for conflict_description_t. When we start
replacing entries, we might need to return and error instead, but since
the func will only be used in two places I can easily change parameters
and return values then.

[[[
Follow-up to r932571. Since converting a svn_wc_status3_t struct to a
svn_wc_status2_t dito will be a pretty complex operation, we create a
function to handle it.

* subversion/include/private/svn_wc_private.h
  (svn_wc__status2_from_3): New.

* subversion/libsvn_wc/util.c
  (svn_wc__status2_from_3): New.

* subversion/libsvn_wc/deprecated.c
  (status4_wrapper_func): Call the new func.

* subversion/libsvn_client/deprecated.c
  (status4_wrapper_func): Call the new func.

Suggested by: gstein
]]]
Index: subversion/include/private/svn_wc_private.h
===================================================================
--- subversion/include/private/svn_wc_private.h (revision 932968)
+++ subversion/include/private/svn_wc_private.h (working copy)
@@ -289,7 +289,15 @@ svn_wc_conflict_description2_t *
 svn_wc__cd_to_cd2(const svn_wc_conflict_description_t *conflict,
                   apr_pool_t *result_pool);
 
+/*
+ * Convert from svn_wc_status3_t to svn_wc_status2_t.
+ * Allocate the result in RESULT_POOL.
+ */
+svn_wc_status2_t *
+svn_wc__status2_from_3(const svn_wc_status3_t *status, 
+                       apr_pool_t *result_pool);
 
+
 /**
  * Fetch the absolute paths of all the working children of @a dir_abspath
  * into @a *children, allocated in @a result_pool.  Use @a wc_ctx to access
Index: subversion/libsvn_wc/deprecated.c
===================================================================
--- subversion/libsvn_wc/deprecated.c   (revision 932968)
+++ subversion/libsvn_wc/deprecated.c   (working copy)
@@ -2237,10 +2237,7 @@ status4_wrapper_func(void *baton,
   svn_wc_status2_t *dup;
   const char *path = local_abspath;
 
-  /* ### This conversion will involve a lot more once we start to actually
-   * ### do some changes in svn_wc_status3_t. We should probably create a
-   * ### specific function for handling the conversion */
-  dup = (svn_wc_status2_t *) svn_wc_dup_status3(status, scratch_pool);
+  dup = svn_wc__status2_from_3(status, scratch_pool);
 
   if (swb->anchor_abspath != NULL)
     {
Index: subversion/libsvn_wc/util.c
===================================================================
--- subversion/libsvn_wc/util.c (revision 932968)
+++ subversion/libsvn_wc/util.c (working copy)
@@ -543,3 +543,10 @@ svn_wc__cd_to_cd2(const svn_wc_conflict_descriptio
 
   return new_conflict;
 }
+
+svn_wc_status2_t *
+svn_wc__status2_from_3(const svn_wc_status3_t *status, 
+                       apr_pool_t *scratch_pool)
+{
+  return (svn_wc_status2_t *) svn_wc_dup_status3(status, scratch_pool);
+}
Index: subversion/libsvn_client/deprecated.c
===================================================================
--- subversion/libsvn_client/deprecated.c       (revision 932968)
+++ subversion/libsvn_client/deprecated.c       (working copy)
@@ -42,6 +42,7 @@
 #include "client.h"
 #include "mergeinfo.h"
 
+#include "private/svn_wc_private.h"
 #include "svn_private_config.h"
 
 
@@ -1439,12 +1440,8 @@ status4_wrapper_func(void *baton,
   struct status4_wrapper_baton *swb = baton;
   svn_wc_status2_t *dup;
 
+  dup = svn_wc__status2_from_3(status, scratch_pool);
 
-  /* ### This conversion will involve a lot more once we start to actually
-   * ### do some changes in svn_wc_status3_t. We should probably create a
-   * ### specific function for handling the conversion */
-  dup = (svn_wc_status2_t *) svn_wc_dup_status3(status, scratch_pool);
-
   return (*swb->old_func)(swb->old_baton, path, dup, scratch_pool);
 }
 

Reply via email to