You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@subversion.apache.org by ju...@apache.org on 2012/11/07 20:32:20 UTC

svn commit: r1406766 - in /subversion/trunk/subversion: include/private/svn_client_private.h include/svn_client.h libsvn_client/merge.c svn/mergeinfo-cmd.c

Author: julianfoad
Date: Wed Nov  7 19:32:20 2012
New Revision: 1406766

URL: http://svn.apache.org/viewvc?rev=1406766&view=rev
Log:
Make an automatic-merge API public, that we use in implementing the 'svn
mergeinfo' summary diagram, because other clients should be allowed access
to the same information.

* subversion/include/private/svn_client_private.h
  (svn_client__automatic_merge_get_locations): Move and rename ...

* subversion/include/svn_client.h
  (svn_client_automatic_merge_get_locations): ... to here, changing the
    parameters too.

* subversion/libsvn_client/merge.c
  (svn_client__automatic_merge_get_locations): Rename to
   svn_client_automatic_merge_get_locations() and change the parameters
    in the same way.

* subversion/svn/mergeinfo-cmd.c
  (mergeinfo_diagram, mergeinfo_summary): Stop using private APIs.

Modified:
    subversion/trunk/subversion/include/private/svn_client_private.h
    subversion/trunk/subversion/include/svn_client.h
    subversion/trunk/subversion/libsvn_client/merge.c
    subversion/trunk/subversion/svn/mergeinfo-cmd.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=1406766&r1=1406765&r2=1406766&view=diff
==============================================================================
--- subversion/trunk/subversion/include/private/svn_client_private.h (original)
+++ subversion/trunk/subversion/include/private/svn_client_private.h Wed Nov  7 19:32:20 2012
@@ -226,21 +226,6 @@ svn_client__wc_node_get_origin(svn_clien
                                apr_pool_t *result_pool,
                                apr_pool_t *scratch_pool);
 
-/* Set *YCA, *BASE, *RIGHT, *TARGET to the repository locations of the
- * youngest common ancestor of the branches, the base chosen for 3-way
- * merge, the right-hand side of the source diff, and the target WC.
- *
- * Any of the output pointers may be NULL if not wanted.
- */
-svn_error_t *
-svn_client__automatic_merge_get_locations(
-                                svn_client__pathrev_t **yca,
-                                svn_client__pathrev_t **base,
-                                svn_client__pathrev_t **right,
-                                svn_client__pathrev_t **target,
-                                const svn_client_automatic_merge_t *merge,
-                                apr_pool_t *result_pool);
-
 
 #ifdef __cplusplus
 }

Modified: subversion/trunk/subversion/include/svn_client.h
URL: http://svn.apache.org/viewvc/subversion/trunk/subversion/include/svn_client.h?rev=1406766&r1=1406765&r2=1406766&view=diff
==============================================================================
--- subversion/trunk/subversion/include/svn_client.h (original)
+++ subversion/trunk/subversion/include/svn_client.h Wed Nov  7 19:32:20 2012
@@ -3459,6 +3459,26 @@ svn_boolean_t
 svn_client_automatic_merge_is_reintegrate_like(
         const svn_client_automatic_merge_t *merge);
 
