subversion-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From stef...@apache.org
Subject svn commit: r1689084 - in /subversion/branches/svn-mergeinfo-normalizer/tools/client-side/svn-mergeinfo-normalizer: analyze-cmd.c logic.c mergeinfo-normalizer.h wc_mergeinfo.c
Date Fri, 03 Jul 2015 20:25:52 GMT
Author: stefan2
Date: Fri Jul  3 20:25:51 2015
New Revision: 1689084

URL: http://svn.apache.org/r1689084
Log:
On the svn-mergeinfo-normalizer branch:
Revert most of r1689076 and try a slightly different approach.
Let the svn_min__get_mergeinfo_pair do all the heavy lifting such that
the return parameters always get initialized instead of handling the
various cases in the caller.

* tools/client-side/svn-mergeinfo-normalizer/mergeinfo-normalizer.h
  (svn_min__get_mergeinfo_pair,
   svn_min__get_parent_mergeinfo): Revert rename and drop the boolean return.

* tools/client-side/svn-mergeinfo-normalizer/wc_mergeinfo.c
  (svn_min__get_mergeinfo_pair,
   svn_min__get_parent_mergeinfo): Revert rename and always set all return
                                   arguments.

* tools/client-side/svn-mergeinfo-normalizer/analyze-cmd.c
  (analyze): Simplify caller.

* tools/client-side/svn-mergeinfo-normalizer/logic.c
  (normalize): Same.

Modified:
    subversion/branches/svn-mergeinfo-normalizer/tools/client-side/svn-mergeinfo-normalizer/analyze-cmd.c
    subversion/branches/svn-mergeinfo-normalizer/tools/client-side/svn-mergeinfo-normalizer/logic.c
    subversion/branches/svn-mergeinfo-normalizer/tools/client-side/svn-mergeinfo-normalizer/mergeinfo-normalizer.h
    subversion/branches/svn-mergeinfo-normalizer/tools/client-side/svn-mergeinfo-normalizer/wc_mergeinfo.c

