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

Re: [PATCH] Correctly handle SVN_INVALID_REVNUM in svn_repos_get_logs4 even for start < head

From: C. Michael Pilato <cmpilato_at_collab.net>
Date: Wed, 15 Oct 2008 00:50:06 +0200

David Glasser wrote:
> I'd run tests and commit, but apparently we now require a newer
> sqlite3 than my work machine has installed, and while I recognize that
> sqlite3 is really really easy to build, it's still more activation
> energy than I have today. Sorry.
>
> [[[
> * subversion/libsvn_repos/log.c
> (svn_repos_get_logs4): For the ascending-revisions case, handle
> SVN_INVALID_REVNUM
> arguments correctly.
> ]]]
>
> Index: subversion/libsvn_repos/log.c
> ===================================================================
> --- subversion/libsvn_repos/log.c (revision 33643)
> +++ subversion/libsvn_repos/log.c (working copy)
> @@ -1612,10 +1612,10 @@
> SVN_ERR(svn_fs_youngest_rev(&head, fs, pool));
>
> if (! SVN_IS_VALID_REVNUM(start))
> - start = head;
> + hist_start = start = head;
>
> if (! SVN_IS_VALID_REVNUM(end))
> - end = head;
> + hist_end = end = head;
>
> /* Check that revisions are sane before ever invoking receiver. */
> if (start > head)

Maybe we should just lose the quite-unnecessary hist_* variables? See
attached patch (tested just as well as yours).

-- 
C. Michael Pilato <cmpilato_at_collab.net>
CollabNet   <>   www.collab.net   <>   Distributed Development On Demand

* subversion/libsvn_repos/log.c
  (svn_repos_get_logs4): Lose redundate 'hist_start' and 'hist_end' variables.

Index: subversion/libsvn_repos/log.c
===================================================================
--- subversion/libsvn_repos/log.c (revision 33625)
+++ subversion/libsvn_repos/log.c (working copy)
@@ -1605,8 +1605,6 @@
   svn_revnum_t head = SVN_INVALID_REVNUM;
   svn_fs_t *fs = repos->fs;
   svn_boolean_t descending_order;
- svn_revnum_t hist_start = start;
- svn_revnum_t hist_end = end;
 
   /* Setup log range. */
   SVN_ERR(svn_fs_youngest_rev(&head, fs, pool));
@@ -1627,11 +1625,14 @@
       (SVN_ERR_FS_NO_SUCH_REVISION, 0,
        _("No such revision %ld"), end);
 
+ /* Ensure a youngest-to-oldest revision crawl ordering using our
+ (possibly sanitized) range values. */
   descending_order = start >= end;
   if (descending_order)
     {
- hist_start = end;
- hist_end = start;
+ svn_revnum_t tmp_rev = start;
+ start = end;
+ end = tmp_rev;
     }
 
   if (! paths)
@@ -1652,17 +1653,17 @@
       int i;
       apr_pool_t *iterpool = svn_pool_create(pool);
 
- send_count = hist_end - hist_start + 1;
+ send_count = end - start + 1;
       if (limit && send_count > limit)
         send_count = limit;
       for (i = 0; i < send_count; ++i)
         {
- svn_revnum_t rev = hist_start + i;
+ svn_revnum_t rev = start + i;
 
           svn_pool_clear(iterpool);
 
           if (descending_order)
- rev = hist_end - i;
+ rev = end - i;
           SVN_ERR(send_log(rev, fs, discover_changed_paths, revprops, FALSE,
                            receiver, receiver_baton, authz_read_func,
                            authz_read_baton, iterpool));
@@ -1672,7 +1673,7 @@
       return SVN_NO_ERROR;
     }
 
- return do_logs(repos->fs, paths, hist_start, hist_end, limit,
+ return do_logs(repos->fs, paths, start, end, limit,
                  discover_changed_paths, strict_node_history,
                  include_merged_revisions, revprops, descending_order,
                  receiver, receiver_baton,

Received on 2008-10-15 00:50:22 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.