You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@subversion.apache.org by cm...@apache.org on 2013/04/11 19:59:40 UTC

svn commit: r1467013 - in /subversion/trunk/subversion: include/svn_client.h libsvn_client/mergeinfo.c svn/mergeinfo-cmd.c

Author: cmpilato
Date: Thu Apr 11 17:59:39 2013
New Revision: 1467013

URL: http://svn.apache.org/r1467013
Log:
Tighten input requirements for a function to simply its documentation
and input validation.

* subversion/include/svn_client.h
  (svn_client_mergeinfo_log2): Update docstring to explain that
    source_start_revision and source_end_revision must have matching
    levels of specificity, and otherwise rework it for clarity.

* subversion/libsvn_client/mergeinfo.c
  (svn_client_mergeinfo_log2): Require source_start_revision and
    source_end_revision to either both be specified, or both be
    unspecified.

* subversion/svn/mergeinfo-cmd.c
  (svn_cl__mergeinfo): Tweak to honor new requirements for
    'source_start_revision' and 'source_end_revision' parameters of
    svn_client_mergeinfo_log2().

Modified:
    subversion/trunk/subversion/include/svn_client.h
    subversion/trunk/subversion/libsvn_client/mergeinfo.c
    subversion/trunk/subversion/svn/mergeinfo-cmd.c

Modified: subversion/trunk/subversion/include/svn_client.h
URL: http://svn.apache.org/viewvc/subversion/trunk/subversion/include/svn_client.h?rev=1467013&r1=1467012&r2=1467013&view=diff
==============================================================================
--- subversion/trunk/subversion/include/svn_client.h (original)
+++ subversion/trunk/subversion/include/svn_client.h Thu Apr 11 17:59:39 2013
@@ -3886,17 +3886,22 @@ svn_client_mergeinfo_get_merged(apr_hash
  * @a target_path_or_url (as of @a target_peg_revision).  If @a
  * finding_merged is FALSE then find the revisions eligible for merging.
  *
- * @a source_start_revision and @a source_end_revision bound the
- * operative range of revisions of the merge source which are
- * described to the caller.  If @a source_end_revision is of kind
- * @c svn_opt_revision_unspecified, it is interpreted as the same
- * revision as @a source_start_revision.  If both are of kind
- * @c svn_opt_revision_unspecified, no bounding occurs and the entire
- * history of the merge source (up to @a source_peg_revision, per the
- * typical default peg/operative revision behaviors) is considered.
- * If @a source_start_revision is younger than @a source_end_revision,
- * then @a receiver is called from youngest to oldest revisions.
- * Otherwise @a receiver is called from oldest to youngest revisions.
+ * If both @a source_start_revision and @a source_end_revision are
+ * unspecified (that is, of kind @c svn_opt_revision_unspecified),
+ * @a receiver will be called the requested revisions from 0 to
+ * @a source_peg_revision and in that order (that is, oldest to
+ * youngest).  Otherwise, both @a source_start_revision and
+ * @a source_end_revision must be specified, which has two effects:
+ *
+ *   - @a receiver will be called only with revisions which fall
+ *     within range of @a source_start_revision to
+ *     @a source_end_revision, inclusive, and
+ *
+ *   - those revisions will be ordered in the same "direction" as the
+ *     walk from @a source_start_revision to @a source_end_revision.
+ *     (If @a source_start_revision is the younger of the two, @a
+ *     receiver will be called with revisions in youngest-to-oldest
+ *     order; otherwise, the reverse occurs.)
  *
  * If @a depth is #svn_depth_empty consider only the explicit or
  * inherited mergeinfo on @a target_path_or_url when calculating merged

Modified: subversion/trunk/subversion/libsvn_client/mergeinfo.c
URL: http://svn.apache.org/viewvc/subversion/trunk/subversion/libsvn_client/mergeinfo.c?rev=1467013&r1=1467012&r2=1467013&view=diff
==============================================================================
--- subversion/trunk/subversion/libsvn_client/mergeinfo.c (original)
+++ subversion/trunk/subversion/libsvn_client/mergeinfo.c Thu Apr 11 17:59:39 2013
@@ -1706,9 +1706,12 @@ svn_client_mergeinfo_log2(svn_boolean_t 
         (source_end_revision->kind == svn_opt_revision_date) ||
         (source_end_revision->kind == svn_opt_revision_head)))
     return svn_error_create(SVN_ERR_CLIENT_BAD_REVISION, NULL, NULL);
+  if ((source_end_revision->kind != svn_opt_revision_unspecified)
+      && (source_start_revision->kind == svn_opt_revision_unspecified))
+    return svn_error_create(SVN_ERR_CLIENT_BAD_REVISION, NULL, NULL);
   if ((source_end_revision->kind == svn_opt_revision_unspecified)
       && (source_start_revision->kind != svn_opt_revision_unspecified))
-    source_end_revision = source_start_revision;
+    return svn_error_create(SVN_ERR_CLIENT_BAD_REVISION, NULL, NULL);
 
   /* We need the union of TARGET_PATH_OR_URL@TARGET_PEG_REVISION's mergeinfo
      and MERGE_SOURCE_URL's history.  It's not enough to do path

Modified: subversion/trunk/subversion/svn/mergeinfo-cmd.c
URL: http://svn.apache.org/viewvc/subversion/trunk/subversion/svn/mergeinfo-cmd.c?rev=1467013&r1=1467012&r2=1467013&view=diff
==============================================================================
--- subversion/trunk/subversion/svn/mergeinfo-cmd.c (original)
+++ subversion/trunk/subversion/svn/mergeinfo-cmd.c Thu Apr 11 17:59:39 2013
@@ -249,6 +249,7 @@ svn_cl__mergeinfo(apr_getopt_t *os,
   apr_array_header_t *targets;
   const char *source, *target;
   svn_opt_revision_t src_peg_revision, tgt_peg_revision;
+  svn_opt_revision_t *src_start_revision, *src_end_revision;
   /* Default to depth empty. */
   svn_depth_t depth = (opt_state->depth == svn_depth_unknown)
                       ? svn_depth_empty : opt_state->depth;
@@ -301,13 +302,19 @@ svn_cl__mergeinfo(apr_getopt_t *os,
                                                     ctx, pool),
             _("Source and target must be different but related branches"));
 
+  src_start_revision = &(opt_state->start_revision);
+  if (opt_state->end_revision.kind == svn_opt_revision_unspecified)
+    src_end_revision = src_start_revision;
+  else
+    src_end_revision = &(opt_state->end_revision);
+  
   /* Do the real work, depending on the requested data flavor. */
   if (opt_state->show_revs == svn_cl__show_revs_merged)
     {
       SVN_ERR(svn_client_mergeinfo_log2(TRUE, target, &tgt_peg_revision,
                                         source, &src_peg_revision,
-                                        &(opt_state->start_revision),
-                                        &(opt_state->end_revision),
+                                        src_start_revision,
+                                        src_end_revision,
                                         print_log_rev, NULL,
                                         TRUE, depth, NULL, ctx,
                                         pool));
@@ -316,8 +323,8 @@ svn_cl__mergeinfo(apr_getopt_t *os,
     {
       SVN_ERR(svn_client_mergeinfo_log2(FALSE, target, &tgt_peg_revision,
                                         source, &src_peg_revision,
-                                        &(opt_state->start_revision),
-                                        &(opt_state->end_revision),
+                                        src_start_revision,
+                                        src_end_revision,
                                         print_log_rev, NULL,
                                         TRUE, depth, NULL, ctx,
                                         pool));