subversion-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From julianf...@apache.org
Subject svn commit: r1203747 - in /subversion/trunk/subversion/libsvn_client: merge.c mergeinfo.c mergeinfo.h
Date Fri, 18 Nov 2011 17:04:28 GMT
Author: julianfoad
Date: Fri Nov 18 17:04:28 2011
New Revision: 1203747

URL: http://svn.apache.org/viewvc?rev=1203747&view=rev
Log:
Make some function outputs optional to save most callers from having to
supply a variable which is then ignored.

* subversion/libsvn_client/merge.c
  (get_full_mergeinfo): Make the 'inherited' output optional.
  (update_wc_mergeinfo, get_mergeinfo_paths,
   process_children_with_new_mergeinfo,
   record_mergeinfo_for_added_subtrees): Adjust calls and remove ignored
    variables.

* subversion/libsvn_client/mergeinfo.c
  (svn_client__get_wc_mergeinfo,
   svn_client__get_wc_mergeinfo_catalog,
   svn_client__get_wc_or_repos_mergeinfo_catalog): Make the 'inherited'
    output optional.
  (svn_client__elide_mergeinfo): Adjust calls.
  (get_mergeinfo): Adjust calls and remove ignored variables.

* subversion/libsvn_client/mergeinfo.h
  (svn_client__get_wc_mergeinfo, svn_client__get_wc_or_repos_mergeinfo):
    Document the 'inherited' output as optional. (The latter didn't need an
    implementation change in itself. The '_catalog' variants are documented
    in terms of these ones and so don't need a doc change.)

Modified:
    subversion/trunk/subversion/libsvn_client/merge.c
    subversion/trunk/subversion/libsvn_client/mergeinfo.c
    subversion/trunk/subversion/libsvn_client/mergeinfo.h

Modified: subversion/trunk/subversion/libsvn_client/merge.c
URL: http://svn.apache.org/viewvc/subversion/trunk/subversion/libsvn_client/merge.c?rev=1203747&r1=1203746&r2=1203747&view=diff
==============================================================================
--- subversion/trunk/subversion/libsvn_client/merge.c (original)
+++ subversion/trunk/subversion/libsvn_client/merge.c Fri Nov 18 17:04:28 2011
@@ -3429,18 +3429,15 @@ get_full_mergeinfo(svn_mergeinfo_t *reco
   /* First, we get the real mergeinfo. */
   if (recorded_mergeinfo)
     {
-      svn_boolean_t inherited_mergeinfo;
       svn_boolean_t inherited_from_repos;
 
       SVN_ERR(svn_client__get_wc_or_repos_mergeinfo(recorded_mergeinfo,
-                                                    &inherited_mergeinfo,
+                                                    inherited,
                                                     &inherited_from_repos,
                                                     FALSE,
                                                     inherit, ra_session,
                                                     target_abspath,
                                                     ctx, result_pool));
-      if (inherited)
-        *inherited = inherited_mergeinfo;
     }
 
   if (implicit_mergeinfo)
@@ -4581,8 +4578,7 @@ update_wc_mergeinfo(svn_mergeinfo_catalo
          mergeinfo that path inherits. */
       if (mergeinfo == NULL && ranges->nelts == 0)
         {
-          svn_boolean_t inherited;
-          SVN_ERR(svn_client__get_wc_mergeinfo(&mergeinfo, &inherited,
+          SVN_ERR(svn_client__get_wc_mergeinfo(&mergeinfo, NULL,
                                                svn_mergeinfo_nearest_ancestor,
                                                local_abspath, NULL, NULL,
                                                FALSE, ctx, iterpool, iterpool));
@@ -6029,11 +6025,10 @@ get_mergeinfo_paths(apr_array_header_t *
                   if (!merge_cmd_baton->dry_run
                       && merge_cmd_baton->same_repos)
                     {
-                      svn_boolean_t inherited;
                       svn_mergeinfo_t mergeinfo;
 
                       SVN_ERR(svn_client__get_wc_mergeinfo(
-                        &mergeinfo, &inherited,
+                        &mergeinfo, NULL,
                         svn_mergeinfo_nearest_ancestor,
                         child_of_noninheritable->abspath,
                         merge_cmd_baton->target_abspath, NULL, FALSE,
@@ -7059,7 +7054,6 @@ process_children_with_new_mergeinfo(merg
       const char *path_url;
       svn_mergeinfo_t path_inherited_mergeinfo;
       svn_mergeinfo_t path_explicit_mergeinfo;
-      svn_boolean_t inherited;
       svn_client__merge_path_t *new_child;
 
       apr_pool_clear(iterpool);
@@ -7068,8 +7062,7 @@ process_children_with_new_mergeinfo(merg
                                    pool, pool));
 
       /* Get the path's new explicit mergeinfo... */
-      SVN_ERR(svn_client__get_wc_mergeinfo(&path_explicit_mergeinfo,
-                                           &inherited,
+      SVN_ERR(svn_client__get_wc_mergeinfo(&path_explicit_mergeinfo, NULL,
                                            svn_mergeinfo_explicit,
                                            abspath_with_new_mergeinfo,
                                            NULL, NULL, FALSE,
@@ -7089,7 +7082,7 @@ process_children_with_new_mergeinfo(merg
              the merge. */
           SVN_ERR(svn_client__get_wc_or_repos_mergeinfo(
             &path_inherited_mergeinfo,
-            &inherited, NULL,
+            NULL, NULL,
             FALSE,
             svn_mergeinfo_nearest_ancestor, /* We only want inherited MI */
             merge_b->ra_session2,
@@ -7767,13 +7760,12 @@ record_mergeinfo_for_added_subtrees(
       const char *dir_abspath;
       svn_mergeinfo_t parent_mergeinfo;
       svn_mergeinfo_t added_path_mergeinfo;
-      svn_boolean_t inherited; /* used multiple times, but ignored */
 
       apr_pool_clear(iterpool);
       dir_abspath = svn_dirent_dirname(added_abspath, iterpool);
 
       /* Grab the added path's explicit mergeinfo. */
-      SVN_ERR(svn_client__get_wc_mergeinfo(&added_path_mergeinfo, &inherited,
+      SVN_ERR(svn_client__get_wc_mergeinfo(&added_path_mergeinfo, NULL,
                                            svn_mergeinfo_explicit,
                                            added_abspath, NULL, NULL, FALSE,
                                            merge_b->ctx, iterpool, iterpool));
@@ -7781,7 +7773,7 @@ record_mergeinfo_for_added_subtrees(
       /* If the added path doesn't have explicit mergeinfo, does its immediate
          parent have non-inheritable mergeinfo? */
       if (!added_path_mergeinfo)
-        SVN_ERR(svn_client__get_wc_mergeinfo(&parent_mergeinfo, &inherited,
+        SVN_ERR(svn_client__get_wc_mergeinfo(&parent_mergeinfo, NULL,
                                              svn_mergeinfo_explicit,
                                              dir_abspath, NULL, NULL, FALSE,
                                              merge_b->ctx,

Modified: subversion/trunk/subversion/libsvn_client/mergeinfo.c
URL: http://svn.apache.org/viewvc/subversion/trunk/subversion/libsvn_client/mergeinfo.c?rev=1203747&r1=1203746&r2=1203747&view=diff
==============================================================================
--- subversion/trunk/subversion/libsvn_client/mergeinfo.c (original)
+++ subversion/trunk/subversion/libsvn_client/mergeinfo.c Fri Nov 18 17:04:28 2011
@@ -153,7 +153,7 @@ svn_client__record_wc_mergeinfo(const ch
 
 svn_error_t *
 svn_client__get_wc_mergeinfo(svn_mergeinfo_t *mergeinfo,
-                             svn_boolean_t *inherited,
+                             svn_boolean_t *inherited_p,
                              svn_mergeinfo_inheritance_t inherit,
                              const char *local_abspath,
                              const char *limit_abspath,
@@ -167,6 +167,7 @@ svn_client__get_wc_mergeinfo(svn_mergein
   svn_mergeinfo_t wc_mergeinfo;
   svn_revnum_t base_revision;
   apr_pool_t *iterpool;
+  svn_boolean_t inherited;
 
   SVN_ERR_ASSERT(svn_dirent_is_absolute(local_abspath));
   if (limit_abspath)
@@ -269,7 +270,7 @@ svn_client__get_wc_mergeinfo(svn_mergein
   if (svn_path_is_empty(walk_relpath))
     {
       /* Mergeinfo is explicit. */
-      *inherited = FALSE;
+      inherited = FALSE;
       *mergeinfo = wc_mergeinfo;
     }
   else
@@ -277,7 +278,7 @@ svn_client__get_wc_mergeinfo(svn_mergein
       /* Mergeinfo may be inherited. */
       if (wc_mergeinfo)
         {
-          *inherited = TRUE;
+          inherited = TRUE;
           SVN_ERR(svn_mergeinfo__add_suffix_to_mergeinfo(mergeinfo,
                                                          wc_mergeinfo,
                                                          walk_relpath,
@@ -286,7 +287,7 @@ svn_client__get_wc_mergeinfo(svn_mergein
         }
       else
         {
-          *inherited = FALSE;
+          inherited = FALSE;
           *mergeinfo = NULL;
         }
     }
@@ -296,7 +297,7 @@ svn_client__get_wc_mergeinfo(svn_mergein
 
   /* Remove non-inheritable mergeinfo and paths mapped to empty ranges
      which may occur if WCPATH's mergeinfo is not explicit. */
-  if (*inherited
+  if (inherited
       && apr_hash_count(*mergeinfo)) /* Nothing to do for empty mergeinfo. */
     {
       SVN_ERR(svn_mergeinfo_inheritable2(mergeinfo, *mergeinfo, NULL,
@@ -305,6 +306,9 @@ svn_client__get_wc_mergeinfo(svn_mergein
       svn_mergeinfo__remove_empty_rangelists(*mergeinfo, result_pool);
     }
 
+  if (inherited_p)
+    *inherited_p = inherited;
+
   return SVN_NO_ERROR;
 }
 
@@ -335,7 +339,8 @@ svn_client__get_wc_mergeinfo_catalog(svn
     {
       if (walked_path)
         *walked_path = "";
-      *inherited = FALSE;
+      if (inherited)
+        *inherited = FALSE;
       return SVN_NO_ERROR;
     }
 
@@ -545,7 +550,7 @@ svn_client__get_wc_or_repos_mergeinfo(sv
 svn_error_t *
 svn_client__get_wc_or_repos_mergeinfo_catalog(
   svn_mergeinfo_catalog_t *target_mergeinfo_catalog,
-  svn_boolean_t *inherited,
+  svn_boolean_t *inherited_p,
   svn_boolean_t *from_repos,
   svn_boolean_t include_descendants,
   svn_boolean_t repos_only,
@@ -587,8 +592,9 @@ svn_client__get_wc_or_repos_mergeinfo_ca
 
   if (!repos_only)
     {
+      svn_boolean_t inherited;
       SVN_ERR(svn_client__get_wc_mergeinfo_catalog(&target_mergeinfo_cat_wc,
-                                                   inherited,
+                                                   &inherited,
                                                    include_descendants,
                                                    inherit,
                                                    local_abspath,
@@ -597,11 +603,13 @@ svn_client__get_wc_or_repos_mergeinfo_ca
                                                    ctx,
                                                    result_pool,
                                                    scratch_pool));
+      if (inherited_p)
+        *inherited_p = inherited;
 
       /* If we want LOCAL_ABSPATH's inherited mergeinfo, were we able to
          get it from the working copy?  If not, then we must ask the
          repository. */
-      if (! ((*inherited)
+      if (! (inherited
              || (inherit == svn_mergeinfo_explicit)
              || (repos_relpath
                  && target_mergeinfo_cat_wc
@@ -659,7 +667,8 @@ svn_client__get_wc_or_repos_mergeinfo_ca
                                   repos_relpath,
                                   APR_HASH_KEY_STRING))
                 {
-                  *inherited = TRUE;
+                  if (inherited_p)
+                    *inherited_p = TRUE;
                   if (from_repos)
                     *from_repos = TRUE;
                 }
@@ -922,7 +931,7 @@ svn_client__elide_mergeinfo(const char *
         return SVN_NO_ERROR;
 
       /* Get TARGET_WCPATH's inherited mergeinfo from the WC. */
-      err = svn_client__get_wc_mergeinfo(&mergeinfo, &inherited,
+      err = svn_client__get_wc_mergeinfo(&mergeinfo, NULL,
                                          svn_mergeinfo_nearest_ancestor,
                                          target_abspath,
                                          limit_abspath,
@@ -947,7 +956,7 @@ svn_client__elide_mergeinfo(const char *
       if (!mergeinfo && !wc_elision_limit_path)
         {
           err = svn_client__get_wc_or_repos_mergeinfo(
-            &mergeinfo, &inherited, NULL, TRUE,
+            &mergeinfo, NULL, NULL, TRUE,
             svn_mergeinfo_nearest_ancestor,
             NULL, target_wcpath, ctx, pool);
           if (err)
@@ -1059,11 +1068,9 @@ get_mergeinfo(svn_mergeinfo_catalog_t *m
     }
   else /* ! svn_path_is_url() */
     {
-      svn_boolean_t inherited;
-
       /* Acquire return values. */
       SVN_ERR(svn_client__get_wc_or_repos_mergeinfo_catalog(
-        mergeinfo_catalog, &inherited, NULL, include_descendants, FALSE,
+        mergeinfo_catalog, NULL, NULL, include_descendants, FALSE,
         ignore_invalid_mergeinfo, svn_mergeinfo_inherited,
         ra_session, path_or_url, ctx,
         result_pool, scratch_pool));

Modified: subversion/trunk/subversion/libsvn_client/mergeinfo.h
URL: http://svn.apache.org/viewvc/subversion/trunk/subversion/libsvn_client/mergeinfo.h?rev=1203747&r1=1203746&r2=1203747&view=diff
==============================================================================
--- subversion/trunk/subversion/libsvn_client/mergeinfo.h (original)
+++ subversion/trunk/subversion/libsvn_client/mergeinfo.h Fri Nov 18 17:04:28 2011
@@ -99,7 +99,8 @@ svn_client__merge_path_create(const char
 
 /* Find explicit or inherited WC mergeinfo for LOCAL_ABSPATH, and return it
    in *MERGEINFO (NULL if no mergeinfo is set).  Set *INHERITED to
-   whether the mergeinfo was inherited (TRUE or FALSE).
+   whether the mergeinfo was inherited (TRUE or FALSE), if INHERITED is
+   non-null.
 
    This function will search for inherited mergeinfo in the parents of
    LOCAL_ABSPATH only if the base revision of LOCAL_ABSPATH falls within
@@ -233,7 +234,7 @@ svn_client__get_repos_mergeinfo_catalog(
 
    If TARGET_WCPATH inherited its mergeinfo from a working copy ancestor
    or if it was obtained from the repository, set *INHERITED to TRUE, set it
-   to FALSE otherwise. */
+   to FALSE otherwise, if INHERITED is non-null. */
 svn_error_t *
 svn_client__get_wc_or_repos_mergeinfo(svn_mergeinfo_t *target_mergeinfo,
                                       svn_boolean_t *inherited,



Mime
View raw message