subversion-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From julianf...@apache.org
Subject svn commit: r1213635 - in /subversion/branches/showing-merge-info: ./ subversion/include/private/svn_client_private.h subversion/include/svn_client.h subversion/libsvn_client/merge.c subversion/svn/merge-cmd.c
Date Tue, 13 Dec 2011 10:12:17 GMT
Author: julianfoad
Date: Tue Dec 13 10:12:16 2011
New Revision: 1213635

URL: http://svn.apache.org/viewvc?rev=1213635&view=rev
Log:
On the 'showing-merge-info' branch: Catch up to trunk@1213634.

Modified:
    subversion/branches/showing-merge-info/   (props changed)
    subversion/branches/showing-merge-info/subversion/include/private/svn_client_private.h
    subversion/branches/showing-merge-info/subversion/include/svn_client.h
    subversion/branches/showing-merge-info/subversion/libsvn_client/merge.c
    subversion/branches/showing-merge-info/subversion/svn/merge-cmd.c

Propchange: subversion/branches/showing-merge-info/
------------------------------------------------------------------------------
--- svn:mergeinfo (original)
+++ svn:mergeinfo Tue Dec 13 10:12:16 2011
@@ -57,4 +57,4 @@
 /subversion/branches/tree-conflicts:868291-873154
 /subversion/branches/tree-conflicts-notify:873926-874008
 /subversion/branches/uris-as-urls:1060426-1064427
-/subversion/trunk:1177607-1213344
+/subversion/trunk:1177607-1213634

Modified: subversion/branches/showing-merge-info/subversion/include/private/svn_client_private.h
URL: http://svn.apache.org/viewvc/subversion/branches/showing-merge-info/subversion/include/private/svn_client_private.h?rev=1213635&r1=1213634&r2=1213635&view=diff
==============================================================================
--- subversion/branches/showing-merge-info/subversion/include/private/svn_client_private.h
(original)
+++ subversion/branches/showing-merge-info/subversion/include/private/svn_client_private.h
Tue Dec 13 10:12:16 2011
@@ -128,38 +128,6 @@ svn_client__get_location_segments(apr_ar
                                   apr_pool_t *result_pool,
                                   apr_pool_t *scratch_pool);
 
-/* */
-svn_error_t *
-svn_client_find_reintegrate_merge(svn_ra_session_t **source_ra_session_p,
-                                  svn_ra_session_t **target_ra_session_p,
-                                  const char **url1_p,
-                                  svn_revnum_t *rev1_p,
-                                  const char **url2_p,
-                                  svn_revnum_t *rev2_p,
-                                  svn_revnum_t *yc_ancestor_rev_p,
-                                  /* inputs */
-                                  const char *source,
-                                  const svn_opt_revision_t *peg_revision,
-                                  const char *target_abspath,
-                                  svn_client_ctx_t *ctx,
-                                  apr_pool_t *result_pool,
-                                  apr_pool_t *scratch_pool);
-
-/* */
-svn_error_t *
-svn_client_do_reintegrate_merge(svn_ra_session_t *source_ra_session,
-                                svn_ra_session_t *target_ra_session,
-                                const char *url1,
-                                svn_revnum_t rev1,
-                                const char *url2,
-                                svn_revnum_t rev2,
-                                svn_revnum_t yc_ancestor_rev,
-                                const char *target_wcpath,
-                                svn_boolean_t dry_run,
-                                const apr_array_header_t *merge_options,
-                                svn_client_ctx_t *ctx,
-                                apr_pool_t *scratch_pool);
-
 
 #ifdef __cplusplus
 }

Modified: subversion/branches/showing-merge-info/subversion/include/svn_client.h
URL: http://svn.apache.org/viewvc/subversion/branches/showing-merge-info/subversion/include/svn_client.h?rev=1213635&r1=1213634&r2=1213635&view=diff
==============================================================================
--- subversion/branches/showing-merge-info/subversion/include/svn_client.h (original)
+++ subversion/branches/showing-merge-info/subversion/include/svn_client.h Tue Dec 13 10:12:16
2011
@@ -3554,6 +3554,38 @@ svn_client_merge(const char *source1,
                  apr_pool_t *pool);
 
 
