Author: julianfoad
Date: Wed Apr  4 08:26:15 2012
New Revision: 1309283

URL: http://svn.apache.org/viewvc?rev=1309283&view=rev
Log:
Convert svn_client__wc_node_get_origin() to use svn_client__pathrev_t for
its output.

* subversion/include/private/svn_client_private.h,
  subversion/libsvn_client/util.c
  (svn_client__wc_node_get_origin): Use pathrev_t for the output.

* subversion/libsvn_client/commit_util.c
  (harvest_committables): Adjust accordingly.

* subversion/libsvn_client/copy.c
  (calculate_target_mergeinfo): Adjust accordingly.

* subversion/libsvn_client/merge.c
  (get_full_mergeinfo, open_target_wc): Adjust accordingly.

* subversion/libsvn_client/mergeinfo.c
  (get_mergeinfo): Adjust accordingly.

Modified:
    subversion/trunk/subversion/include/private/svn_client_private.h
    subversion/trunk/subversion/libsvn_client/commit_util.c
    subversion/trunk/subversion/libsvn_client/copy.c
    subversion/trunk/subversion/libsvn_client/merge.c
    subversion/trunk/subversion/libsvn_client/mergeinfo.c
    subversion/trunk/subversion/libsvn_client/util.c

Modified: subversion/trunk/subversion/include/private/svn_client_private.h
URL: 
http://svn.apache.org/viewvc/subversion/trunk/subversion/include/private/svn_client_private.h?rev=1309283&r1=1309282&r2=1309283&view=diff
==============================================================================
--- subversion/trunk/subversion/include/private/svn_client_private.h (original)
+++ subversion/trunk/subversion/include/private/svn_client_private.h Wed Apr  4 
08:26:15 2012
@@ -132,19 +132,14 @@ svn_client__youngest_common_ancestor(con
                                      apr_pool_t *result_pool,
                                      apr_pool_t *scratch_pool);
 
-/* Set *REPOS_ROOT_URL_P, *REPOS_UUID_P, *REV and *URL to the origin of the
- * WC node at WC_ABSPATH.  If the node is a local copy, give the copy-from
- * location.  If the node is locally added or deleted, set *REV and *URL
- * to SVN_INVALID_REVNUM and NULL respectively, but still give the correct
- * repository root URL and UUID.
- *
- * Any outputs may be NULL if not wanted.
+/* Set *ORIGIN_P to the origin of the WC node at WC_ABSPATH.  If the node
+ * is a local copy, give the copy-from location.  If the node is locally
+ * added or deleted, set the REV and URL fields to SVN_INVALID_REVNUM and
+ * NULL respectively, but still give the correct repository root URL and
+ * UUID.
  */
 svn_error_t *