+/* Set *YCA, *BASE, *RIGHT, *TARGET to the repository locations of the
+ * youngest common ancestor of the branches, the base chosen for 3-way
+ * merge, the right-hand side of the source diff, and the target WC.
+ *
+ * Any of the output pointers may be NULL if not wanted.
+ */
+svn_error_t *
+svn_client_automatic_merge_get_locations(
+                                const char **yca_url,
+                                svn_revnum_t *yca_rev,
+                                const char **base_url,
+                                svn_revnum_t *base_rev,
+                                const char **right_url,
+                                svn_revnum_t *right_rev,
+                                const char **target_url,
+                                svn_revnum_t *target_rev,
+                                const char **repos_root_url,
+                                const svn_client_automatic_merge_t *merge,
+                                apr_pool_t *result_pool);
+
 
 /** Merge changes from @a source1/@a revision1 to @a source2/@a revision2 into
  * the working-copy path @a target_wcpath.

Modified: subversion/trunk/subversion/libsvn_client/merge.c
URL: http://svn.apache.org/viewvc/subversion/trunk/subversion/libsvn_client/merge.c?rev=1406766&r1=1406765&r2=1406766&view=diff
==============================================================================
--- subversion/trunk/subversion/libsvn_client/merge.c (original)
+++ subversion/trunk/subversion/libsvn_client/merge.c Wed Nov  7 19:32:20 2012
@@ -11788,21 +11788,37 @@ svn_client_automatic_merge_is_reintegrat
 }
 
 svn_error_t *
-svn_client__automatic_merge_get_locations(
-                                svn_client__pathrev_t **yca,
-                                svn_client__pathrev_t **base,
-                                svn_client__pathrev_t **right,
-                                svn_client__pathrev_t **target,
+svn_client_automatic_merge_get_locations(
+                                const char **yca_url,
+                                svn_revnum_t *yca_rev,
+                                const char **base_url,
+                                svn_revnum_t *base_rev,
+                                const char **right_url,
+                                svn_revnum_t *right_rev,
+                                const char **target_url,
+                                svn_revnum_t *target_rev,
+                                const char **repos_root_url,
                                 const svn_client_automatic_merge_t *merge,
                                 apr_pool_t *result_pool)
 {
-  if (yca)
-    *yca = svn_client__pathrev_dup(merge->yca, result_pool);
-  if (base)
-    *base = svn_client__pathrev_dup(merge->base, result_pool);
-  if (right)
-    *right = svn_client__pathrev_dup(merge->right, result_pool);
-  if (target)
-    *target = svn_client__pathrev_dup(merge->target, result_pool);
+  if (yca_url)
+    *yca_url = apr_pstrdup(result_pool, merge->yca->url);
+  if (yca_rev)
+    *yca_rev = merge->yca->rev;
+  if (base_url)
+    *base_url = apr_pstrdup(result_pool, merge->base->url);
+  if (base_rev)
+    *base_rev = merge->base->rev;
+  if (right_url)
+    *right_url = apr_pstrdup(result_pool, merge->right->url);
+  if (right_rev)
+    *right_rev = merge->right->rev;
+  if (target_url)
+    *target_url = apr_pstrdup(result_pool, merge->target->url);
+  if (target_rev)
+    *target_rev = merge->target->rev;
+  if (repos_root_url)
+    *repos_root_url = apr_pstrdup(result_pool, merge->yca->repos_root_url);
+
   return SVN_NO_ERROR;
 }

Modified: subversion/trunk/subversion/svn/mergeinfo-cmd.c
URL: http://svn.apache.org/viewvc/subversion/trunk/subversion/svn/mergeinfo-cmd.c?rev=1406766&r1=1406765&r2=1406766&view=diff
==============================================================================
--- subversion/trunk/subversion/svn/mergeinfo-cmd.c (original)
+++ subversion/trunk/subversion/svn/mergeinfo-cmd.c Wed Nov  7 19:32:20 2012
@@ -37,7 +37,6 @@
 #include "cl.h"
 
 #include "svn_private_config.h"
-#include "private/svn_client_private.h"
 
 
 /*** Code. ***/
