subversion-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From julianf...@apache.org
Subject svn commit: r1133099 - in /subversion/trunk/subversion: include/svn_wc.h libsvn_wc/info.c
Date Tue, 07 Jun 2011 17:14:31 GMT
Author: julianfoad
Date: Tue Jun  7 17:14:31 2011
New Revision: 1133099

URL: http://svn.apache.org/viewvc?rev=1133099&view=rev
Log:
Provide a dup function for the new svn_wc_info_t structure.

* subversion/include/svn_wc.h,
  subversion/libsvn_wc/info.c
  (svn_wc_info_dup): New function.

Modified:
    subversion/trunk/subversion/include/svn_wc.h
    subversion/trunk/subversion/libsvn_wc/info.c

Modified: subversion/trunk/subversion/include/svn_wc.h
URL: http://svn.apache.org/viewvc/subversion/trunk/subversion/include/svn_wc.h?rev=1133099&r1=1133098&r2=1133099&view=diff
==============================================================================
--- subversion/trunk/subversion/include/svn_wc.h (original)
+++ subversion/trunk/subversion/include/svn_wc.h Tue Jun  7 17:14:31 2011
@@ -3038,6 +3038,16 @@ typedef struct svn_wc_info_t
 
 } svn_wc_info_t;
 
+/**
+ * Return a duplicate of @a info, allocated in @a pool. No part of the new
+ * structure will be shared with @a info.
+ *
+ * @since New in 1.7.
+ */
+svn_wc_info_t *
+svn_wc_info_dup(const svn_wc_info_t *info,
+                apr_pool_t *pool);
+
 
 /** Given @a local_abspath in a dir under version control, decide if it is
  * in a state of conflict; return the answers in @a *text_conflicted_p, @a

Modified: subversion/trunk/subversion/libsvn_wc/info.c
URL: http://svn.apache.org/viewvc/subversion/trunk/subversion/libsvn_wc/info.c?rev=1133099&r1=1133098&r2=1133099&view=diff
==============================================================================
--- subversion/trunk/subversion/libsvn_wc/info.c (original)
+++ subversion/trunk/subversion/libsvn_wc/info.c Tue Jun  7 17:14:31 2011
@@ -33,6 +33,40 @@
 
 
 
+svn_wc_info_t *
+svn_wc_info_dup(const svn_wc_info_t *info,
+                apr_pool_t *pool)
+{
+  svn_wc_info_t *new_info = apr_pmemdup(pool, info, sizeof(*new_info));
+
+  if (info->changelist)
+    new_info->changelist = apr_pstrdup(pool, info->changelist);
+  if (info->checksum)
+    new_info->checksum = svn_checksum_dup(info->checksum, pool);
+  if (info->conflicts)
+    {
+      int i;
+
+      apr_array_header_t *new_conflicts
+        = apr_array_make(pool, info->conflicts->nelts, info->conflicts->elt_size);
+      for (i = 0; i < info->conflicts->nelts; i++)
+        {
+          APR_ARRAY_PUSH(new_conflicts, svn_wc_conflict_description2_t *)
+            = svn_wc__conflict_description2_dup(
+                APR_ARRAY_IDX(info->conflicts, i,
+                              const svn_wc_conflict_description2_t *),
+                pool);
+        }
+      new_info->conflicts = new_conflicts;
+    }
+  if (info->copyfrom_url)
+    new_info->copyfrom_url = apr_pstrdup(pool, info->copyfrom_url);
+  if (info->wcroot_abspath)
+    new_info->wcroot_abspath = apr_pstrdup(pool, info->wcroot_abspath);
+  return new_info;
+}
+
+
 /* Set *INFO to a new struct, allocated in RESULT_POOL, built from the WC
    metadata of LOCAL_ABSPATH.  Pointer fields are copied by reference, not
    dup'd. */



Mime
View raw message