subversion-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From julianf...@apache.org
Subject svn commit: r1188814 - in /subversion/branches/showing-merge-info/subversion/svn: cl.h mergeinfo-cmd.c util.c
Date Tue, 25 Oct 2011 17:29:00 GMT
Author: julianfoad
Date: Tue Oct 25 17:29:00 2011
New Revision: 1188814

URL: http://svn.apache.org/viewvc?rev=1188814&view=rev
Log:
On the 'showing-merge-info' branch: Move utility functions.

* subversion/svn/cl.h,
  subversion/svn/util.c
  (svn_cl__target_for_display, svn_cl__find_merge_source_branch): New, moved
    and renamed from ...

* subversion/svn/mergeinfo-cmd.c
  (target_for_display, find_source_branch): ... here.
  (svn_cl__mergeinfo): Adjust calls.

Modified:
    subversion/branches/showing-merge-info/subversion/svn/cl.h
    subversion/branches/showing-merge-info/subversion/svn/mergeinfo-cmd.c
    subversion/branches/showing-merge-info/subversion/svn/util.c

Modified: subversion/branches/showing-merge-info/subversion/svn/cl.h
URL: http://svn.apache.org/viewvc/subversion/branches/showing-merge-info/subversion/svn/cl.h?rev=1188814&r1=1188813&r2=1188814&view=diff
==============================================================================
--- subversion/branches/showing-merge-info/subversion/svn/cl.h (original)
+++ subversion/branches/showing-merge-info/subversion/svn/cl.h Tue Oct 25 17:29:00 2011
@@ -833,6 +833,19 @@ svn_cl__local_style_skip_ancestor(const 
                                   const char *path,
                                   apr_pool_t *pool);
 
+/* */
+const char *
+svn_cl__target_for_display(const svn_client_target_t *target,
+                           apr_pool_t *pool);
+
+/* Find the preferred "parent" branch.  At the moment, returns the
+ * copyfrom path, assumed still to exist at the same path in head. */
+svn_error_t *
+svn_cl__find_merge_source_branch(svn_client_target_t **source_p,
+                                 svn_client_target_t *target,
+                                 svn_client_ctx_t *ctx,
+                                 apr_pool_t *pool);
+
 #ifdef __cplusplus
 }
 #endif /* __cplusplus */

Modified: subversion/branches/showing-merge-info/subversion/svn/mergeinfo-cmd.c
URL: http://svn.apache.org/viewvc/subversion/branches/showing-merge-info/subversion/svn/mergeinfo-cmd.c?rev=1188814&r1=1188813&r2=1188814&view=diff
==============================================================================
--- subversion/branches/showing-merge-info/subversion/svn/mergeinfo-cmd.c (original)
+++ subversion/branches/showing-merge-info/subversion/svn/mergeinfo-cmd.c Tue Oct 25 17:29:00
2011
@@ -85,35 +85,6 @@ print_log_rev(const svn_client_merged_re
   return SVN_NO_ERROR;
 }
 