@@ -60,10 +59,15 @@ print_log_rev(void *baton,
  * of merging between two branches, given the merge description
  * indicated by YCA, BASE, RIGHT, TARGET, REINTEGRATE_LIKE. */
 static svn_error_t *
-mergeinfo_diagram(svn_client__pathrev_t *yca,
-                  svn_client__pathrev_t *base,
-                  svn_client__pathrev_t *right,
-                  svn_client__pathrev_t *target,
+mergeinfo_diagram(const char *yca_url,
+                  const char *base_url,
+                  const char *right_url,
+                  const char *target_url,
+                  svn_revnum_t yca_rev,
+                  svn_revnum_t base_rev,
+                  svn_revnum_t right_rev,
+                  svn_revnum_t target_rev,
+                  const char *repos_root_url,
                   svn_boolean_t target_is_wc,
                   svn_boolean_t reintegrate_like,
                   apr_pool_t *pool)
@@ -82,16 +86,16 @@ mergeinfo_diagram(svn_client__pathrev_t 
 
   /* The YCA (that is, the branching point).  And an ellipsis, because we
    * don't show information about earlier merges */
-  g[0][0] = apr_psprintf(pool, "  %-8ld  ", yca->rev);
+  g[0][0] = apr_psprintf(pool, "  %-8ld  ", yca_rev);
   g[1][0] =     "  |         ";
-  if (strcmp(yca->url, right->url) == 0)
+  if (strcmp(yca_url, right_url) == 0)
     {
       g[2][0] = "-------| |--";
       g[3][0] = "   \\        ";
       g[4][0] = "    \\       ";
       g[5][0] = "     --| |--";
     }
-  else if (strcmp(yca->url, target->url) == 0)
+  else if (strcmp(yca_url, target_url) == 0)
     {
       g[2][0] = "     --| |--";
       g[3][0] = "    /       ";
@@ -107,18 +111,18 @@ mergeinfo_diagram(svn_client__pathrev_t 
     }
 
   /* The last full merge */
-  if ((base->rev > yca->rev) && reintegrate_like)
+  if ((base_rev > yca_rev) && reintegrate_like)
     {
       g[2][2] = "---------";
       g[3][2] = "  /      ";
       g[4][2] = " /       ";
       g[5][2] = "---------";
       g[6][2] = "|        ";
-      g[7][2] = apr_psprintf(pool, "%-8ld ", base->rev);
+      g[7][2] = apr_psprintf(pool, "%-8ld ", base_rev);
     }
-  else if (base->rev > yca->rev)
+  else if (base_rev > yca_rev)
     {
-      g[0][2] = apr_psprintf(pool, "%-8ld ", base->rev);
+      g[0][2] = apr_psprintf(pool, "%-8ld ", base_rev);
       g[1][2] = "|        ";
       g[2][2] = "---------";
       g[3][2] = " \\       ";
@@ -135,7 +139,7 @@ mergeinfo_diagram(svn_client__pathrev_t 
 
   /* The tips of the branches */
     {
-      g[0][3] = apr_psprintf(pool, "%-8ld", right->rev);
+      g[0][3] = apr_psprintf(pool, "%-8ld", right_rev);
       g[1][3] = "|       ";
       g[2][3] = "-       ";
       g[3][3] = "        ";
@@ -143,7 +147,7 @@ mergeinfo_diagram(svn_client__pathrev_t 
       g[5][3] = "-       ";
       g[6][3] = "|       ";
       g[7][3] = target_is_wc ? "WC      "
-                             : apr_psprintf(pool, "%-8ld", target->rev);
+                             : apr_psprintf(pool, "%-8ld", target_rev);
     }
 
   /* Find the width of each column, so we know how to print blank cells */
@@ -183,10 +187,10 @@ mergeinfo_diagram(svn_client__pathrev_t 
         }
       if (row == 2)
         SVN_ERR(svn_cmdline_printf(pool, "  %s",
-                svn_client__pathrev_relpath(right, pool)));
+                svn_uri_skip_ancestor(repos_root_url, right_url, pool)));
       if (row == 5)
         SVN_ERR(svn_cmdline_printf(pool, "  %s",
-                svn_client__pathrev_relpath(target, pool)));
+                svn_uri_skip_ancestor(repos_root_url, target_url, pool)));
       SVN_ERR(svn_cmdline_fputs("\n", stdout, pool));
     }
 
@@ -206,7 +210,9 @@ mergeinfo_summary(
                   apr_pool_t *pool)
 {
   svn_client_automatic_merge_t *the_merge;
-  svn_client__pathrev_t *yca, *base, *right, *target;
+  const char *yca_url, *base_url, *right_url, *target_url;
+  svn_revnum_t yca_rev, base_rev, right_rev, target_rev;
+  const char *repos_root_url;
   svn_boolean_t target_is_wc, reintegrate_like;
 
   target_is_wc = (! svn_path_is_url(target_path_or_url))
@@ -226,12 +232,16 @@ mergeinfo_summary(
               target_path_or_url, target_revision,
               ctx, pool, pool));
 
-  SVN_ERR(svn_client__automatic_merge_get_locations(
-            &yca, &base, &right, &target, the_merge, pool));
+  SVN_ERR(svn_client_automatic_merge_get_locations(
+            &yca_url, &base_url, &right_url, &target_url,
+            &yca_rev, &base_rev, &right_rev, &target_rev,
+            &repos_root_url,
+            the_merge, pool));
   reintegrate_like = svn_client_automatic_merge_is_reintegrate_like(the_merge);
 
-  SVN_ERR(mergeinfo_diagram(yca, base, right, target,
-                            target_is_wc, reintegrate_like,
+  SVN_ERR(mergeinfo_diagram(yca_url, base_url, right_url, target_url,
+                            yca_rev, base_rev, right_rev, target_rev,
+                            repos_root_url, target_is_wc, reintegrate_like,
                             pool));
 
   return SVN_NO_ERROR;