subversion-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From pbu...@apache.org
Subject svn commit: r1463237 - in /subversion/trunk/subversion: include/svn_client.h libsvn_client/mergeinfo.c tests/cmdline/mergeinfo_tests.py tests/cmdline/svntest/actions.py
Date Mon, 01 Apr 2013 18:22:21 GMT
Author: pburba
Date: Mon Apr  1 18:22:20 2013
New Revision: 1463237

URL: http://svn.apache.org/r1463237
Log:
Support 'svn mergeinfo -rSTART:END' requests where START > END.

Nobody is clamoring for this feature, but the API changes may help me with
an an ongoing issue #4329 'automatic merge uses reintegrate type merge if
source is fully synced' fix.

* subversion/include/svn_client.h

  (svn_client_mergeinfo_log2): Update doc string; previously we didn't
   specify what we did in the case where the start revision was younger
   than the end revision.
 
* subversion/libsvn_client/mergeinfo.c

  (logs_for_mergeinfo_rangelist): Add a new boolean argument signaling that
   the caller wants the merged/eligible revisions from youngest to oldest.

  (svn_client_mergeinfo_log2): Tolerate callers who specify a start revision
   younger than the end revision.  Update call  to
   logs_for_mergeinfo_rangelist.

* subversion/tests/cmdline/mergeinfo_tests.py

  (recursive_mergeinfo): Expand to test the case where merged/eligible
   revisions are requested in youngest to oldest order.

* subversion/tests/cmdline/svntest/actions.py

  (run_and_verify_mergeinfo): Don't sort the expected output, the doc string
   makes no such promises and it prevents us from expecting any output other
   than oldest to youngest.

Modified:
    subversion/trunk/subversion/include/svn_client.h
    subversion/trunk/subversion/libsvn_client/mergeinfo.c
    subversion/trunk/subversion/tests/cmdline/mergeinfo_tests.py
    subversion/trunk/subversion/tests/cmdline/svntest/actions.py