Modified: subversion/branches/svn-mergeinfo-normalizer/tools/client-side/svn-mergeinfo-normalizer/analyze-cmd.c
URL: http://svn.apache.org/viewvc/subversion/branches/svn-mergeinfo-normalizer/tools/client-side/svn-mergeinfo-normalizer/analyze-cmd.c?rev=1689084&r1=1689083&r2=1689084&view=diff
==============================================================================
--- subversion/branches/svn-mergeinfo-normalizer/tools/client-side/svn-mergeinfo-normalizer/analyze-cmd.c
(original)
+++ subversion/branches/svn-mergeinfo-normalizer/tools/client-side/svn-mergeinfo-normalizer/analyze-cmd.c
Fri Jul  3 20:25:51 2015
@@ -295,30 +295,25 @@ analyze(svn_ra_session_t *session,
       svn_mergeinfo_t subtree_mergeinfo;
       svn_mergeinfo_t obsolete;
 
-      subtree_mergeinfo = svn_min__get_mergeinfo(wc_mergeinfo, i);
-      if (svn_min__get_parent_mergeinfo(&parent_path, &relpath,
-                                        &parent_mergeinfo, wc_mergeinfo, i))
-        {
-          SVN_ERR(svn_cmdline_printf(iterpool,
-                                     _("Trying to elide mergeinfo from path\n"
-                                       "    %s\n"
-                                       "    into mergeinfo at path\n"
-                                       "    %s\n\n"),
-                                     svn_dirent_join(parent_path, relpath,
-                                                     iterpool),
-                                     parent_path));
-        }
-      else
-        {
-          parent_mergeinfo = NULL;
-          subtree_mergeinfo = svn_min__get_mergeinfo(wc_mergeinfo, i);
+      svn_min__get_mergeinfo_pair(&parent_path, &relpath,
+                                  &parent_mergeinfo, &subtree_mergeinfo,
+                                  wc_mergeinfo, i);
 
-          SVN_ERR(svn_cmdline_printf(iterpool,
-                                     _("Trying to elide mergeinfo at path\n"
-                                       "    %s\n\n"),
-                                     svn_min__get_mergeinfo_path(wc_mergeinfo,
-                                                                 i)));
-        }
+      if (parent_mergeinfo)
+        SVN_ERR(svn_cmdline_printf(iterpool,
+                                    _("Trying to elide mergeinfo from path\n"
+                                      "    %s\n"
+                                      "    into mergeinfo at path\n"
+                                      "    %s\n\n"),
+                                    svn_dirent_join(parent_path, relpath,
+                                                    iterpool),
+                                    parent_path));
+      else
+        SVN_ERR(svn_cmdline_printf(iterpool,
+                                    _("Trying to elide mergeinfo at path\n"
+                                      "    %s\n\n"),
+                                    svn_min__get_mergeinfo_path(wc_mergeinfo,
+                                                                i)));
 
       svn_pool_clear(iterpool);
 

Modified: subversion/branches/svn-mergeinfo-normalizer/tools/client-side/svn-mergeinfo-normalizer/logic.c
URL: http://svn.apache.org/viewvc/subversion/branches/svn-mergeinfo-normalizer/tools/client-side/svn-mergeinfo-normalizer/logic.c?rev=1689084&r1=1689083&r2=1689084&view=diff
==============================================================================
--- subversion/branches/svn-mergeinfo-normalizer/tools/client-side/svn-mergeinfo-normalizer/logic.c
(original)
+++ subversion/branches/svn-mergeinfo-normalizer/tools/client-side/svn-mergeinfo-normalizer/logic.c
Fri Jul  3 20:25:51 2015
@@ -313,15 +313,17 @@ normalize(apr_array_header_t *wc_mergein
       svn_pool_clear(iterpool);
       progress.nodes_todo = i;
 
+      /* Get the relevant mergeinfo. */
+      svn_min__get_mergeinfo_pair(&parent_path, &relpath,
+                                  &parent_mergeinfo, &subtree_mergeinfo,
+                                  wc_mergeinfo, i);
+
       /* Quickly eliminate entries for known deleted branches. */
-      subtree_mergeinfo = svn_min__get_mergeinfo(wc_mergeinfo, i);
       SVN_ERR(remove_obsolete_lines(lookup, subtree_mergeinfo, opt_state,
                                     &progress, TRUE, iterpool));
 
       /* Eliminate redundant sub-node mergeinfo. */
-      if (opt_state->remove_redundants &&
-          svn_min__get_parent_mergeinfo(&parent_path, &relpath,
-                                        &parent_mergeinfo, wc_mergeinfo, i))
+      if (opt_state->remove_redundants && parent_mergeinfo)
         {
           svn_mergeinfo_t parent_mergeinfo_copy;
           svn_mergeinfo_t subtree_mergeinfo_copy;

Modified: subversion/branches/svn-mergeinfo-normalizer/tools/client-side/svn-mergeinfo-normalizer/mergeinfo-normalizer.h
URL: http://svn.apache.org/viewvc/subversion/branches/svn-mergeinfo-normalizer/tools/client-side/svn-mergeinfo-normalizer/mergeinfo-normalizer.h?rev=1689084&r1=1689083&r2=1689084&view=diff
==============================================================================
--- subversion/branches/svn-mergeinfo-normalizer/tools/client-side/svn-mergeinfo-normalizer/mergeinfo-normalizer.h
(original)
+++ subversion/branches/svn-mergeinfo-normalizer/tools/client-side/svn-mergeinfo-normalizer/mergeinfo-normalizer.h
Fri Jul  3 20:25:51 2015
@@ -136,12 +136,13 @@ const char *
 svn_min__get_mergeinfo_path(apr_array_header_t *mergeinfo,
                             int idx);
 
-svn_boolean_t
-svn_min__get_parent_mergeinfo(const char **parent_path,
-                              const char **subtree_relpath,
-                              svn_mergeinfo_t *parent_mergeinfo,
-                              apr_array_header_t *mergeinfo,
-                              int idx);
+void
+svn_min__get_mergeinfo_pair(const char **parent_path,
+                            const char **subtree_relpath,
+                            svn_mergeinfo_t *parent_mergeinfo,
+                            svn_mergeinfo_t *subtree_mergeinfo,
+                            apr_array_header_t *mergeinfo,
+                            int idx);
 
 svn_error_t *
 svn_min__write_mergeinfo(svn_min__cmd_baton_t *baton,

Modified: subversion/branches/svn-mergeinfo-normalizer/tools/client-side/svn-mergeinfo-normalizer/wc_mergeinfo.c
URL: http://svn.apache.org/viewvc/subversion/branches/svn-mergeinfo-normalizer/tools/client-side/svn-mergeinfo-normalizer/wc_mergeinfo.c?rev=1689084&r1=1689083&r2=1689084&view=diff
==============================================================================
--- subversion/branches/svn-mergeinfo-normalizer/tools/client-side/svn-mergeinfo-normalizer/wc_mergeinfo.c
(original)
+++ subversion/branches/svn-mergeinfo-normalizer/tools/client-side/svn-mergeinfo-normalizer/wc_mergeinfo.c
Fri Jul  3 20:25:51 2015
@@ -234,27 +234,41 @@ svn_min__common_parent(apr_array_header_
   return result;
 }
 
-svn_boolean_t
-svn_min__get_parent_mergeinfo(const char **parent_path,
-                              const char **subtree_relpath,
-                              svn_mergeinfo_t *parent_mergeinfo,
-                              apr_array_header_t *mergeinfo,
-                              int idx)
+void
+svn_min__get_mergeinfo_pair(const char **parent_path,
+                            const char **subtree_relpath,
+                            svn_mergeinfo_t *parent_mergeinfo,
+                            svn_mergeinfo_t *subtree_mergeinfo,
+                            apr_array_header_t *mergeinfo,
+                            int idx)
 {
   mergeinfo_t *entry;
   if (idx < 0 || mergeinfo->nelts <= idx)
-    return FALSE;
+    {
+      *parent_path = "";
+      *subtree_relpath = "";
+      *parent_mergeinfo = NULL;
+      *subtree_mergeinfo = NULL;
+
+      return;
+    }
 
   entry = APR_ARRAY_IDX(mergeinfo, idx, mergeinfo_t *);
+  *subtree_mergeinfo = entry->mergeinfo;
+
   if (!entry->parent)
-    return FALSE;
+    {
+      *parent_path = "";
+      *subtree_relpath = "";
+      *parent_mergeinfo = NULL;
+
+      return;
+    }
 
   *parent_path = entry->parent->local_path;
   *subtree_relpath = svn_dirent_skip_ancestor(entry->parent->local_path,
                                               entry->local_path);
   *parent_mergeinfo = entry->parent->mergeinfo;
-
-  return TRUE;
 }
 
 svn_mergeinfo_t



Mime
View raw message