+/**
+ * Determine the URLs and revisions needed to perform a reintegrate merge
+ * from @a source_path_or_url at @a source_peg_revision into the working
+ * copy at @a target_wcpath.
+ *
+ * Set @a *url1_p and @a *rev1_p to the left side, and @a *url2_p and
+ * @a *rev2_p to the right side, URLs and revisions of the source of the
+ * required two-URL merge.
+ *
+ * If no merge should be performed, set @a *url1_p to NULL and @a *rev1_p
+ * to #SVN_INVALID_REVNUM.
+ *
+ * The authentication baton cached in @a ctx is used to communicate with the
+ * repository.
+ *
+ * Allocate all the results in @a result_pool.  Use @a scratch_pool for
+ * temporary allocations.
+ *
+ * @since New in 1.8.
+ */
+svn_error_t *
+svn_client_find_reintegrate_merge(const char **url1_p,
+                                  svn_revnum_t *rev1_p,
+                                  const char **url2_p,
+                                  svn_revnum_t *rev2_p,
+                                  /* inputs */
+                                  const char *source_path_or_url,
+                                  const svn_opt_revision_t *source_peg_revision,
+                                  const char *target_wcpath,
+                                  svn_client_ctx_t *ctx,
+                                  apr_pool_t *result_pool,
+                                  apr_pool_t *scratch_pool);
 
 /**
  * Perform a reintegration merge of @a source_path_or_url at @a source_peg_revision

Modified: subversion/branches/showing-merge-info/subversion/libsvn_client/merge.c
URL: http://svn.apache.org/viewvc/subversion/branches/showing-merge-info/subversion/libsvn_client/merge.c?rev=1213635&r1=1213634&r2=1213635&view=diff
==============================================================================
--- subversion/branches/showing-merge-info/subversion/libsvn_client/merge.c (original)
+++ subversion/branches/showing-merge-info/subversion/libsvn_client/merge.c Tue Dec 13 10:12:16
2011
@@ -10413,13 +10413,12 @@ calculate_left_hand_side(const char **ur
   return SVN_NO_ERROR;
 }
 
-/* */
+/* The body of svn_client_find_reintegrate_merge(), which see for details. */
 static svn_error_t *
-find_reintegrate_merge(svn_ra_session_t **source_ra_session_p,
-                       svn_ra_session_t **target_ra_session_p,
-                       merge_source_t *source_p,
+find_reintegrate_merge(svn_ra_session_t **target_ra_session_p,
+                       svn_ra_session_t **source_ra_session_p,
+                       merge_source_t **source_p,
                        svn_revnum_t *yc_ancestor_rev_p,
-                       /* inputs */
                        const char *source_path_or_url,
                        const svn_opt_revision_t *source_peg_revision,
                        const char *target_abspath,
@@ -10453,12 +10452,12 @@ find_reintegrate_merge(svn_ra_session_t 
   /* Determine the working copy target's repository root URL. */
   SVN_ERR(svn_client_get_repos_root(&wc_repos_root.url, &wc_repos_root.uuid,
                                     target_abspath,
-                                    ctx, result_pool, scratch_pool));
+                                    ctx, scratch_pool, scratch_pool));
 
   /* Determine the source's repository root URL. */
   SVN_ERR(svn_client_get_repos_root(&source_repos_root.url,
                                     &source_repos_root.uuid, source.url2,
-                                    ctx, result_pool, scratch_pool));
+                                    ctx, scratch_pool, scratch_pool));
 
   /* source_repos_root and wc_repos_root are required to be the same,
      as mergeinfo doesn't come into play for cross-repository merging. */
