You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@subversion.apache.org by hw...@apache.org on 2011/04/27 21:43:58 UTC

svn commit: r1097219 - in /subversion/trunk/subversion: include/svn_client.h include/svn_types.h include/svn_wc.h libsvn_client/deprecated.c libsvn_client/info.c svn/info-cmd.c

Author: hwright
Date: Wed Apr 27 19:43:58 2011
New Revision: 1097219

URL: http://svn.apache.org/viewvc?rev=1097219&view=rev
Log:
Change svn_info_receiver_2_t to use svn_info2_t in place of svn_info_t.  This
requires a substantial amount of refactoring in libsvn_client and the
commandline client.

* subversion/svn/info-cmd.c
  (print_info_xml, print_info): Adjust for svn_info2_t.
  (svn_cl__info): Update variable type.

* subversion/include/svn_types.h
  (svn_info_receiver2_t): Moved to here to be accessible to both libsvn_client
    and libsvn_wc.

* subversion/include/svn_wc.h
  (svn_wc_info_t.working_size): Rename.
  (svn_wc_info_t.conflict): Const-ify.

* subversion/include/svn_client.h
  (svn_info_receiver2_t): Removed to svn_types.h.

* subversion/libsvn_client/deprecated.c
  (info_from_info2): New.
  (info_receiver_relpath_wrapper): Accept the new type and convert it for the
    receiver.

* subversion/libsvn_client/info.c
  (build_info_from_dirent, build_info_for_entry, build_entry_for_unversioned):
    Adjust for svn_info2_t.
  (crawl_entries, svn_info3, push_dir_info): Update info and receiver types.
  (info_found_node_callback): Update info type.

Modified:
    subversion/trunk/subversion/include/svn_client.h
    subversion/trunk/subversion/include/svn_types.h
    subversion/trunk/subversion/include/svn_wc.h
    subversion/trunk/subversion/libsvn_client/deprecated.c
    subversion/trunk/subversion/libsvn_client/info.c
    subversion/trunk/subversion/svn/info-cmd.c

Modified: subversion/trunk/subversion/include/svn_client.h
URL: http://svn.apache.org/viewvc/subversion/trunk/subversion/include/svn_client.h?rev=1097219&r1=1097218&r2=1097219&view=diff
==============================================================================
--- subversion/trunk/subversion/include/svn_client.h (original)
+++ subversion/trunk/subversion/include/svn_client.h Wed Apr 27 19:43:58 2011
@@ -5243,19 +5243,6 @@ typedef struct svn_info_t
 
 } svn_info_t;
 
-/**
- * The callback invoked by svn_client_info3().  Each invocation
- * describes @a abspath_or_url with the information present in @a info.
- * Use @a scratch_pool for all temporary allocation.
- *
- * @since New in 1.7.
- */
-/* ### Before 1.7: We might want to rev  svn_wc_info2_t* to update conflict
-       information, remove schedule, etc. */
-typedef svn_error_t *(*svn_info_receiver2_t)(void *baton,
-                                             const char *abspath_or_url,
-                                             const svn_info_t *info,
-                                             apr_pool_t *scratch_pool);
 
 /**
  * The callback invoked by svn_client_info2().  Each invocation

Modified: subversion/trunk/subversion/include/svn_types.h
URL: http://svn.apache.org/viewvc/subversion/trunk/subversion/include/svn_types.h?rev=1097219&r1=1097218&r2=1097219&view=diff
==============================================================================
--- subversion/trunk/subversion/include/svn_types.h (original)
+++ subversion/trunk/subversion/include/svn_types.h Wed Apr 27 19:43:58 2011
@@ -1273,6 +1273,18 @@ typedef struct svn_info2_t
 } svn_info2_t;
 
 
+/**
+ * The callback invoked by info retrievers.  Each invocation
+ * describes @a abspath_or_url with the information present in @a info.
+ * Use @a scratch_pool for all temporary allocation.
+ *
+ * @since New in 1.7.
+ */
+typedef svn_error_t *(*svn_info_receiver2_t)(void *baton,
+                                             const char *abspath_or_url,
+                                             const svn_info2_t *info,
+                                             apr_pool_t *scratch_pool);
+
 #ifdef __cplusplus
 }
 #endif /* __cplusplus */

Modified: subversion/trunk/subversion/include/svn_wc.h
URL: http://svn.apache.org/viewvc/subversion/trunk/subversion/include/svn_wc.h?rev=1097219&r1=1097218&r2=1097219&view=diff
==============================================================================
--- subversion/trunk/subversion/include/svn_wc.h (original)
+++ subversion/trunk/subversion/include/svn_wc.h Wed Apr 27 19:43:58 2011
@@ -3020,10 +3020,10 @@ typedef struct svn_wc_info_t
    * representation, or #SVN_INVALID_FILESIZE if unknown.
    * Not applicable for directories.
    */
-  svn_filesize_t working_size64;
+  svn_filesize_t working_size;
 
   /** Info on any conflict of which this node is a victim. Otherwise NULL.  */
