subversion-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From rhuij...@apache.org
Subject svn commit: r1661195 - in /subversion/trunk/subversion: libsvn_client/blame.c tests/cmdline/blame_tests.py
Date Fri, 20 Feb 2015 19:22:21 GMT
Author: rhuijben
Date: Fri Feb 20 19:22:21 2015
New Revision: 1661195

URL: http://svn.apache.org/r1661195
Log:
When producing blame information backwards we don't have an obvious revision
outside the version range where we don't want to produce information for,
which representst the file at the start of the range.

I'm guessing things will be more sane if we collect the highest revision
within the range and then filter the information... this is what the file
looks like at the end of the range.

* subversion/libsvn_client/blame.c
  (file_rev_baton): Add variable.
  (file_rev_handler): Track highest revision.
  (svn_client_blame5): Determine if there is a specific revision we should
    shouldn't produce details for.

* subversion/tests/cmdline/blame_tests.py
  (blame_reverse_no_change): Update expected result. Extend.

Modified:
    subversion/trunk/subversion/libsvn_client/blame.c
    subversion/trunk/subversion/tests/cmdline/blame_tests.py

Modified: subversion/trunk/subversion/libsvn_client/blame.c
URL: http://svn.apache.org/viewvc/subversion/trunk/subversion/libsvn_client/blame.c?rev=1661195&r1=1661194&r2=1661195&view=diff
==============================================================================
--- subversion/trunk/subversion/libsvn_client/blame.c (original)
+++ subversion/trunk/subversion/libsvn_client/blame.c Fri Feb 20 19:22:21 2015
@@ -76,6 +76,7 @@ struct diff_baton {
 /* The baton used for a file revision. Lives the entire operation */
 struct file_rev_baton {
   svn_revnum_t start_rev, end_rev;
+  svn_revnum_t highest_rev; /* highest revision received */
   const char *target;
   svn_client_ctx_t *ctx;
   const svn_diff_file_options_t *diff_options;
@@ -431,6 +432,9 @@ file_rev_handler(void *baton, const char
   /* Clear the current pool. */
   svn_pool_clear(frb->currpool);
 
+  if (revnum > frb->highest_rev)
+    frb->highest_rev = revnum;
+
   if (frb->ctx->notify_func2)
     {
       svn_wc_notify_t *notify
@@ -630,6 +634,7 @@ svn_client_blame5(const char *target,
   svn_stream_t *stream;
   const char *target_abspath_or_url;
   svn_revnum_t youngest;
+  svn_revnum_t ignore_rev = SVN_INVALID_REVNUM-1;
 
   if (start->kind == svn_opt_revision_unspecified
       || end->kind == svn_opt_revision_unspecified)
@@ -704,6 +709,7 @@ svn_client_blame5(const char *target,
 
   frb.start_rev = start_revnum;
   frb.end_rev = end_revnum;
+  frb.highest_rev = SVN_INVALID_REVNUM; /* -1 */
   frb.target = target;
   frb.ctx = ctx;
   frb.diff_options = diff_options;
@@ -839,6 +845,9 @@ svn_client_blame5(const char *target,
       walk_merged = frb.merged_chain->blame;
     }
 
+  if (frb.start_rev > frb.end_rev)
+    ignore_rev = frb.highest_rev;
+
   /* Process each blame item. */
   for (walk = frb.chain->blame; walk; walk = walk->next)
     {
@@ -873,7 +882,7 @@ svn_client_blame5(const char *target,
             SVN_ERR(ctx->cancel_func(ctx->cancel_baton));
           if (!eof || sb->len)
             {
-              if (walk->rev)
+              if (walk->rev && walk->rev->revision != ignore_rev)
                 SVN_ERR(receiver(receiver_baton, start_revnum, end_revnum,
                                  line_no, walk->rev->revision,
                                  walk->rev->rev_props, merged_rev,

Modified: subversion/trunk/subversion/tests/cmdline/blame_tests.py
URL: http://svn.apache.org/viewvc/subversion/trunk/subversion/tests/cmdline/blame_tests.py?rev=1661195&r1=1661194&r2=1661195&view=diff
==============================================================================
--- subversion/trunk/subversion/tests/cmdline/blame_tests.py (original)
+++ subversion/trunk/subversion/tests/cmdline/blame_tests.py Fri Feb 20 19:22:21 2015
@@ -1001,12 +1001,63 @@ def blame_reverse_no_change(sbox):
                                      'blame', '-r2:HEAD', sbox.ospath('iota'))
 
   expected_output = [
-    '     4    jrandom This is the file \'iota\'.\n',
+    '     -          - This is the file \'iota\'.\n',
   ]
   # This used to trigger an assertion on 1.9.x before 1.9.0
   svntest.actions.run_and_verify_svn(expected_output, [],
                                      'blame', '-rHEAD:2', sbox.ospath('iota'))
 
+  # Drop the middle line
+  sbox.simple_append('iota', 'This is the file \'iota\'.\n'
+                             'another new line\n', truncate=True)
+  sbox.simple_commit('') #r5
+
+  # Back to start
+  sbox.simple_append('iota', 'This is the file \'iota\'.\n', truncate=True)
+  sbox.simple_commit('') #r6
+
+  expected_output = [
+    '     -          - This is the file \'iota\'.\n',
+  ]
+  svntest.actions.run_and_verify_svn(expected_output, [],
+                                     'blame', '-rHEAD:2', sbox.ospath('iota'))
+
+  expected_output = [
+    '     -          - This is the file \'iota\'.\n',
+    '     4    jrandom new line\n',
+  ]
+  svntest.actions.run_and_verify_svn(expected_output, [],
+                                     'blame', '-rHEAD:3', sbox.ospath('iota'))
+
+  expected_output = [
+    '     -          - This is the file \'iota\'.\n',
+    '     4    jrandom new line\n',
+    '     5    jrandom another new line\n',
+  ]
+  svntest.actions.run_and_verify_svn(expected_output, [],
+                                     'blame', '-rHEAD:4', sbox.ospath('iota'))
+
+  expected_output = [
+    '     -          - This is the file \'iota\'.\n',
+    '     5    jrandom another new line\n',
+  ]
+  svntest.actions.run_and_verify_svn(expected_output, [],
+                                     'blame', '-rHEAD:5', sbox.ospath('iota'))
+
+  expected_output = [
+    '     -          - This is the file \'iota\'.\n',
+  ]
+  svntest.actions.run_and_verify_svn(expected_output, [],
+                                     'blame', '-rHEAD:6', sbox.ospath('iota'))
+
+
+  expected_output = [
+    '     -          - This is the file \'iota\'.\n',
+    '     4    jrandom new line\n',
+  ]
+  svntest.actions.run_and_verify_svn(expected_output, [],
+                                     'blame', '-r5:3', sbox.ospath('iota'))
+
 
 ########################################################################
 # Run the tests



Mime
View raw message