-/* */
-static svn_boolean_t
-location_is_resolved(const svn_client_target_t *location)
-{
-  return (location->repos_uuid != NULL);
-}
-
-/* */
-static const char *
-target_for_display(const svn_client_target_t *target,
-                   apr_pool_t *pool)
-{
-  SVN_ERR_ASSERT_NO_RETURN(location_is_resolved(target));
-  if (target->revision.kind == svn_opt_revision_working)
-    {
-      SVN_ERR_ASSERT_NO_RETURN(target->peg_revision.kind == svn_opt_revision_working);
-      return apr_psprintf(pool, "^/%s (working copy)",
-                          target->repos_relpath);
-    }
-  if (target->revision.kind == svn_opt_revision_base)
-    {
-      SVN_ERR_ASSERT_NO_RETURN(target->peg_revision.kind == svn_opt_revision_base);
-      return apr_psprintf(pool, "^/%s (wc base)",
-                          target->repos_relpath);
-    }
-  return apr_psprintf(pool, "^/%s (r%ld)",
-                      target->repos_relpath, target->repos_revnum);
-}
-
 /* Return TRUE iff SOURCE and TARGET refer to the same repository branch. */
 static svn_boolean_t
 targets_are_same_branch(svn_client_target_t *source,
@@ -123,32 +94,6 @@ targets_are_same_branch(svn_client_targe
   return (strcmp(source->repos_relpath, target->repos_relpath) == 0);
 }
 
-/* Find the preferred "parent" branch.  At the moment, returns the
- * copyfrom path (at peg rev r1170000). */
-static svn_error_t *
-find_source_branch(svn_client_target_t **source_p,
-                   svn_client_target_t *target,
-                   svn_client_ctx_t *ctx,
-                   apr_pool_t *pool)
-{
-  apr_array_header_t *suggestions;
-  const char *copyfrom_url;
-  svn_opt_revision_t peg_revision = { svn_opt_revision_number, { 1170000 } };
-
-  /* This isn't properly doc'd, but the first result it gives is the
-   * copyfrom source URL. */
-  SVN_ERR(svn_client_suggest_merge_sources(&suggestions,
-                                           target->path_or_url,
-                                           &target->peg_revision,
-                                           ctx, pool));
-  copyfrom_url = APR_ARRAY_IDX(suggestions, 0, const char *);
-
-  SVN_ERR(svn_client__target(source_p, copyfrom_url, &peg_revision, pool));
-  (*source_p)->revision.kind = svn_opt_revision_unspecified;
-
-  return SVN_NO_ERROR;
-}
-
 /* This implements the `svn_opt_subcommand_t' interface. */
 svn_error_t *
 svn_cl__mergeinfo(apr_getopt_t *os,
@@ -207,13 +152,13 @@ svn_cl__mergeinfo(apr_getopt_t *os,
   else
     {
       printf("Assuming source branch is copied-from source of target branch.\n");
-      SVN_ERR(find_source_branch(&source, target, ctx, pool));
+      SVN_ERR(svn_cl__find_merge_source_branch(&source, target, ctx, pool));
     }
 
   SVN_ERR(svn_client__resolve_target_location(source, NULL, ctx, pool));
 
-  printf("Source branch: %s\n", target_for_display(source, pool));
-  printf("Target branch: %s\n", target_for_display(target, pool));
+  printf("Source branch: %s\n", svn_cl__target_for_display(source, pool));
+  printf("Target branch: %s\n", svn_cl__target_for_display(target, pool));
 
   if (targets_are_same_branch(source, target, pool))
     {

Modified: subversion/branches/showing-merge-info/subversion/svn/util.c
URL: http://svn.apache.org/viewvc/subversion/branches/showing-merge-info/subversion/svn/util.c?rev=1188814&r1=1188813&r2=1188814&view=diff
==============================================================================
--- subversion/branches/showing-merge-info/subversion/svn/util.c (original)
+++ subversion/branches/showing-merge-info/subversion/svn/util.c Tue Oct 25 17:29:00 2011
@@ -1419,3 +1419,55 @@ svn_cl__local_style_skip_ancestor(const 
 
   return svn_dirent_local_style(relpath ? relpath : path, pool);
 }
+
+/* */
+static svn_boolean_t
+location_is_resolved(const svn_client_target_t *location)
+{
+  return (location->repos_uuid != NULL);
+}
+
+const char *
+svn_cl__target_for_display(const svn_client_target_t *target,
+                           apr_pool_t *pool)
+{
+  SVN_ERR_ASSERT_NO_RETURN(location_is_resolved(target));
+  if (target->revision.kind == svn_opt_revision_working)
+    {
+      SVN_ERR_ASSERT_NO_RETURN(target->peg_revision.kind == svn_opt_revision_working);
+      return apr_psprintf(pool, "^/%s (working copy)",
+                          target->repos_relpath);
+    }
+  if (target->revision.kind == svn_opt_revision_base)
+    {
+      SVN_ERR_ASSERT_NO_RETURN(target->peg_revision.kind == svn_opt_revision_base);
+      return apr_psprintf(pool, "^/%s (wc base)",
+                          target->repos_relpath);
+    }
+  return apr_psprintf(pool, "^/%s (r%ld)",
+                      target->repos_relpath, target->repos_revnum);
+}
+
+svn_error_t *
+svn_cl__find_merge_source_branch(svn_client_target_t **source_p,
+                                 svn_client_target_t *target,
+                                 svn_client_ctx_t *ctx,
+                                 apr_pool_t *pool)
+{
+  apr_array_header_t *suggestions;
+  const char *copyfrom_url;
+  svn_opt_revision_t peg_revision = { svn_opt_revision_head, { 0 } };
+
+  /* This isn't properly doc'd, but the first result it gives is the
+   * copyfrom source URL. */
+  SVN_ERR(svn_client_suggest_merge_sources(&suggestions,
+                                           target->path_or_url,
+                                           &target->peg_revision,
+                                           ctx, pool));
+  copyfrom_url = APR_ARRAY_IDX(suggestions, 0, const char *);
+
+  SVN_ERR(svn_client__target(source_p, copyfrom_url, &peg_revision, pool));
+  (*source_p)->revision.kind = svn_opt_revision_unspecified;
+
+  return SVN_NO_ERROR;
+}



Mime
View raw message