You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@subversion.apache.org by da...@apache.org on 2013/06/14 13:25:14 UTC
svn commit: r1493027 - in /subversion/trunk/subversion:
libsvn_client/blame.c tests/cmdline/blame_tests.py
Author: danielsh
Date: Fri Jun 14 11:25:14 2013
New Revision: 1493027
URL: http://svn.apache.org/r1493027
Log:
Implement kidney blame (blame -r M:N with M<N).
* subversion/libsvn_client/blame.c
(file_rev_handler): Relax checks to account for the -r M:N, M>N case.
(svn_client_blame5): if M>N, do not error, and tweak the arguments
to svn_ra_get_file_revs2() accordingly.
* subversion/tests/cmdline/blame_tests.py
(blame_youngest_to_oldest): Expect it to pass.
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=1493027&r1=1493026&r2=1493027&view=diff
==============================================================================
--- subversion/trunk/subversion/libsvn_client/blame.c (original)
+++ subversion/trunk/subversion/libsvn_client/blame.c Fri Jun 14 11:25:14 2013
@@ -466,7 +466,7 @@ file_rev_handler(void *baton, const char
/* Create the rev structure. */
frb->rev = apr_pcalloc(frb->mainpool, sizeof(struct rev));
- if (revnum < frb->start_rev)
+ if (revnum < MIN(frb->start_rev, frb->end_rev))
{
/* We shouldn't get more than one revision before the starting
revision (unless of including merged revisions). */
@@ -479,7 +479,8 @@ file_rev_handler(void *baton, const char
}
else
{
- SVN_ERR_ASSERT(revnum <= frb->end_rev);
+ /* 1+ for the "youngest to oldest" blame */
+ SVN_ERR_ASSERT(revnum <= 1 + MAX(frb->end_rev, frb->start_rev));
/* Set values from revision props. */
frb->rev->revision = revnum;
@@ -578,6 +579,7 @@ svn_client_blame5(const char *target,
svn_stream_t *last_stream;
svn_stream_t *stream;
const char *target_abspath_or_url;
+ svn_revnum_t youngest;
if (start->kind == svn_opt_revision_unspecified
|| end->kind == svn_opt_revision_unspecified)
@@ -599,11 +601,6 @@ svn_client_blame5(const char *target,
target_abspath_or_url, ra_session,
start, pool));
- if (end_revnum < start_revnum)
- return svn_error_create
- (SVN_ERR_CLIENT_BAD_REVISION, NULL,
- _("Start revision must precede end revision"));
-
/* We check the mime-type of the yougest revision before getting all
the older revisions. */
if (!ignore_mime_type)
@@ -674,8 +671,12 @@ svn_client_blame5(const char *target,
We need to ensure that we get one revision before the start_rev,
if available so that we can know what was actually changed in the start
revision. */
+ SVN_ERR(svn_ra_get_latest_revnum(ra_session, &youngest, frb.currpool));
SVN_ERR(svn_ra_get_file_revs2(ra_session, "",
- start_revnum - (start_revnum > 0 ? 1 : 0),
+ start_revnum
+ - (0 < start_revnum && start_revnum <= end_revnum ? 1 : 0)
+ + (youngest > start_revnum && start_revnum > end_revnum ? 1 : 0),
+ /* ### blame 5 fails. */
end_revnum, include_merged_revisions,
file_rev_handler, &frb, 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=1493027&r1=1493026&r2=1493027&view=diff
==============================================================================
--- subversion/trunk/subversion/tests/cmdline/blame_tests.py (original)
+++ subversion/trunk/subversion/tests/cmdline/blame_tests.py Fri Jun 14 11:25:14 2013
@@ -957,7 +957,6 @@ def blame_eol_handling(sbox):
@SkipUnless(svntest.main.server_has_reverse_get_file_revs)
-@XFail()
def blame_youngest_to_oldest(sbox):
"blame_youngest_to_oldest"