@@ -10517,7 +10516,7 @@ find_reintegrate_merge(svn_ra_session_t 
   SVN_ERR(svn_client__open_ra_session_internal(&target_ra_session, NULL,
                                                target_url,
                                                NULL, NULL, FALSE, FALSE,
-                                               ctx, result_pool));
+                                               ctx, scratch_pool));
 
   SVN_ERR(calculate_left_hand_side(&source.url1, &source.rev1,
                                    &merged_to_source_mergeinfo_catalog,
@@ -10537,7 +10536,17 @@ find_reintegrate_merge(svn_ra_session_t 
   /* Did calculate_left_hand_side() decide that there was no merge to
      be performed here?  */
   if (! source.url1)
-    return SVN_NO_ERROR;
+    {
+      if (target_ra_session_p)
+        *target_ra_session_p = NULL;
+      if (source_ra_session_p)
+        *source_ra_session_p = NULL;
+      if (source_p)
+        *source_p = NULL;
+      if (yc_ancestor_rev_p)
+        *yc_ancestor_rev_p = SVN_INVALID_REVNUM;
+      return SVN_NO_ERROR;
+    }
 
   /* If the target was moved after the source was branched from it,
      it is possible that the left URL differs from the target's current
@@ -10596,76 +10605,81 @@ find_reintegrate_merge(svn_ra_session_t 
 
   /* Left side: trunk@youngest-trunk-rev-merged-to-branch-at-specified-peg-rev
    * Right side: branch@specified-peg-revision */
-  *source_ra_session_p = source_ra_session;
-  *target_ra_session_p = target_ra_session;
-  *source_p = source;
-  *yc_ancestor_rev_p = yc_ancestor_rev;
+  if (target_ra_session_p)
+    *target_ra_session_p = target_ra_session;
+  if (source_ra_session_p)
+    *source_ra_session_p = source_ra_session;
+  if (source_p)
+    *source_p = apr_pmemdup(result_pool, &source, sizeof(source));
+  if (yc_ancestor_rev_p)
+    *yc_ancestor_rev_p = yc_ancestor_rev;
   return SVN_NO_ERROR;
 }
 
 svn_error_t *
-svn_client_find_reintegrate_merge(svn_ra_session_t **source_ra_session_p,
-                                  svn_ra_session_t **target_ra_session_p,
-                                  const char **url1_p,
+svn_client_find_reintegrate_merge(const char **url1_p,
                                   svn_revnum_t *rev1_p,
                                   const char **url2_p,
                                   svn_revnum_t *rev2_p,
-                                  svn_revnum_t *yc_ancestor_rev_p,
-                                  /* inputs */
                                   const char *source_path_or_url,
                                   const svn_opt_revision_t *source_peg_revision,
-                                  const char *target_abspath,
+                                  const char *target_wcpath,
                                   svn_client_ctx_t *ctx,
                                   apr_pool_t *result_pool,
                                   apr_pool_t *scratch_pool)
 {
-  merge_source_t source;
-
-  /* ### We don't need to write to the WC at this stage. We want to
-   * read a consistent state, and afterwards the caller will want
-   * svn_client_do_reintegrate_merge() to write into the same state,
-   * so maybe the caller should take out a write lock around both calls,
-   * and we should not take out a lock here.  Maybe we should have a way
-   * to request a "read lock" that allows reading only. */
-  SVN_ERR(find_reintegrate_merge(
-              source_ra_session_p, target_ra_session_p,
-              &source,
-              yc_ancestor_rev_p,
-              source_path_or_url, source_peg_revision, target_abspath,
-              ctx, result_pool, scratch_pool));
-  *url1_p = source.url1;
-  *rev1_p = source.rev1;
-  *url2_p = source.url2;
-  *rev2_p = source.rev2;
+  const char *target_abspath;
+  merge_source_t *source;
 
+  SVN_ERR(svn_dirent_get_absolute(&target_abspath, target_wcpath,
+                                  scratch_pool));
+  SVN_ERR(find_reintegrate_merge(NULL, NULL, &source, NULL,
+                                 source_path_or_url, source_peg_revision,
+                                 target_abspath,
+                                 ctx, result_pool, scratch_pool));
+  if (source)
+    {
+      *url1_p = source->url1;
+      *rev1_p = source->rev1;
+      *url2_p = source->url2;
+      *rev2_p = source->rev2;
+    }
+  else
+    {
+      *url1_p = NULL;
+      *rev1_p = SVN_INVALID_REVNUM;
+      *url2_p = NULL;
+      *rev2_p = SVN_INVALID_REVNUM;
+    }
   return SVN_NO_ERROR;
 }
 
-/* */
+/* The body of svn_client_merge_reintegrate(), which see for details. */
 static svn_error_t *
-do_reintegrate_merge(svn_ra_session_t *source_ra_session,
-                     svn_ra_session_t *target_ra_session,
-                     const merge_source_t *source,
-                     svn_revnum_t yc_ancestor_rev,
-                     const char *target_abspath,
-                     svn_boolean_t dry_run,
-                     const apr_array_header_t *merge_options,
-                     svn_client_ctx_t *ctx,
-                     apr_pool_t *scratch_pool)
+merge_reintegrate_locked(const char *source_path_or_url,
+                         const svn_opt_revision_t *source_peg_revision,
+                         const char *target_abspath,
+                         svn_boolean_t dry_run,
+                         const apr_array_header_t *merge_options,
+                         svn_client_ctx_t *ctx,
+                         apr_pool_t *scratch_pool)
 {
-  url_uuid_t source_repos_root, wc_repos_root;
-  svn_boolean_t use_sleep = FALSE;
+  svn_ra_session_t *target_ra_session, *source_ra_session;
+  merge_source_t *source;
+  svn_revnum_t yc_ancestor_rev;
+  svn_boolean_t use_sleep;
   svn_error_t *err;
 
-  /* Determine the working copy target's repository root URL. */
-  SVN_ERR(svn_client_get_repos_root(&wc_repos_root.url, &wc_repos_root.uuid,
-                                    target_abspath,
-                                    ctx, scratch_pool, scratch_pool));
+  SVN_ERR(find_reintegrate_merge(&target_ra_session, &source_ra_session,
+                                 &source, &yc_ancestor_rev,
+                                 source_path_or_url, source_peg_revision,
+                                 target_abspath,
+                                 ctx, scratch_pool, scratch_pool));
 
-  /* Determine the source's repository root URL. */
-  SVN_ERR(svn_client_get_repos_root(&source_repos_root.url,
-                                    &source_repos_root.uuid, source->url2,
-                                    ctx, scratch_pool, scratch_pool));
+  if (! source)
+    {
+      return SVN_NO_ERROR;
+    }
 
   /* Do the real merge! */
   /* ### TODO(reint): Make sure that one isn't the same line ancestor
@@ -10695,60 +10709,6 @@ do_reintegrate_merge(svn_ra_session_t *s
 }
 
 svn_error_t *
-svn_client_do_reintegrate_merge(svn_ra_session_t *source_ra_session,
-                                svn_ra_session_t *target_ra_session,
-                                const char *url1,
-                                svn_revnum_t rev1,
-                                const char *url2,
-                                svn_revnum_t rev2,
-                                svn_revnum_t yc_ancestor_rev,
-                                const char *target_wc_abspath,
-                                svn_boolean_t dry_run,
-                                const apr_array_header_t *merge_options,
-                                svn_client_ctx_t *ctx,
-                                apr_pool_t *scratch_pool)
-{
-  merge_source_t source = { url1, rev1, url2, rev2 };
-
-  SVN_ERR(do_reintegrate_merge(
-              source_ra_session, target_ra_session,
-              &source, yc_ancestor_rev,
-              target_wc_abspath, dry_run, merge_options,
-              ctx, scratch_pool));
-
-  return SVN_NO_ERROR;
-}
-
-/* */
-static svn_error_t *
-merge_reintegrate_locked(const char *source_path_or_url,
-                         const svn_opt_revision_t *source_peg_revision,
-                         const char *target_abspath,
-                         svn_boolean_t dry_run,
-                         const apr_array_header_t *merge_options,
-                         svn_client_ctx_t *ctx,
-                         apr_pool_t *scratch_pool)
-{
-  svn_ra_session_t *source_ra_session;
-  svn_ra_session_t *target_ra_session;
-  merge_source_t source;
-  svn_revnum_t yc_ancestor_rev;
-
-  SVN_ERR(find_reintegrate_merge(
-            &source_ra_session, &target_ra_session,
-            &source, &yc_ancestor_rev,
-            source_path_or_url, source_peg_revision, target_abspath,
-            ctx, scratch_pool, scratch_pool));
-
-  SVN_ERR(do_reintegrate_merge(
-            source_ra_session, target_ra_session,
-            &source, yc_ancestor_rev,
-            target_abspath,
-            dry_run, merge_options, ctx, scratch_pool));
-  return SVN_NO_ERROR;
-}
-
-svn_error_t *
 svn_client_merge_reintegrate(const char *source_path_or_url,
                              const svn_opt_revision_t *source_peg_revision,
                              const char *target_wcpath,

Modified: subversion/branches/showing-merge-info/subversion/svn/merge-cmd.c
URL: http://svn.apache.org/viewvc/subversion/branches/showing-merge-info/subversion/svn/merge-cmd.c?rev=1213635&r1=1213634&r2=1213635&view=diff
==============================================================================
--- subversion/branches/showing-merge-info/subversion/svn/merge-cmd.c (original)
+++ subversion/branches/showing-merge-info/subversion/svn/merge-cmd.c Tue Dec 13 10:12:16
2011
@@ -34,7 +34,6 @@
 #include "svn_types.h"
 #include "cl.h"
 
-#include "private/svn_client_private.h"
 #include "private/svn_wc_private.h"
 #include "svn_private_config.h"
 
@@ -120,8 +119,8 @@ get_target_and_lock_abspath(const char *
 
 /* */
 static svn_error_t *
-merge_reintegrate_locked(const char *source,
-                         const svn_opt_revision_t *peg_revision,
+merge_reintegrate_locked(const char *source_path_or_url,
+                         const svn_opt_revision_t *source_peg_revision,
                          const char *target_wcpath,
                          const char *target_wc_abspath,
                          svn_boolean_t dry_run,
@@ -130,16 +129,12 @@ merge_reintegrate_locked(const char *sou
                          svn_client_ctx_t *ctx,
                          apr_pool_t *scratch_pool)
 {
-  svn_ra_session_t *source_ra_session;
-  svn_ra_session_t *target_ra_session;
   const char *url1, *url2;
   svn_revnum_t rev1, rev2;
-  svn_revnum_t yc_ancestor_rev;
 
   SVN_ERR(svn_client_find_reintegrate_merge(
-            &source_ra_session, &target_ra_session,
-            &url1, &rev1, &url2, &rev2, &yc_ancestor_rev,
-            source, peg_revision, target_wc_abspath,
+            &url1, &rev1, &url2, &rev2,
+            source_path_or_url, source_peg_revision, target_wcpath,
             ctx, scratch_pool, scratch_pool));
 
   if (! quiet)
@@ -155,11 +150,23 @@ merge_reintegrate_locked(const char *sou
              svn_path_local_style(target_wcpath, scratch_pool));
     }
 
-  SVN_ERR(svn_client_do_reintegrate_merge(
-            source_ra_session, target_ra_session,
-            url1, rev1, url2, rev2, yc_ancestor_rev,
-            target_wc_abspath,
-            dry_run, merge_options, ctx, scratch_pool));
+  if (url1)
+    {
+      svn_opt_revision_t revision1 = { svn_opt_revision_number, { rev1 } };
+      svn_opt_revision_t revision2 = { svn_opt_revision_number, { rev2 } };
+
+      /* Do the merge.  Set 'allow_mixed_rev' to true, not because we want
+       * to allow a mixed-rev WC but simply to bypass the check, as it was
+       * already checked in svn_client_find_reintegrate_merge(). */
+      SVN_ERR(svn_client_merge4(url1, &revision1, url2, &revision2,
+                                target_wcpath, svn_depth_infinity,
+                                FALSE /* ignore_ancestry */,
+                                FALSE /* force */,
+                                FALSE /* record_only */,
+                                dry_run, TRUE /* allow_mixed_rev */,
+                                merge_options, ctx, scratch_pool));
+    }
+
   return SVN_NO_ERROR;
 }
 



Mime
View raw message