Modified: subversion/trunk/subversion/include/svn_client.h
URL: http://svn.apache.org/viewvc/subversion/trunk/subversion/include/svn_client.h?rev=1463237&r1=1463236&r2=1463237&view=diff
==============================================================================
--- subversion/trunk/subversion/include/svn_client.h (original)
+++ subversion/trunk/subversion/include/svn_client.h Mon Apr  1 18:22:20 2013
@@ -3984,6 +3984,9 @@ svn_client_mergeinfo_get_merged(apr_hash
  * @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 @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=1463237&r1=1463236&r2=1463237&view=diff
==============================================================================
--- subversion/trunk/subversion/libsvn_client/mergeinfo.c (original)
+++ subversion/trunk/subversion/libsvn_client/mergeinfo.c Mon Apr  1 18:22:20 2013
@@ -1488,6 +1488,7 @@ logs_for_mergeinfo_rangelist(const char 
                              const apr_array_header_t *merge_source_fspaths,
                              svn_boolean_t filtering_merged,
                              const svn_rangelist_t *rangelist,
+                             svn_boolean_t oldest_revs_first,
                              svn_mergeinfo_catalog_t target_mergeinfo_catalog,
                              const char *target_fspath,
                              svn_boolean_t discover_changed_paths,
@@ -1549,8 +1550,12 @@ logs_for_mergeinfo_rangelist(const char 
   /* Drive the log. */
   revision_ranges = apr_array_make(scratch_pool, 1,
                                    sizeof(svn_opt_revision_range_t *));
-  APR_ARRAY_PUSH(revision_ranges, svn_opt_revision_range_t *)
-    = svn_opt__revision_range_create(&oldest_rev, &youngest_rev, scratch_pool);
+  if (oldest_revs_first)
+    APR_ARRAY_PUSH(revision_ranges, svn_opt_revision_range_t *)
+      = svn_opt__revision_range_create(&oldest_rev, &youngest_rev, scratch_pool);
+  else
+    APR_ARRAY_PUSH(revision_ranges, svn_opt_revision_range_t *)
+      = svn_opt__revision_range_create(&youngest_rev, &oldest_rev, scratch_pool);
   SVN_ERR(svn_client_log5(target, &youngest_rev, revision_ranges,
                           0, discover_changed_paths, FALSE, FALSE, revprops,
                           filter_log_entry_with_rangelist, &fleb, ctx,
@@ -1682,6 +1687,7 @@ svn_client_mergeinfo_log2(svn_boolean_t 
   apr_hash_index_t *hi_catalog;
   apr_hash_index_t *hi;
   apr_pool_t *iterpool;
+  svn_boolean_t oldest_revs_first = TRUE;
 
   /* We currently only support depth = empty | infinity. */
   if (depth != svn_depth_infinity && depth != svn_depth_empty)
@@ -1799,9 +1805,13 @@ svn_client_mergeinfo_log2(svn_boolean_t 
                                             source_end_revision,
                                             sesspool));
     SVN_ERR(svn_client__get_history_as_mergeinfo(&source_history, NULL,
-                                                 pathrev, end_rev, start_rev,
+                                                 pathrev,
+                                                 MAX(end_rev, start_rev),
+                                                 MIN(end_rev, start_rev),
                                                  source_session, ctx,
                                                  scratch_pool));
+    if (start_rev > end_rev)
+      oldest_revs_first = FALSE;
 
     /* Close the source and target sessions. */
     svn_pool_destroy(sesspool);
@@ -2064,6 +2074,7 @@ svn_client_mergeinfo_log2(svn_boolean_t 
   SVN_ERR(logs_for_mergeinfo_rangelist(log_target, merge_source_fspaths,
                                        finding_merged,
                                        master_inheritable_rangelist,
+                                       oldest_revs_first,
                                        target_mergeinfo_cat,
                                        svn_fspath__join("/",
                                                         target_repos_relpath,

Modified: subversion/trunk/subversion/tests/cmdline/mergeinfo_tests.py
URL: http://svn.apache.org/viewvc/subversion/trunk/subversion/tests/cmdline/mergeinfo_tests.py?rev=1463237&r1=1463236&r2=1463237&view=diff
==============================================================================
--- subversion/trunk/subversion/tests/cmdline/mergeinfo_tests.py (original)
+++ subversion/trunk/subversion/tests/cmdline/mergeinfo_tests.py Mon Apr  1 18:22:20 2013
@@ -384,6 +384,14 @@ def recursive_mergeinfo(sbox):
                                            sbox.repo_url + '/A2',
                                            sbox.repo_url + '/A_COPY',
                                            '--show-revs', 'eligible', '-R')
+  # Do the same as above, but test that we can request the revisions
+  # in reverse order.
+  svntest.actions.run_and_verify_mergeinfo(adjust_error_for_server_version(""),
+                                           ['8*', '4*', '3'],
+                                           sbox.repo_url + '/A2',
+                                           sbox.repo_url + '/A_COPY',
+                                           '--show-revs', 'eligible', '-R',
+                                           '-r', '9:0')
 
   # Asking for merged revisions from A2 to A_COPY should show:
   #
@@ -406,6 +414,15 @@ def recursive_mergeinfo(sbox):
                                            A_COPY_path,
                                            '--show-revs', 'merged',
                                            '--depth', 'infinity')
+  # Do the same as above, but test that we can request the revisions
+  # in reverse order.
+  svntest.actions.run_and_verify_mergeinfo(adjust_error_for_server_version(""),
+                                           ['8*', '6', '5', '4*'],
+                                           A2_path,
+                                           A_COPY_path,
+                                           '--show-revs', 'merged',
+                                           '--depth', 'infinity',
+                                           '-r', '9:0')
 
   # A couple tests of problems found with initial issue #3242 fixes.
   # We should be able to check for the merged revs from a URL to a URL

Modified: subversion/trunk/subversion/tests/cmdline/svntest/actions.py
URL: http://svn.apache.org/viewvc/subversion/trunk/subversion/tests/cmdline/svntest/actions.py?rev=1463237&r1=1463236&r2=1463237&view=diff
==============================================================================
--- subversion/trunk/subversion/tests/cmdline/svntest/actions.py (original)
+++ subversion/trunk/subversion/tests/cmdline/svntest/actions.py Mon Apr  1 18:22:20 2013
@@ -1288,7 +1288,6 @@ def run_and_verify_mergeinfo(error_re_st
     return
 
   out = [_f for _f in [x.rstrip()[1:] for x in out] if _f]
-  expected_output.sort()
   extra_out = []
   if out != expected_output:
     exp_hash = dict.fromkeys(expected_output)



Mime
View raw message