-  svn_wc_conflict_description2_t *conflict;
+  const svn_wc_conflict_description2_t *conflict;
 
   /** The local absolute path of the working copy root.  */
   const char *wcroot_abspath;

Modified: subversion/trunk/subversion/libsvn_client/deprecated.c
URL: http://svn.apache.org/viewvc/subversion/trunk/subversion/libsvn_client/deprecated.c?rev=1097219&r1=1097218&r2=1097219&view=diff
==============================================================================
--- subversion/trunk/subversion/libsvn_client/deprecated.c (original)
+++ subversion/trunk/subversion/libsvn_client/deprecated.c Wed Apr 27 19:43:58 2011
@@ -2001,6 +2001,77 @@ svn_client_checkout(svn_revnum_t *result
 
 /*** From info.c ***/
 
+/* Convert an svn_info2_t to an svn_info_t, doing shallow copies of objects. */
+static svn_info_t *
+info_from_info2(const svn_info2_t *info2,
+                apr_pool_t *pool)
+{
+  svn_info_t *info = apr_pcalloc(pool, sizeof(*info));
+
+  info->URL                 = info2->URL;
+  info->rev                 = info2->rev;
+  info->kind                = info2->kind;
+  info->repos_root_URL      = info2->repos_root_URL;
+  info->repos_UUID          = info2->repos_UUID;
+  info->last_changed_rev    = info2->last_changed_rev;
+  info->last_changed_date   = info2->last_changed_date;
+  info->last_changed_author = info2->last_changed_author;
+  info->lock                = info2->lock;
+
+  info->size64              = info2->size;
+  if (((apr_size_t)info->size64) == info->size64)
+    info->size               = (apr_size_t)info->size64;
+  else /* >= 4GB */
+    info->size               = SVN_INFO_SIZE_UNKNOWN;
+
+  if (info2->wc_info)
+    {
+      info->has_wc_info         = TRUE;
+      info->schedule            = info2->wc_info->schedule;
+      info->copyfrom_url        = info2->wc_info->copyfrom_url;
+      info->copyfrom_rev        = info2->wc_info->copyfrom_rev;
+      info->text_time           = info2->wc_info->text_time;
+      info->prop_time           = 0;
+      info->checksum            = info2->wc_info->checksum;
+      info->changelist          = info2->wc_info->changelist;
+      info->depth               = info2->wc_info->depth;
+
+      info->working_size64      = info2->wc_info->working_size;
+      if (((apr_size_t)info->working_size64) == info->working_size64)
+        info->working_size       = (apr_size_t)info->working_size64;
+      else /* >= 4GB */
+        info->working_size       = SVN_INFO_SIZE_UNKNOWN;
+    }
+  else
+    info->has_wc_info           = FALSE;
+
+  /* Populate conflict fields. */
+  if (info2->wc_info && info2->wc_info->conflict)
+    {
+      const svn_wc_conflict_description2_t *conflict
+                                                = info2->wc_info->conflict;
+
+      switch (conflict->kind)
+        {
+          case svn_wc_conflict_kind_tree:
+            info->tree_conflict = svn_wc__cd2_to_cd(conflict, pool);
+            break;
+
+          case svn_wc_conflict_kind_text:
+            info->conflict_old = conflict->base_abspath;
+            info->conflict_new = conflict->my_abspath;
+            info->conflict_wrk = conflict->their_abspath;
+            break;
+
+          case svn_wc_conflict_kind_property:
+            info->prejfile = conflict->their_abspath;
+            break;
+        }
+    }
+
+  return info;
+}
+
 struct info_to_relpath_baton
 {
   const char *anchor_abspath;
@@ -2012,7 +2083,7 @@ struct info_to_relpath_baton
 static svn_error_t *
 info_receiver_relpath_wrapper(void *baton,
                               const char *abspath_or_url,
-                              const svn_info_t *info,
+                              const svn_info2_t *info2,
                               apr_pool_t *scratch_pool)
 {
   struct info_to_relpath_baton *rb = baton;
@@ -2029,7 +2100,7 @@ info_receiver_relpath_wrapper(void *bato
 
   SVN_ERR(rb->info_receiver(rb->info_baton,
                             path,
-                            info,
+                            info_from_info2(info2, scratch_pool),
                             scratch_pool));
 
   return SVN_NO_ERROR;

Modified: subversion/trunk/subversion/libsvn_client/info.c
URL: http://svn.apache.org/viewvc/subversion/trunk/subversion/libsvn_client/info.c?rev=1097219&r1=1097218&r2=1097219&view=diff
==============================================================================
--- subversion/trunk/subversion/libsvn_client/info.c (original)
+++ subversion/trunk/subversion/libsvn_client/info.c Wed Apr 27 19:43:58 2011
@@ -42,7 +42,7 @@
    and (possibly NULL) svn_lock_t LOCK, all allocated in POOL.
    Pointer fields are copied by reference, not dup'd. */
 static svn_error_t *
-build_info_from_dirent(svn_info_t **info,
+build_info_from_dirent(svn_info2_t **info,
                        const svn_dirent_t *dirent,
                        svn_lock_t *lock,
                        const char *URL,
@@ -51,7 +51,7 @@ build_info_from_dirent(svn_info_t **info
                        const char *repos_root,
                        apr_pool_t *pool)
 {
-  svn_info_t *tmpinfo = apr_pcalloc(pool, sizeof(*tmpinfo));
+  svn_info2_t *tmpinfo = apr_pcalloc(pool, sizeof(*tmpinfo));
 
   tmpinfo->URL                  = URL;
   tmpinfo->rev                  = revision;
@@ -62,17 +62,9 @@ build_info_from_dirent(svn_info_t **info
   tmpinfo->last_changed_date    = dirent->time;
   tmpinfo->last_changed_author  = dirent->last_author;
   tmpinfo->lock                 = lock;
-  tmpinfo->depth                = svn_depth_unknown;
-  tmpinfo->working_size         = SVN_INFO_SIZE_UNKNOWN;
+  tmpinfo->size                 = dirent->size;
 
-  if (((apr_size_t)dirent->size) == dirent->size)
-    tmpinfo->size               = (apr_size_t)dirent->size;
-  else /* >= 4GB */
-    tmpinfo->size               = SVN_INFO_SIZE_UNKNOWN;
-
-  tmpinfo->size64               = dirent->size;
-  tmpinfo->working_size64       = SVN_INVALID_FILESIZE;
-  tmpinfo->tree_conflict        = NULL;
+  tmpinfo->wc_info              = NULL;
 
   *info = tmpinfo;
   return SVN_NO_ERROR;
@@ -83,13 +75,13 @@ build_info_from_dirent(svn_info_t **info
    allocated in POOL.  Pointer fields are copied by reference, not
    dup'd.  PATH is the path of the WC node that ENTRY represents. */
 static svn_error_t *
-build_info_for_entry(svn_info_t **info,
+build_info_for_entry(svn_info2_t **info,
                      svn_wc_context_t *wc_ctx,
                      const char *local_abspath,
                      apr_pool_t *result_pool,
                      apr_pool_t *scratch_pool)
 {
-  svn_info_t *tmpinfo;
+  svn_info2_t *tmpinfo;
   svn_boolean_t is_copy_target;
   apr_time_t lock_date;
   svn_node_kind_t kind;
@@ -115,6 +107,12 @@ build_info_for_entry(svn_info_t **info,
   tmpinfo = apr_pcalloc(result_pool, sizeof(*tmpinfo));
   tmpinfo->kind = kind;
 
+  /* ### This is dangerous, though temporary.  Per the docstring, we shouldn't
+     ### be alloc'ing this struct directly, but let libsvn_wc do it.  Nowhere
+     ### in libsvn_wc do we currently alloc this struct, so we do it here.
+     ### All this code will shortly move to libsvn_wc, anyway. */
+  tmpinfo->wc_info = apr_pcalloc(result_pool, sizeof(*tmpinfo->wc_info));
+
   SVN_ERR(svn_wc__node_get_origin(&is_copy, &rev, &repos_relpath,
                                   &tmpinfo->repos_root_URL,
                                   &tmpinfo->repos_UUID,
@@ -161,7 +159,7 @@ build_info_for_entry(svn_info_t **info,
   if (! SVN_IS_VALID_REVNUM(tmpinfo->rev))
     tmpinfo->rev = 0;
 
-  tmpinfo->copyfrom_rev = SVN_INVALID_REVNUM;
+  tmpinfo->wc_info->copyfrom_rev = SVN_INVALID_REVNUM;
 
   if (is_copy)
     {
@@ -172,10 +170,10 @@ build_info_for_entry(svn_info_t **info,
 
       if (is_copy_target)
         {
-          tmpinfo->copyfrom_url = svn_path_url_add_component2(
+          tmpinfo->wc_info->copyfrom_url = svn_path_url_add_component2(
                                                tmpinfo->repos_root_URL,
                                                repos_relpath, result_pool);
-          tmpinfo->copyfrom_rev = rev;
+          tmpinfo->wc_info->copyfrom_rev = rev;
         }
     }
   else if (repos_relpath)
@@ -192,55 +190,40 @@ build_info_for_entry(svn_info_t **info,
     {
       const svn_checksum_t *checksum;
 
-      SVN_ERR(svn_wc__node_get_changelist(&tmpinfo->changelist, wc_ctx,
+      SVN_ERR(svn_wc__node_get_changelist(&tmpinfo->wc_info->changelist, wc_ctx,
                                           local_abspath,
                                           result_pool, scratch_pool));
 
       SVN_ERR(svn_wc__node_get_checksum(&checksum, wc_ctx, local_abspath,
                                         scratch_pool, scratch_pool));
 
-      tmpinfo->checksum = svn_checksum_to_cstring(checksum, result_pool);
+      tmpinfo->wc_info->checksum = svn_checksum_to_cstring(checksum,
+                                                           result_pool);
     }
 
   if (tmpinfo->kind == svn_node_dir)
     {
-      SVN_ERR(svn_wc__node_get_depth(&tmpinfo->depth, wc_ctx,
+      SVN_ERR(svn_wc__node_get_depth(&tmpinfo->wc_info->depth, wc_ctx,
                                      local_abspath, scratch_pool));
 
-      if (tmpinfo->depth == svn_depth_unknown)
-        tmpinfo->depth = svn_depth_infinity;
+      if (tmpinfo->wc_info->depth == svn_depth_unknown)
+        tmpinfo->wc_info->depth = svn_depth_infinity;
     }
   else
-    tmpinfo->depth = svn_depth_infinity;
+    tmpinfo->wc_info->depth = svn_depth_infinity;
 
   if (exclude)
-    tmpinfo->depth = svn_depth_exclude;
+    tmpinfo->wc_info->depth = svn_depth_exclude;
 
-  SVN_ERR(svn_wc__node_get_schedule(&tmpinfo->schedule, NULL,
+  SVN_ERR(svn_wc__node_get_schedule(&tmpinfo->wc_info->schedule, NULL,
                                     wc_ctx, local_abspath, scratch_pool));
 
-  SVN_ERR(svn_wc_get_wc_root(&tmpinfo->wcroot_abspath, wc_ctx,
+  SVN_ERR(svn_wc_get_wc_root(&tmpinfo->wc_info->wcroot_abspath, wc_ctx,
                              local_abspath, result_pool, scratch_pool));
 
-  SVN_ERR(svn_wc__node_get_conflict_info(&tmpinfo->conflict_old,
-                                         &tmpinfo->conflict_new,
-                                         &tmpinfo->conflict_wrk,
-                                         &tmpinfo->prejfile,
-                                         wc_ctx, local_abspath,
-                                         result_pool, scratch_pool));
-
-  /* Some defaults */
-  tmpinfo->has_wc_info          = TRUE;
-  tmpinfo->size                 = SVN_INFO_SIZE_UNKNOWN;
-  tmpinfo->size64               = SVN_INVALID_FILESIZE;
-
-  SVN_ERR(svn_wc__node_get_recorded_info(&tmpinfo->working_size64,
-                                         &tmpinfo->text_time,
+  SVN_ERR(svn_wc__node_get_recorded_info(&tmpinfo->wc_info->working_size,
+                                         &tmpinfo->wc_info->text_time,
                                          wc_ctx, local_abspath, scratch_pool));
-  if (((apr_size_t)tmpinfo->working_size64) == tmpinfo->working_size64)
-    tmpinfo->working_size       = (apr_size_t)tmpinfo->working_size64;
-  else /* >= 4GB */
-    tmpinfo->working_size       = SVN_INFO_SIZE_UNKNOWN;
 
   /* lock stuff */
   if (kind == svn_node_file)
@@ -274,10 +257,11 @@ build_info_for_entry(svn_info_t **info,
 /* ### Some fields we could fill out based on the parent dir's entry
        or by looking at an obstructing item. */
 static svn_error_t *
-build_info_for_unversioned(svn_info_t **info,
+build_info_for_unversioned(svn_info2_t **info,
                            apr_pool_t *pool)
 {
-  svn_info_t *tmpinfo = apr_pcalloc(pool, sizeof(*tmpinfo));
+  svn_info2_t *tmpinfo = apr_pcalloc(pool, sizeof(*tmpinfo));
+  tmpinfo->wc_info = apr_pcalloc(pool, sizeof (*tmpinfo->wc_info));
 
   tmpinfo->URL                  = NULL;
   tmpinfo->rev                  = SVN_INVALID_REVNUM;
@@ -288,11 +272,7 @@ build_info_for_unversioned(svn_info_t **
   tmpinfo->last_changed_date    = 0;
   tmpinfo->last_changed_author  = NULL;
   tmpinfo->lock                 = NULL;
-  tmpinfo->working_size         = SVN_INFO_SIZE_UNKNOWN;
   tmpinfo->size                 = SVN_INFO_SIZE_UNKNOWN;
-  tmpinfo->size64               = SVN_INVALID_FILESIZE;
-  tmpinfo->working_size64       = SVN_INVALID_FILESIZE;
-  tmpinfo->tree_conflict        = NULL;
 
   *info = tmpinfo;
   return SVN_NO_ERROR;
@@ -323,7 +303,7 @@ push_dir_info(svn_ra_session_t *ra_sessi
               svn_revnum_t rev,
               const char *repos_UUID,
               const char *repos_root,
-              svn_info_receiver_t receiver,
+              svn_info_receiver2_t receiver,
               void *receiver_baton,
               svn_depth_t depth,
               svn_client_ctx_t *ctx,
@@ -331,7 +311,6 @@ push_dir_info(svn_ra_session_t *ra_sessi
               apr_pool_t *pool)
 {
   apr_hash_t *tmpdirents;
-  svn_info_t *info;
   apr_hash_index_t *hi;
   apr_pool_t *subpool = svn_pool_create(pool);
 
@@ -342,6 +321,7 @@ push_dir_info(svn_ra_session_t *ra_sessi
     {
       const char *path, *URL, *fs_path;
       svn_lock_t *lock;
+      svn_info2_t *info;
       const char *name = svn__apr_hash_index_key(hi);
       svn_dirent_t *the_ent = svn__apr_hash_index_val(hi);
 
@@ -385,7 +365,7 @@ push_dir_info(svn_ra_session_t *ra_sessi
 /* Callback and baton for crawl_entries() walk over entries files. */
 struct found_entry_baton
 {
-  svn_info_receiver_t receiver;
+  svn_info_receiver2_t receiver;
   void *receiver_baton;
   svn_wc_context_t *wc_ctx;
 };
@@ -398,7 +378,7 @@ info_found_node_callback(const char *loc
                          apr_pool_t *pool)
 {
   struct found_entry_baton *fe_baton = walk_baton;
-  svn_info_t *info = NULL;
+  svn_info2_t *info = NULL;
   const svn_wc_conflict_description2_t *tree_conflict = NULL;
   svn_error_t *err;
 
@@ -424,8 +404,7 @@ info_found_node_callback(const char *loc
 
   SVN_ERR_ASSERT(info != NULL);
 
-  if (tree_conflict)
-    info->tree_conflict = svn_wc__cd2_to_cd(tree_conflict, pool);
+  info->wc_info->conflict = tree_conflict;
   SVN_ERR(fe_baton->receiver(fe_baton->receiver_baton, local_abspath,
                              info, pool));
   return SVN_NO_ERROR;
@@ -437,7 +416,7 @@ info_found_node_callback(const char *loc
    filter the pushed items against CHANGELIST_HASH.  */
 static svn_error_t *
 crawl_entries(const char *local_abspath,
-              svn_info_receiver_t receiver,
+              svn_info_receiver2_t receiver,
               void *receiver_baton,
               svn_depth_t depth,
               const apr_array_header_t *changelists,
@@ -467,11 +446,11 @@ crawl_entries(const char *local_abspath,
 
       if (tree_conflict)
         {
-          svn_info_t *info;
+          svn_info2_t *info;
           svn_error_clear(err);
 
           SVN_ERR(build_info_for_unversioned(&info, pool));
-          info->tree_conflict = svn_wc__cd2_to_cd(tree_conflict, pool);
+          info->wc_info->conflict = tree_conflict;
 
           SVN_ERR(svn_wc__node_get_repos_info(&(info->repos_root_URL),
                                               NULL,
@@ -556,7 +535,7 @@ svn_client_info3(const char *abspath_or_
   apr_hash_t *parent_ents;
   const char *parent_url, *base_name;
   svn_dirent_t *the_ent;
-  svn_info_t *info;
+  svn_info2_t *info;
   svn_error_t *err;
 
   if (depth == svn_depth_unknown)

Modified: subversion/trunk/subversion/svn/info-cmd.c
URL: http://svn.apache.org/viewvc/subversion/trunk/subversion/svn/info-cmd.c?rev=1097219&r1=1097218&r2=1097219&view=diff
==============================================================================
--- subversion/trunk/subversion/svn/info-cmd.c (original)
+++ subversion/trunk/subversion/svn/info-cmd.c Wed Apr 27 19:43:58 2011
@@ -82,7 +82,7 @@ schedule_str(svn_wc_schedule_t schedule)
 static svn_error_t *
 print_info_xml(void *baton,
                const char *target,
-               const svn_info_t *info,
+               const svn_info2_t *info,
                apr_pool_t *pool)
 {
   svn_stringbuf_t *sb = svn_stringbuf_create("", pool);
@@ -121,45 +121,47 @@ print_info_xml(void *baton,
       svn_xml_make_close_tag(&sb, pool, "repository");
     }
 
-  if (info->has_wc_info)
+  if (info->wc_info)
     {
       /* "<wc-info>" */
       svn_xml_make_open_tag(&sb, pool, svn_xml_normal, "wc-info", NULL);
 
       /* "<wcroot-abspath> xx </wcroot-abspath>" */
-      if (info->wcroot_abspath)
+      if (info->wc_info->wcroot_abspath)
         svn_cl__xml_tagged_cdata(&sb, pool, "wcroot-abspath",
-                                 info->wcroot_abspath);
+                                 info->wc_info->wcroot_abspath);
 
       /* "<schedule> xx </schedule>" */
       svn_cl__xml_tagged_cdata(&sb, pool, "schedule",
-                               schedule_str(info->schedule));
+                               schedule_str(info->wc_info->schedule));
 
       /* "<depth> xx </depth>" */
       svn_cl__xml_tagged_cdata(&sb, pool, "depth",
-                               svn_depth_to_word(info->depth));
+                               svn_depth_to_word(info->wc_info->depth));
 
       /* "<copy-from-url> xx </copy-from-url>" */
       svn_cl__xml_tagged_cdata(&sb, pool, "copy-from-url",
-                               info->copyfrom_url);
+                               info->wc_info->copyfrom_url);
 
       /* "<copy-from-rev> xx </copy-from-rev>" */
-      if (SVN_IS_VALID_REVNUM(info->copyfrom_rev))
+      if (SVN_IS_VALID_REVNUM(info->wc_info->copyfrom_rev))
         svn_cl__xml_tagged_cdata(&sb, pool, "copy-from-rev",
                                  apr_psprintf(pool, "%ld",
-                                              info->copyfrom_rev));
+                                              info->wc_info->copyfrom_rev));
 
       /* "<text-updated> xx </text-updated>" */
-      if (info->text_time)
+      if (info->wc_info->text_time)
         svn_cl__xml_tagged_cdata(&sb, pool, "text-updated",
-                                 svn_time_to_cstring(info->text_time, pool));
+                                 svn_time_to_cstring(info->wc_info->text_time,
+                                                     pool));
 
       /* "<checksum> xx </checksum>" */
-      svn_cl__xml_tagged_cdata(&sb, pool, "checksum", info->checksum);
+      svn_cl__xml_tagged_cdata(&sb, pool, "checksum", info->wc_info->checksum);
 
-      if (info->changelist)
+      if (info->wc_info->changelist)
         /* "<changelist> xx </changelist>" */
-        svn_cl__xml_tagged_cdata(&sb, pool, "changelist", info->changelist);
+        svn_cl__xml_tagged_cdata(&sb, pool, "changelist",
+                                 info->wc_info->changelist);
 
       /* "</wc-info>" */
       svn_xml_make_close_tag(&sb, pool, "wc-info");
@@ -176,29 +178,50 @@ print_info_xml(void *baton,
                                pool);
     }
 
-  if (info->conflict_old || info->conflict_wrk
-      || info->conflict_new || info->prejfile)
+  if (info->wc_info->conflict)
     {
-      /* "<conflict>" */
-      svn_xml_make_open_tag(&sb, pool, svn_xml_normal, "conflict", NULL);
+      const svn_wc_conflict_description2_t *conflict = info->wc_info->conflict;
+      /* ### Handle multiple conflicts. */
 
-      /* "<prev-base-file> xx </prev-base-file>" */
-      svn_cl__xml_tagged_cdata(&sb, pool, "prev-base-file",
-                               info->conflict_old);
+      switch (conflict->kind)
+        {
+          case svn_wc_conflict_kind_text:
+            /* "<conflict>" */
+            svn_xml_make_open_tag(&sb, pool, svn_xml_normal, "conflict", NULL);
+
+            /* "<prev-base-file> xx </prev-base-file>" */
+            svn_cl__xml_tagged_cdata(&sb, pool, "prev-base-file",
+                                     conflict->base_abspath);
+
+            /* "<prev-wc-file> xx </prev-wc-file>" */
+            svn_cl__xml_tagged_cdata(&sb, pool, "prev-wc-file",
+                                     conflict->my_abspath);
+
+            /* "<cur-base-file> xx </cur-base-file>" */
+            svn_cl__xml_tagged_cdata(&sb, pool, "cur-base-file",
+                                     conflict->their_abspath);
 
-      /* "<prev-wc-file> xx </prev-wc-file>" */
-      svn_cl__xml_tagged_cdata(&sb, pool, "prev-wc-file",
-                               info->conflict_wrk);
+            /* "</conflict>" */
+            svn_xml_make_close_tag(&sb, pool, "conflict");
+          break;
+
+          case svn_wc_conflict_kind_property:
+            /* "<conflict>" */
+            svn_xml_make_open_tag(&sb, pool, svn_xml_normal, "conflict", NULL);
 
-      /* "<cur-base-file> xx </cur-base-file>" */
-      svn_cl__xml_tagged_cdata(&sb, pool, "cur-base-file",
-                               info->conflict_new);
+            /* "<prop-file> xx </prop-file>" */
+            svn_cl__xml_tagged_cdata(&sb, pool, "prop-file",
+                                     conflict->their_abspath);
 
-      /* "<prop-file> xx </prop-file>" */
-      svn_cl__xml_tagged_cdata(&sb, pool, "prop-file", info->prejfile);
+            /* "</conflict>" */
+            svn_xml_make_close_tag(&sb, pool, "conflict");
+          break;
 
-      /* "</conflict>" */
-      svn_xml_make_close_tag(&sb, pool, "conflict");
+          case svn_wc_conflict_kind_tree:
+            SVN_ERR(svn_cl__append_tree_conflict_info_xml(sb, conflict,
+                                                          pool));
+          break;
+        }
     }
 
   if (info->lock)
@@ -229,12 +252,6 @@ print_info_xml(void *baton,
       svn_xml_make_close_tag(&sb, pool, "lock");
     }
 
-  if (info->tree_conflict)
-    SVN_ERR(svn_cl__append_tree_conflict_info_xml(sb,
-                                                  svn_cl__cd_to_cd2(
-                                                    info->tree_conflict, pool),
-                                                  pool));
-
   /* "</entry>" */
   svn_xml_make_close_tag(&sb, pool, "entry");
 
@@ -246,7 +263,7 @@ print_info_xml(void *baton,
 static svn_error_t *
 print_info(void *baton,
            const char *target,
-           const svn_info_t *info,
+           const svn_info2_t *info,
            apr_pool_t *pool)
 {
   const char *path_prefix = baton;
@@ -263,10 +280,11 @@ print_info(void *baton,
     SVN_ERR(svn_cmdline_printf(pool, _("Name: %s\n"),
                                svn_dirent_basename(target, pool)));
 
-  if (info->wcroot_abspath)
+  if (info->wc_info && info->wc_info->wcroot_abspath)
     SVN_ERR(svn_cmdline_printf(pool, _("Working Copy Root Path: %s\n"),
-                               svn_dirent_local_style(info->wcroot_abspath,
-                                                      pool)));
+                               svn_dirent_local_style(
+                                            info->wc_info->wcroot_abspath,
+                                            pool)));
 
   if (info->URL)
     SVN_ERR(svn_cmdline_printf(pool, _("URL: %s\n"), info->URL));
@@ -302,9 +320,9 @@ print_info(void *baton,
       break;
     }
 
-  if (info->has_wc_info)
+  if (info->wc_info)
     {
-      switch (info->schedule)
+      switch (info->wc_info->schedule)
         {
         case svn_wc_schedule_normal:
           SVN_ERR(svn_cmdline_printf(pool, _("Schedule: normal\n")));
@@ -326,7 +344,7 @@ print_info(void *baton,
           break;
         }
 
-      switch (info->depth)
+      switch (info->wc_info->depth)
         {
         case svn_depth_unknown:
           /* Unknown depth is the norm for remote directories anyway
@@ -361,13 +379,13 @@ print_info(void *baton,
           SVN_ERR(svn_cmdline_printf(pool, _("Depth: INVALID\n")));
         }
 
-      if (info->copyfrom_url)
+      if (info->wc_info->copyfrom_url)
         SVN_ERR(svn_cmdline_printf(pool, _("Copied From URL: %s\n"),
-                                   info->copyfrom_url));
+                                   info->wc_info->copyfrom_url));
 
-      if (SVN_IS_VALID_REVNUM(info->copyfrom_rev))
+      if (SVN_IS_VALID_REVNUM(info->wc_info->copyfrom_rev))
         SVN_ERR(svn_cmdline_printf(pool, _("Copied From Rev: %ld\n"),
-                                   info->copyfrom_rev));
+                                   info->wc_info->copyfrom_rev));
     }
 
   if (info->last_changed_author)
@@ -382,37 +400,53 @@ print_info(void *baton,
     SVN_ERR(svn_cl__info_print_time(info->last_changed_date,
                                     _("Last Changed Date"), pool));
 
-  if (info->has_wc_info)
+  if (info->wc_info)
     {
-      if (info->text_time)
-        SVN_ERR(svn_cl__info_print_time(info->text_time,
+      if (info->wc_info->text_time)
+        SVN_ERR(svn_cl__info_print_time(info->wc_info->text_time,
                                         _("Text Last Updated"), pool));
 
-      if (info->checksum)
+      if (info->wc_info->checksum)
         SVN_ERR(svn_cmdline_printf(pool, _("Checksum: %s\n"),
-                                   info->checksum));
+                                   info->wc_info->checksum));
+
+      if (info->wc_info->conflict)
+        {
+          const svn_wc_conflict_description2_t *conflict =
+                                                    info->wc_info->conflict;
 
-      if (info->conflict_old)
-        SVN_ERR(svn_cmdline_printf(pool,
-                                   _("Conflict Previous Base File: %s\n"),
-                                   svn_dirent_local_style(info->conflict_old,
-                                                          pool)));
-
-      if (info->conflict_wrk)
-        SVN_ERR(svn_cmdline_printf
-                (pool, _("Conflict Previous Working File: %s\n"),
-                 svn_dirent_local_style(info->conflict_wrk, pool)));
-
-      if (info->conflict_new)
-        SVN_ERR(svn_cmdline_printf(pool,
-                                   _("Conflict Current Base File: %s\n"),
-                                   svn_dirent_local_style(info->conflict_new,
-                                                          pool)));
-
-      if (info->prejfile)
-        SVN_ERR(svn_cmdline_printf(pool, _("Conflict Properties File: %s\n"),
-                                   svn_dirent_local_style(info->prejfile,
-                                                          pool)));
+          switch (conflict->kind)
+            {
+              case svn_wc_conflict_kind_text:
+                SVN_ERR(svn_cmdline_printf(pool,
+                              _("Conflict Previous Base File: %s\n"),
+                              svn_dirent_local_style(conflict->base_abspath,
+                                                     pool)));
+
+                SVN_ERR(svn_cmdline_printf(pool,
+                              _("Conflict Previous Working File: %s\n"),
+                              svn_dirent_local_style(conflict->my_abspath,
+                                                     pool)));
+
+                SVN_ERR(svn_cmdline_printf(pool,
+                              _("Conflict Current Base File: %s\n"),
+                              svn_dirent_local_style(conflict->their_abspath,
+                                                     pool)));
+              break;
+
+              case svn_wc_conflict_kind_property:
+                SVN_ERR(svn_cmdline_printf(pool,
+                              _("Conflict Properties File: %s\n"),
+                              svn_dirent_local_style(conflict->their_abspath,
+                                                     pool)));
+              break;
+
+              case svn_wc_conflict_kind_tree:
+                /* Tree conflicts are handled farther down. */
+                /* ### Could they be handled here? */
+              break;
+            }
+        }
     }
 
   if (info->lock)
@@ -447,25 +481,27 @@ print_info(void *baton,
         }
     }
 
-  if (info->changelist)
+  if (info->wc_info && info->wc_info->changelist)
     SVN_ERR(svn_cmdline_printf(pool, _("Changelist: %s\n"),
-                               info->changelist));
+                               info->wc_info->changelist));
 
-  if (info->tree_conflict)
+  if (info->wc_info && info->wc_info->conflict
+        && info->wc_info->conflict->kind == svn_wc_conflict_kind_tree)
     {
+      const svn_wc_conflict_description2_t *conflict = info->wc_info->conflict;
       const char *desc;
       const char *src_left_version;
       const char *src_right_version;
 
       SVN_ERR(svn_cl__get_human_readable_tree_conflict_description(
-                &desc, svn_cl__cd_to_cd2(info->tree_conflict, pool), pool));
+                &desc, conflict, pool));
 
       src_left_version =
-        svn_cl__node_description(info->tree_conflict->src_left_version,
+        svn_cl__node_description(conflict->src_left_version,
                                  info->repos_root_URL, pool);
 
       src_right_version =
-        svn_cl__node_description(info->tree_conflict->src_right_version,
+        svn_cl__node_description(conflict->src_right_version,
                                  info->repos_root_URL, pool);
 
       SVN_ERR(svn_cmdline_printf(pool, "%s: %s\n", _("Tree conflict"), desc));
@@ -502,7 +538,7 @@ svn_cl__info(apr_getopt_t *os,
   svn_error_t *err;
   svn_boolean_t seen_nonexistent_target = FALSE;
   svn_opt_revision_t peg_revision;
-  svn_info_receiver_t receiver;
+  svn_info_receiver2_t receiver;
   const char *path_prefix;
 
   SVN_ERR(svn_cl__args_to_target_array_print_reserved(&targets, os,



Re: svn commit: r1097219 - in /subversion/trunk/subversion: include/svn_client.h include/svn_types.h include/svn_wc.h libsvn_client/deprecated.c libsvn_client/info.c svn/info-cmd.c

Posted by Greg Stein <gs...@gmail.com>.
On Wed, Apr 27, 2011 at 15:43,  <hw...@apache.org> wrote:
>...
> +++ subversion/trunk/subversion/include/svn_wc.h Wed Apr 27 19:43:58 2011
> @@ -3020,10 +3020,10 @@ typedef struct svn_wc_info_t
>    * representation, or #SVN_INVALID_FILESIZE if unknown.
>    * Not applicable for directories.
>    */
> -  svn_filesize_t working_size64;
> +  svn_filesize_t working_size;

Can we renamed this to recorded_size, and its companion to
recorded_mod_time? I believe these two names better reflect the
semantics of these fields.

(unless the file is always stat'd before filling in this field...
which I don't think it does?)

>...
> +++ subversion/trunk/subversion/libsvn_client/info.c Wed Apr 27 19:43:58 2011
>...
> @@ -274,10 +257,11 @@ build_info_for_entry(svn_info_t **info,
>  /* ### Some fields we could fill out based on the parent dir's entry
>        or by looking at an obstructing item. */
>  static svn_error_t *
> -build_info_for_unversioned(svn_info_t **info,
> +build_info_for_unversioned(svn_info2_t **info,
>                            apr_pool_t *pool)
>  {
> -  svn_info_t *tmpinfo = apr_pcalloc(pool, sizeof(*tmpinfo));
> +  svn_info2_t *tmpinfo = apr_pcalloc(pool, sizeof(*tmpinfo));
> +  tmpinfo->wc_info = apr_pcalloc(pool, sizeof (*tmpinfo->wc_info));

You didn't include the same warning comment here :-P

>...
> @@ -288,11 +272,7 @@ build_info_for_unversioned(svn_info_t **
>   tmpinfo->last_changed_date    = 0;
>   tmpinfo->last_changed_author  = NULL;
>   tmpinfo->lock                 = NULL;
> -  tmpinfo->working_size         = SVN_INFO_SIZE_UNKNOWN;
>   tmpinfo->size                 = SVN_INFO_SIZE_UNKNOWN;

This is incorrect. It should be SVN_INVALID_FILESIZE.

The new code should never use SVN_INFO_SIZE_UNKNOWN. That is a bogus,
deprecated constant for the old incorrect "size" field which was only
an apr_size_t. I saw you moved the constant recently. You may want to
mark it deprecated (and why).

>...

Cheers,
-g