Author: rhuijben
Date: Tue Feb 17 18:31:18 2015
New Revision: 1660463
URL: http://svn.apache.org/r1660463
Log:
Make svn_ra_get_file_revs2() capable of handling SVN_INVALID_REVNUM as head
revision.
* subversion/libsvn_repos/rev_hunt.c
(svn_repos_get_file_revs2): Convert invalid revisions to HEAD.
* subversion/tests/libsvn_client/mtcc-test.c
(handle_rev): Support bigger range.
(test_file_revs_both_ways): Extend test.
Modified:
subversion/trunk/subversion/libsvn_repos/rev_hunt.c
subversion/trunk/subversion/tests/libsvn_client/mtcc-test.c
Modified: subversion/trunk/subversion/libsvn_repos/rev_hunt.c
URL:
http://svn.apache.org/viewvc/subversion/trunk/subversion/libsvn_repos/rev_hunt.c?rev=1660463&r1=1660462&r2=1660463&view=diff
==============================================================================
--- subversion/trunk/subversion/libsvn_repos/rev_hunt.c (original)
+++ subversion/trunk/subversion/libsvn_repos/rev_hunt.c Tue Feb 17 18:31:18 2015
@@ -1559,6 +1559,18 @@ svn_repos_get_file_revs2(svn_repos_t *re
struct send_baton sb;
int mainline_pos, merged_pos;
+ if (!SVN_IS_VALID_REVNUM(start)
+ || !SVN_IS_VALID_REVNUM(end))
+ {
+ svn_revnum_t youngest_rev;
+ SVN_ERR(svn_fs_youngest_rev(&youngest_rev, repos->fs, scratch_pool));
+
+ if (!SVN_IS_VALID_REVNUM(start))
+ start = youngest_rev;
+ if (!SVN_IS_VALID_REVNUM(end))
+ end = youngest_rev;
+ }
+
if (end < start)
{
if (include_merged_revisions)
Modified: subversion/trunk/subversion/tests/libsvn_client/mtcc-test.c
URL:
http://svn.apache.org/viewvc/subversion/trunk/subversion/tests/libsvn_client/mtcc-test.c?rev=1660463&r1=1660462&r2=1660463&view=diff
==============================================================================
--- subversion/trunk/subversion/tests/libsvn_client/mtcc-test.c (original)
+++ subversion/trunk/subversion/tests/libsvn_client/mtcc-test.c Tue Feb 17
18:31:18 2015
@@ -489,11 +489,15 @@ handle_rev(void *baton,
struct handle_rev_baton *hrb = baton;
svn_revnum_t expected_rev = hrb->up ? (hrb->last + 1) : (hrb->last - 1);
+ if (expected_rev == 7)
+ expected_rev = hrb->up ? 8 : 6;
+ SVN_DBG(("%d vs %d (up=%d)", expected_rev, rev, hrb->up));
SVN_TEST_ASSERT(rev == expected_rev);
SVN_TEST_ASSERT(apr_hash_count(rev_props) >= 3);
SVN_TEST_STRING_ASSERT(path, (rev < 5) ? "/iota" : "/mu");
- if (!hrb->first && rev == (hrb->up ? 5 : 4))
+ if (!hrb->first
+ && (rev == (hrb->up ? 5 : 4) || rev == (hrb->up ? 8 : 6)))
SVN_TEST_ASSERT(delta_handler == NULL);
else
SVN_TEST_ASSERT(delta_handler != NULL);
@@ -615,6 +619,30 @@ test_file_revs_both_ways(const svn_test_
subpool));
SVN_TEST_ASSERT(hrb.last == 6);
+ /* Ressurect mu */
+ svn_pool_clear(subpool);
+ SVN_ERR(svn_client__mtcc_create(&mtcc, repos_url, 7, ctx, subpool, subpool));
+ SVN_ERR(svn_client__mtcc_add_copy("mu", 6, "mu", mtcc, subpool));
+ SVN_ERR(verify_mtcc_commit(mtcc, 8, subpool));
+
+ svn_pool_clear(subpool);
+ hrb.up = TRUE;
+ hrb.last = 0;
+ hrb.first = TRUE;
+ SVN_ERR(svn_ra_get_file_revs2(ra, "mu", 1, SVN_INVALID_REVNUM, FALSE,
+ handle_rev, &hrb,
+ subpool));
+ SVN_TEST_ASSERT(hrb.last == 8);
+
+ svn_pool_clear(subpool);
+ hrb.up = FALSE;
+ hrb.last = 9;
+ hrb.first = TRUE;
+ SVN_ERR(svn_ra_get_file_revs2(ra, "mu", SVN_INVALID_REVNUM, 1, FALSE,
+ handle_rev, &hrb,
+ subpool));
+ SVN_TEST_ASSERT(hrb.last == 1);
+
return SVN_NO_ERROR;
}