-svn_client__wc_node_get_origin(const char **repos_root_url_p,
-                               const char **repos_uuid_p,
-                               svn_revnum_t *rev_p,
-                               const char **url_p,
+svn_client__wc_node_get_origin(svn_client__pathrev_t **origin_p,
                                const char *wc_abspath,
                                svn_client_ctx_t *ctx,
                                apr_pool_t *result_pool,

Modified: subversion/trunk/subversion/libsvn_client/commit_util.c
URL: 
http://svn.apache.org/viewvc/subversion/trunk/subversion/libsvn_client/commit_util.c?rev=1309283&r1=1309282&r2=1309283&view=diff
==============================================================================
--- subversion/trunk/subversion/libsvn_client/commit_util.c (original)
+++ subversion/trunk/subversion/libsvn_client/commit_util.c Wed Apr  4 08:26:15 
2012
@@ -628,21 +628,20 @@ harvest_committables(const char *local_a
       /* We should check if we should really add a delete operation */
       if (check_url_func)
         {
-          svn_revnum_t revision;
+          svn_client__pathrev_t *origin;
           const char *repos_url;
           svn_node_kind_t kind;
 
           /* Determine from what parent we would be the deleted child */
           SVN_ERR(svn_client__wc_node_get_origin(
-                    NULL, NULL, &revision, &repos_url,
-                    svn_dirent_dirname(local_abspath, scratch_pool),
+                    &origin, svn_dirent_dirname(local_abspath, scratch_pool),
                     ctx, scratch_pool, scratch_pool));
 
           repos_url = svn_path_url_add_component2(
-                        repos_url, svn_dirent_basename(local_abspath, NULL),
+                        origin->url, svn_dirent_basename(local_abspath, NULL),
                         scratch_pool);
 
-          SVN_ERR(check_url_func(check_url_baton, &kind, repos_url, revision,
+          SVN_ERR(check_url_func(check_url_baton, &kind, repos_url, 
origin->rev,
                                  scratch_pool));
 
           if (kind == svn_node_none)

Modified: subversion/trunk/subversion/libsvn_client/copy.c
URL: 
http://svn.apache.org/viewvc/subversion/trunk/subversion/libsvn_client/copy.c?rev=1309283&r1=1309282&r2=1309283&view=diff
==============================================================================
--- subversion/trunk/subversion/libsvn_client/copy.c (original)
+++ subversion/trunk/subversion/libsvn_client/copy.c Wed Apr  4 08:26:15 2012
@@ -93,12 +93,15 @@ calculate_target_mergeinfo(svn_ra_sessio
      bother checking. */
   if (local_abspath)
     {
+      svn_client__pathrev_t *origin;
+
       SVN_ERR_ASSERT(svn_dirent_is_absolute(local_abspath));
 
-      SVN_ERR(svn_client__wc_node_get_origin(NULL, NULL,
-                                             &src_revnum, &src_url,
+      SVN_ERR(svn_client__wc_node_get_origin(&origin,
                                              local_abspath, ctx,
                                              pool, pool));
+      src_revnum = origin->rev;
+      src_url = origin->url;
 
       if (! src_url)
         locally_added = TRUE;

Modified: subversion/trunk/subversion/libsvn_client/merge.c
URL: 
http://svn.apache.org/viewvc/subversion/trunk/subversion/libsvn_client/merge.c?rev=1309283&r1=1309282&r2=1309283&view=diff
==============================================================================
--- subversion/trunk/subversion/libsvn_client/merge.c (original)
+++ subversion/trunk/subversion/libsvn_client/merge.c Wed Apr  4 08:26:15 2012
@@ -3518,8 +3518,7 @@ get_full_mergeinfo(svn_mergeinfo_t *reco
 
   if (implicit_mergeinfo)
     {
-      svn_revnum_t target_rev;
-      const char *target_url;
+      svn_client__pathrev_t *target;
 
       /* Assert that we have sane input. */
       SVN_ERR_ASSERT(SVN_IS_VALID_REVNUM(start) && SVN_IS_VALID_REVNUM(end)
@@ -3527,18 +3526,16 @@ get_full_mergeinfo(svn_mergeinfo_t *reco
 
       /* Retrieve the origin (original_*) of the node, or just the
          url if the node was not copied. */
-      SVN_ERR(svn_client__wc_node_get_origin(NULL, NULL,
-                                             &target_rev, &target_url,
-                                             target_abspath, ctx,
+      SVN_ERR(svn_client__wc_node_get_origin(&target, target_abspath, ctx,
                                              scratch_pool, scratch_pool));
 
-      if (! target_url)
+      if (! target->url)
         {
           /* We've been asked to operate on a locally added target, so its
            * implicit mergeinfo is empty. */
           *implicit_mergeinfo = apr_hash_make(result_pool);
         }
-      else if (target_rev <= end)
+      else if (target->rev <= end)
         {
           /* We're asking about a range outside our natural history
              altogether.  That means our implicit mergeinfo is empty. */
@@ -3553,13 +3550,13 @@ get_full_mergeinfo(svn_mergeinfo_t *reco
              TARGET_ABSPATH might not even exist, and even if it does the
              working copy is *at* TARGET_REV so its implicit history ends
              at TARGET_REV! */
-          if (target_rev < start)
-            start = target_rev;
+          if (target->rev < start)
+            start = target->rev;
 
           /* Fetch the implicit mergeinfo. */
           SVN_ERR(svn_client__get_history_as_mergeinfo(implicit_mergeinfo,
                                                        NULL,
-                                                       target_url, target_rev,
+                                                       target->url, 
target->rev,
                                                        start, end,
                                                        ra_session, ctx,
                                                        result_pool));
@@ -9294,17 +9291,15 @@ open_target_wc(merge_target_t **target_p
                apr_pool_t *scratch_pool)
 {
   merge_target_t *target = apr_palloc(result_pool, sizeof(*target));
+  svn_client__pathrev_t *origin;
 
   target->abspath = apr_pstrdup(result_pool, wc_abspath);
 
   SVN_ERR(svn_wc_read_kind(&target->kind, ctx->wc_ctx, wc_abspath, FALSE,
                            scratch_pool));
-
-  SVN_ERR(svn_client__wc_node_get_origin(&target->loc.repos_root_url,
-                                         &target->loc.repos_uuid,
-                                         &target->loc.rev, &target->loc.url,
-                                         wc_abspath, ctx,
+  SVN_ERR(svn_client__wc_node_get_origin(&origin, wc_abspath, ctx,
                                          result_pool, scratch_pool));
+  target->loc = *origin;
 
   SVN_ERR(ensure_wc_is_suitable_merge_target(
             wc_abspath, ctx,

Modified: subversion/trunk/subversion/libsvn_client/mergeinfo.c
URL: 
http://svn.apache.org/viewvc/subversion/trunk/subversion/libsvn_client/mergeinfo.c?rev=1309283&r1=1309282&r2=1309283&view=diff
==============================================================================
--- subversion/trunk/subversion/libsvn_client/mergeinfo.c (original)
+++ subversion/trunk/subversion/libsvn_client/mergeinfo.c Wed Apr  4 08:26:15 
2012
@@ -1064,16 +1064,15 @@ get_mergeinfo(svn_mergeinfo_catalog_t *m
      contact the repository for the requested PEG_REVISION. */
   if (!use_url)
     {
-      const char *origin_url = NULL;
+      svn_client__pathrev_t *origin;
       SVN_ERR(svn_dirent_get_absolute(&local_abspath, path_or_url,
                                       scratch_pool));
 
-      SVN_ERR(svn_client__wc_node_get_origin(NULL, NULL, &rev, &origin_url,
-                                             local_abspath, ctx,
+      SVN_ERR(svn_client__wc_node_get_origin(&origin, local_abspath, ctx,
                                              scratch_pool, scratch_pool));
-
-      if (!origin_url
-          || strcmp(origin_url, url) != 0
+      rev = origin->rev;
+      if (!origin->url
+          || strcmp(origin->url, url) != 0
           || peg_rev != rev)
       {
         use_url = TRUE; /* Don't rely on local mergeinfo */

Modified: subversion/trunk/subversion/libsvn_client/util.c
URL: 
http://svn.apache.org/viewvc/subversion/trunk/subversion/libsvn_client/util.c?rev=1309283&r1=1309282&r2=1309283&view=diff
==============================================================================
--- subversion/trunk/subversion/libsvn_client/util.c (original)
+++ subversion/trunk/subversion/libsvn_client/util.c Wed Apr  4 08:26:15 2012
@@ -202,26 +202,28 @@ svn_client__path_relative_to_root(const 
 }
 
 svn_error_t *
-svn_client__wc_node_get_origin(const char **repos_root_url_p,
-                               const char **repos_uuid_p,
-                               svn_revnum_t *rev_p,
-                               const char **url_p,
+svn_client__wc_node_get_origin(svn_client__pathrev_t **origin_p,
                                const char *wc_abspath,
                                svn_client_ctx_t *ctx,
                                apr_pool_t *result_pool,
                                apr_pool_t *scratch_pool)
 {
-  const char *repos_root_url, *relpath;
+  const char *relpath;
 
-  SVN_ERR(svn_wc__node_get_origin(NULL /* is_copy */, rev_p, &relpath,
-                                  &repos_root_url, repos_uuid_p,
+  *origin_p = apr_palloc(result_pool, sizeof(**origin_p));
+
+  SVN_ERR(svn_wc__node_get_origin(NULL /* is_copy */,
+                                  &(*origin_p)->rev,
+                                  &relpath,
+                                  &(*origin_p)->repos_root_url,
+                                  &(*origin_p)->repos_uuid,
                                   NULL, ctx->wc_ctx, wc_abspath,
                                   FALSE /* scan_deleted */,
                                   result_pool, scratch_pool));
-  if (repos_root_url && relpath)
+  if ((*origin_p)->repos_root_url && relpath)
     {
-      *url_p = svn_path_url_add_component2(repos_root_url, relpath,
-                                           result_pool);
+      (*origin_p)->url = svn_path_url_add_component2(
+                           (*origin_p)->repos_root_url, relpath, result_pool);
     }
   else
     {
@@ -231,17 +233,16 @@ svn_client__wc_node_get_origin(const cha
        * If it's locally added or deleted, find the repository root
        * URL and UUID anyway, and leave the node URL and revision as NULL
        * and INVALID.  If it's unversioned, this will throw an error. */
-      *url_p = NULL;
-      SVN_ERR(svn_wc__node_get_repos_info(&repos_root_url, repos_uuid_p,
+      SVN_ERR(svn_wc__node_get_repos_info(&(*origin_p)->repos_root_url,
+                                          &(*origin_p)->repos_uuid,
                                           ctx->wc_ctx, wc_abspath,
                                           result_pool, scratch_pool));
+      (*origin_p)->rev = SVN_INVALID_REVNUM;
+      (*origin_p)->url = NULL;
     }
 
-  if (repos_root_url_p)
-    *repos_root_url_p = repos_root_url;
-
-  SVN_ERR_ASSERT(!repos_root_url_p || *repos_root_url_p);
-  SVN_ERR_ASSERT(!repos_uuid_p || *repos_uuid_p);
+  SVN_ERR_ASSERT((*origin_p)->repos_root_url);
+  SVN_ERR_ASSERT((*origin_p)->repos_uuid);
   return SVN_NO_ERROR;
 }
 


Reply via email to