You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@subversion.apache.org by ph...@apache.org on 2011/04/19 12:22:22 UTC

svn commit: r1094997 - in /subversion/trunk/subversion: libsvn_repos/rev_hunt.c tests/cmdline/blame_tests.py

Author: philip
Date: Tue Apr 19 10:22:22 2011
New Revision: 1094997

URL: http://svn.apache.org/viewvc?rev=1094997&view=rev
Log:
Fix issue 3861, restrict merge search to -rN:M for blame -g.

* subversion/libsvn_repos/rev_hunt.c
  (find_merged_revisions): Add start revision parameter, skip merges
   from before start.
  (svn_repos_get_file_revs2): Pass start revision.

* subversion/tests/cmdline/blame_tests.py
  (blame_output_after_merge): Add -rN:M cases.

Modified:
    subversion/trunk/subversion/libsvn_repos/rev_hunt.c
    subversion/trunk/subversion/tests/cmdline/blame_tests.py

Modified: subversion/trunk/subversion/libsvn_repos/rev_hunt.c
URL: http://svn.apache.org/viewvc/subversion/trunk/subversion/libsvn_repos/rev_hunt.c?rev=1094997&r1=1094996&r2=1094997&view=diff
==============================================================================
--- subversion/trunk/subversion/libsvn_repos/rev_hunt.c (original)
+++ subversion/trunk/subversion/libsvn_repos/rev_hunt.c Tue Apr 19 10:22:22 2011
@@ -1226,6 +1226,7 @@ compare_path_revisions(const void *a, co
 
 static svn_error_t *
 find_merged_revisions(apr_array_header_t **merged_path_revisions_out,
+                      svn_revnum_t start,
                       const apr_array_header_t *mainline_path_revisions,
                       svn_repos_t *repos,
                       apr_hash_t *duplicate_path_revs,
@@ -1285,7 +1286,11 @@ find_merged_revisions(apr_array_header_t
                   svn_node_kind_t kind;
                   svn_fs_root_t *root;
 
+                  if (range->end < start)
+                    continue;
+
                   svn_pool_clear(iterpool3);
+
                   SVN_ERR(svn_fs_revision_root(&root, repos->fs, range->end,
                                                iterpool3));
                   SVN_ERR(svn_fs_check_path(&kind, root, path, iterpool3));
@@ -1466,7 +1471,7 @@ svn_repos_get_file_revs2(svn_repos_t *re
 
   /* If we are including merged revisions, go get those, too. */
   if (include_merged_revisions)
-    SVN_ERR(find_merged_revisions(&merged_path_revisions,
+    SVN_ERR(find_merged_revisions(&merged_path_revisions, start,
                                   mainline_path_revisions, repos,
                                   duplicate_path_revs, authz_read_func,
                                   authz_read_baton, pool));

Modified: subversion/trunk/subversion/tests/cmdline/blame_tests.py
URL: http://svn.apache.org/viewvc/subversion/trunk/subversion/tests/cmdline/blame_tests.py?rev=1094997&r1=1094996&r2=1094997&view=diff
==============================================================================
--- subversion/trunk/subversion/tests/cmdline/blame_tests.py (original)
+++ subversion/trunk/subversion/tests/cmdline/blame_tests.py Tue Apr 19 10:22:22 2011
@@ -710,6 +710,30 @@ def blame_output_after_merge(sbox):
   svntest.actions.run_and_verify_svn(None, expected_output, [],
                                     'blame', '-g', mu_path)
 
+  # Now test with -rN:M
+  expected_output = [ "     -          - New version of file 'mu'.\n",
+                      "     -          - 2nd line in file 'mu'.\n",
+                      "     7    jrandom new 3rd line in file 'mu'.\n",
+                      "     7    jrandom add 3.5 line in file 'mu'.\n",
+                      "     -          - 4th line in file 'mu'.\n",
+                      "     -          - 5th line in file 'mu'.\n",
+                      "     -          - 6th line in file 'mu'.\n"]
+
+  svntest.actions.run_and_verify_svn(None, expected_output, [],
+                                    'blame',  '-r', '4:head', mu_path)
+
+  # Next test with the -g option with -rN:M
+  expected_output = [ "       -          - New version of file 'mu'.\n",
+                      "       -          - 2nd line in file 'mu'.\n",
+                      "G      -          - new 3rd line in file 'mu'.\n",
+                      "G      6    jrandom add 3.5 line in file 'mu'.\n",
+                      "       -          - 4th line in file 'mu'.\n",
+                      "       -          - 5th line in file 'mu'.\n",
+                      "       -          - 6th line in file 'mu'.\n"]
+
+  svntest.actions.run_and_verify_svn(None, expected_output, [],
+                                    'blame', '-g', '-r', '6:head', mu_path)
+
 ########################################################################
 # Run the tests