[svn.haxx.se] · SVN Dev · SVN Users · SVN Org · TSVN Dev · TSVN Users · Subclipse Dev · Subclipse Users · this month's index

[PATCH] blame: treat start/end symmetrically

From: Daniel Shahaf <danielsh_at_elego.de>
Date: Mon, 1 Jul 2013 19:50:56 +0300

I'm not familiar with this part of the code - can I have a second pair
of eyes over this, please?

[[[
* subversion/libsvn_client/blame.c
  (svn_client_blame5): When opening the RA session, treat START and END
    symmetrically: do not always open to END, since START may be younger.
]]]

[[[
Index: subversion/libsvn_client/blame.c
===================================================================
--- subversion/libsvn_client/blame.c (revision 1498532)
+++ subversion/libsvn_client/blame.c (working copy)
@@ -585,7 +585,6 @@ svn_client_blame5(const char *target,
   struct file_rev_baton frb;
   svn_ra_session_t *ra_session;
   svn_revnum_t start_revnum, end_revnum;
- svn_client__pathrev_t *end_loc;
   struct blame *walk, *walk_merged = NULL;
   apr_pool_t *iterpool;
   svn_stream_t *last_stream;
@@ -604,33 +603,34 @@ svn_client_blame5(const char *target,
     SVN_ERR(svn_dirent_get_absolute(&target_abspath_or_url, target, pool));
 
   /* Get an RA plugin for this filesystem object. */
- SVN_ERR(svn_client__ra_session_from_path2(&ra_session, &end_loc,
- target, NULL, peg_revision, end,
+ SVN_ERR(svn_client__ra_session_from_path2(&ra_session, NULL,
+ target, NULL, peg_revision,
+ peg_revision,
                                             ctx, pool));
- end_revnum = end_loc->rev;
 
   SVN_ERR(svn_client__get_revision_number(&start_revnum, NULL, ctx->wc_ctx,
                                           target_abspath_or_url, ra_session,
                                           start, pool));
 
- if (start_revnum > end_revnum)
- {
- /* Repeat the last bit of svn_client__ra_session_from_path2(), to end
- up where we would have ended up if we had passed 'start' rather than
- 'end' to it.
- ### Should we try calling
- ### svn_client__open_ra_session_internal(peg_revision, start)
- ### if calling it with (peg_revision, end) fails?
- */
- svn_client__pathrev_t *start_loc;
- SVN_ERR(svn_client__resolve_rev_and_url(&start_loc, ra_session,
- target, peg_revision, start,
- ctx, pool));
-
- /* Make the session point to the real URL. */
- SVN_ERR(svn_ra_reparent(ra_session, start_loc->url, pool));
- }
+ SVN_ERR(svn_client__get_revision_number(&end_revnum, NULL, ctx->wc_ctx,
+ target_abspath_or_url, ra_session,
+ end, pool));
 
+ {
+ svn_client__pathrev_t *loc;
+ svn_opt_revision_t younger_end;
+ younger_end.kind = svn_opt_revision_number;
+ younger_end.value.number = MAX(start_revnum, end_revnum);
+
+ SVN_ERR(svn_client__resolve_rev_and_url(&loc, ra_session,
+ target, peg_revision,
+ &younger_end,
+ ctx, pool));
+
+ /* Make the session point to the real URL. */
+ SVN_ERR(svn_ra_reparent(ra_session, loc->url, pool));
+ }
+
   /* We check the mime-type of the yougest revision before getting all
      the older revisions. */
   if (!ignore_mime_type)
]]]
Received on 2013-07-01 18:51:39 CEST

This is an archived mail posted to the Subversion Dev mailing list.

This site is subject to the Apache Privacy Policy and the Apache Public Forum Archive Policy.