Author: brane
Date: Sun May 10 05:42:23 2026
New Revision: 1934020
Log:
On the javahl-1.15 branch: Upgrade the native implementation to use
svn_client_upgrade2 and add WC upgrade tests.
* BRANCH-README: Update TODO and DONE lists.
[in subversion/bindings/javahl/native/]
* SVNClient.h (SVNClient::upgrade): Update the prototype.
* SVNClient.cpp (SVNClient::upgrade): Update the implementation.
* org_apache_subversion_javahl_SVNClient.cpp
(Java_org_apache_subversion_javahl_SVNClient_upgrade):
Update the native method.
[in subversion/bindings/javahl/src/org/apache/subversion/javahl/]
* ISVNClient.java
(ISVNClient.upgrade): Declare new version, deprecate the old one.
(SVNClient.upgrade): Declare new native method and add a compatibility
wrapper for the deprecated variant.
[in subversion/bindings/javahl/tests/org/apache/subversion/javahl/]
* BasicTests.java
(BasicTests.testBasicUpgrade, BasicTests.testLatestUpgrade): New tests.
* SVNTests.java
(SVNTests.OneTest.OneTest): Add a new option to check out the working copy
at its oldest compatible version. Add compatibility wrapper.
(SVNTests.OneTest.createInitialWorkingCopy): Add the same new option.
Modified:
subversion/branches/javahl-1.15/BRANCH-README
subversion/branches/javahl-1.15/subversion/bindings/javahl/native/SVNClient.cpp
subversion/branches/javahl-1.15/subversion/bindings/javahl/native/SVNClient.h
subversion/branches/javahl-1.15/subversion/bindings/javahl/native/org_apache_subversion_javahl_SVNClient.cpp
subversion/branches/javahl-1.15/subversion/bindings/javahl/src/org/apache/subversion/javahl/ISVNClient.java
subversion/branches/javahl-1.15/subversion/bindings/javahl/src/org/apache/subversion/javahl/SVNClient.java
subversion/branches/javahl-1.15/subversion/bindings/javahl/tests/org/apache/subversion/javahl/BasicTests.java
subversion/branches/javahl-1.15/subversion/bindings/javahl/tests/org/apache/subversion/javahl/SVNTests.java
Modified: subversion/branches/javahl-1.15/BRANCH-README
==============================================================================
--- subversion/branches/javahl-1.15/BRANCH-README Sun May 10 05:02:15
2026 (r1934019)
+++ subversion/branches/javahl-1.15/BRANCH-README Sun May 10 05:42:23
2026 (r1934020)
@@ -5,7 +5,6 @@ This is a temporary working branch to up
TODO:
* Update use of deprecated Subversion APIs:
- - svn_client_upgrade -> svn_client_upgrade2
- svn_client_diff6 -> svn_client_diff7
- svn_client_diff_peg6 -> svn_client_diff_peg7
- svn_client_revert3 -> svn_client_revert4
@@ -16,6 +15,7 @@ TODO:
DONE:
* Update use of deprecated Subversion APIs:
- svn_client_checkout3 -> svn_client_checkout4
+ - svn_client_upgrade -> svn_client_upgrade2
* Add Java wrappers for some new functionality
- .types.VersionNumber extends Version (package scope)
- .types.Version::getInstance(int major, int minor, int patch)
Modified:
subversion/branches/javahl-1.15/subversion/bindings/javahl/native/SVNClient.cpp
==============================================================================
---
subversion/branches/javahl-1.15/subversion/bindings/javahl/native/SVNClient.cpp
Sun May 10 05:02:15 2026 (r1934019)
+++
subversion/branches/javahl-1.15/subversion/bindings/javahl/native/SVNClient.cpp
Sun May 10 05:42:23 2026 (r1934020)
@@ -1470,19 +1470,27 @@ jstring SVNClient::getVersionInfo(const
return JNIUtil::makeJString(value.str().c_str());
}
-void SVNClient::upgrade(const char *path)
+jobject SVNClient::upgrade(::Java::Env env, const char *path,
+ const svn_version_t *targetWcVersion)
{
SVN::Pool subPool(pool);
- SVN_JNI_NULL_PTR_EX(path, "path", );
+ SVN_JNI_NULL_PTR_EX(path, "path", NULL);
svn_client_ctx_t *ctx = context.getContext(NULL, subPool);
if (ctx == NULL)
- return;
+ return NULL;
Path checkedPath(path, subPool);
- SVN_JNI_ERR(checkedPath.error_occurred(), );
+ SVN_JNI_ERR(checkedPath.error_occurred(), NULL);
- SVN_JNI_ERR(svn_client_upgrade(path, ctx, subPool.getPool()), );
+ apr_pool_t *pool = subPool.getPool();
+ const svn_version_t *wc_version = NULL;
+ SVN_JNI_ERR(svn_client_upgrade2(&wc_version, path, targetWcVersion,
+ ctx, pool, pool),
+ NULL);
+ if (wc_version != NULL)
+ return ::JavaHL::Version::getInstance(env, *wc_version);
+ return NULL;
}
jobject SVNClient::revProperties(const char *path, Revision &revision)
Modified:
subversion/branches/javahl-1.15/subversion/bindings/javahl/native/SVNClient.h
==============================================================================
---
subversion/branches/javahl-1.15/subversion/bindings/javahl/native/SVNClient.h
Sun May 10 05:02:15 2026 (r1934019)
+++
subversion/branches/javahl-1.15/subversion/bindings/javahl/native/SVNClient.h
Sun May 10 05:42:23 2026 (r1934020)
@@ -201,7 +201,8 @@ class SVNClient :public SVNBase
const char *original_value, bool force);
jstring getVersionInfo(const char *path, const char *trailUrl,
bool lastChanged);
- void upgrade(const char *path);
+ jobject upgrade(::Java::Env env, const char *path,
+ const svn_version_t *targetWcVersion);
jbyteArray propertyGet(const char *path, const char *name,
Revision &revision, Revision &pegRevision,
StringArray &changelists);
Modified:
subversion/branches/javahl-1.15/subversion/bindings/javahl/native/org_apache_subversion_javahl_SVNClient.cpp
==============================================================================
---
subversion/branches/javahl-1.15/subversion/bindings/javahl/native/org_apache_subversion_javahl_SVNClient.cpp
Sun May 10 05:02:15 2026 (r1934019)
+++
subversion/branches/javahl-1.15/subversion/bindings/javahl/native/org_apache_subversion_javahl_SVNClient.cpp
Sun May 10 05:42:23 2026 (r1934020)
@@ -1582,21 +1582,32 @@ Java_org_apache_subversion_javahl_SVNCli
return cl->getVersionInfo(path, trailUrl, jlastChanged ? true:false);
}
-JNIEXPORT void JNICALL Java_org_apache_subversion_javahl_SVNClient_upgrade
- (JNIEnv *env, jobject jthis, jstring jpath)
+JNIEXPORT jobject JNICALL Java_org_apache_subversion_javahl_SVNClient_upgrade
+(JNIEnv *env, jobject jthis, jstring jpath, jobject jtargetWcVersion)
{
JNIEntry(SVNClient, upgrade);
SVNClient *cl = SVNClient::getCppObject(jthis);
if (cl == NULL)
{
JNIUtil::throwError(_("bad C++ this"));
- return;
+ return NULL;
}
JNIStringHolder path(jpath);
if (JNIUtil::isExceptionThrown())
- return;
+ return NULL;
- cl->upgrade(path);
+ svn_version_t target_version_data;
+ const svn_version_t *target_version_ptr = NULL;
+ if (jtargetWcVersion != NULL)
+ {
+ ::JavaHL::Version targetWcVersion(::Java::Env(env), jtargetWcVersion);
+ if (JNIUtil::isExceptionThrown())
+ return NULL;
+ targetWcVersion.getVersion(target_version_data);
+ target_version_ptr = &target_version_data;
+ }
+
+ return cl->upgrade(::Java::Env(env), path, target_version_ptr);
}
JNIEXPORT void JNICALL
Modified:
subversion/branches/javahl-1.15/subversion/bindings/javahl/src/org/apache/subversion/javahl/ISVNClient.java
==============================================================================
---
subversion/branches/javahl-1.15/subversion/bindings/javahl/src/org/apache/subversion/javahl/ISVNClient.java
Sun May 10 05:02:15 2026 (r1934019)
+++
subversion/branches/javahl-1.15/subversion/bindings/javahl/src/org/apache/subversion/javahl/ISVNClient.java
Sun May 10 05:42:23 2026 (r1934020)
@@ -1619,10 +1619,22 @@ public interface ISVNClient
/**
* Recursively upgrade a working copy to a new metadata storage format.
- * @param path path of the working copy
+ * <p>
+ * Behaves like the 1.15 version with <code>targetWcVersion = null</code>.
+ * @deprecated
+ */
+ @Deprecated
+ void upgrade(String path) throws ClientException;
+
+
+ /**
+ * Recursively upgrade a working copy to a new metadata storage format.
+ * @param path the working copy path
+ * @param targetWcVersion the working copy version to upgrade to
* @throws ClientException
+ * @since 1.15
*/
- void upgrade(String path)
+ Version upgrade(String path, Version targetWcVersion)
throws ClientException;
/**
Modified:
subversion/branches/javahl-1.15/subversion/bindings/javahl/src/org/apache/subversion/javahl/SVNClient.java
==============================================================================
---
subversion/branches/javahl-1.15/subversion/bindings/javahl/src/org/apache/subversion/javahl/SVNClient.java
Sun May 10 05:02:15 2026 (r1934019)
+++
subversion/branches/javahl-1.15/subversion/bindings/javahl/src/org/apache/subversion/javahl/SVNClient.java
Sun May 10 05:42:23 2026 (r1934020)
@@ -789,7 +789,15 @@ public class SVNClient implements ISVNCl
boolean lastChanged)
throws ClientException;
- public native void upgrade(String path)
+ @Deprecated
+ @Override
+ public void upgrade(String path) throws ClientException
+ {
+ upgrade(path, (Version) null);
+ }
+
+ @Override
+ public native Version upgrade(String path, Version targetWcVersion)
throws ClientException;
/**
Modified:
subversion/branches/javahl-1.15/subversion/bindings/javahl/tests/org/apache/subversion/javahl/BasicTests.java
==============================================================================
---
subversion/branches/javahl-1.15/subversion/bindings/javahl/tests/org/apache/subversion/javahl/BasicTests.java
Sun May 10 05:02:15 2026 (r1934019)
+++
subversion/branches/javahl-1.15/subversion/bindings/javahl/tests/org/apache/subversion/javahl/BasicTests.java
Sun May 10 05:42:23 2026 (r1934020)
@@ -941,6 +941,42 @@ public class BasicTests extends SVNTests
}
/**
+ * Test the basic SVNClient.upgrade functionality.
+ * @throws Throwable
+ */
+ public void testBasicUpgrade() throws Throwable
+ {
+ OneTest thisTest = new OneTest(true, true, true);
+ Version oldestVersion = SVNClient.oldestWcVersion();
+ Version defaultVersion = client.defaultWcVersion();
+
+ Version upgradedVersion =
+ client.upgrade(thisTest.getWCPath(), null);
+
+ assertNotNull(upgradedVersion);
+ assertTrue(upgradedVersion.isAtLeast(oldestVersion));
+ assertTrue(upgradedVersion.isAtLeast(defaultVersion));
+ assertTrue(defaultVersion.isAtLeast(upgradedVersion));
+ }
+
+ /**
+ * Test SVNClient.upgrade to the latest version.
+ * @throws Throwable
+ */
+ public void testLatestUpgrade() throws Throwable
+ {
+ OneTest thisTest = new OneTest(true, true, true);
+ Version latestVersion = SVNClient.latestWcVersion();
+
+ Version upgradedVersion =
+ client.upgrade(thisTest.getWCPath(), latestVersion);
+
+ assertNotNull(upgradedVersion);
+ assertTrue(upgradedVersion.isAtLeast(latestVersion));
+ assertTrue(latestVersion.isAtLeast(upgradedVersion));
+ }
+
+ /**
* Test the basic SVNClient.commit functionality.
* @throws Throwable
*/
Modified:
subversion/branches/javahl-1.15/subversion/bindings/javahl/tests/org/apache/subversion/javahl/SVNTests.java
==============================================================================
---
subversion/branches/javahl-1.15/subversion/bindings/javahl/tests/org/apache/subversion/javahl/SVNTests.java
Sun May 10 05:02:15 2026 (r1934019)
+++
subversion/branches/javahl-1.15/subversion/bindings/javahl/tests/org/apache/subversion/javahl/SVNTests.java
Sun May 10 05:42:23 2026 (r1934020)
@@ -676,12 +676,15 @@ class SVNTests extends TestCase
* and initialize the expected working copy layout.
* @param loadRepos Whether to load the sample repository, or
* leave it with no initial revisions
+ * @param oldestVersion whether to create the working copy
+ * at the oldest instead of the default supported version.
* @throws SubversionException If there is a problem
* creating or loading the repository.
* @throws IOException If there is a problem finding the
* dump file.
*/
- protected OneTest(boolean createWC, boolean loadRepos)
+ protected OneTest(boolean createWC, boolean loadRepos,
+ boolean oldestVersion)
throws SubversionException, IOException
{
this.testName = testBaseName + ++testCounter;
@@ -691,7 +694,8 @@ class SVNTests extends TestCase
if (createWC)
{
- workingCopy = createInitialWorkingCopy(repository);
+ workingCopy = createInitialWorkingCopy(repository,
+ oldestVersion);
}
}
@@ -702,13 +706,31 @@ class SVNTests extends TestCase
*
* @param createWC Whether to create the working copy on disk,
* and initialize the expected working copy layout.
+ * @param loadRepos Whether to load the sample repository, or
+ * leave it with no initial revisions
+ *
+ * @see #OneTest
+ */
+ protected OneTest(boolean createWC, boolean loadRepos)
+ throws SubversionException, IOException
+ {
+ this(createWC, loadRepos, false);
+ }
+
+ /**
+ * Build a new test setup with a new repository. Create a
+ * corresponding working copy and expected working copy
+ * layout.
+ *
+ * @param createWC Whether to create the working copy on disk,
+ * and initialize the expected working copy layout.
*
* @see #OneTest
*/
protected OneTest(boolean createWC)
throws SubversionException, IOException
{
- this(createWC,true);
+ this(createWC, true);
}
/**
* Build a new test setup with a new repository. Create a
@@ -750,7 +772,7 @@ class SVNTests extends TestCase
repository = orig.getRepository();
url = orig.getUrl();
wc = orig.wc.copy();
- workingCopy = createInitialWorkingCopy(repository);
+ workingCopy = createInitialWorkingCopy(repository, false);
}
/**
@@ -865,11 +887,12 @@ class SVNTests extends TestCase
* Create the working copy for the beginning of the test.
* Assumes that {@link #testName} has been set.
*
- * @param repos the repository directory
+ * @param repos the repository directory
+ * @param oldestVersion create an oldest supported WC
* @return the directory of the working copy
* @throws Exception
*/
- protected File createInitialWorkingCopy(File repos)
+ protected File createInitialWorkingCopy(File repos, boolean
oldestVersion)
throws SubversionException, IOException
{
// build a clean working directory
@@ -878,9 +901,11 @@ class SVNTests extends TestCase
removeDirOrFile(workingCopy);
trackDir(workingCopy);
// checkout the repository
+ Version wcVersionFormat = oldestVersion
+ ? SVNClient.oldestWcVersion() : null;
client.checkout(uri.toString(), workingCopy.getAbsolutePath(),
null, null, Depth.infinity, false, false,
- null, Tristate.Unknown);
+ wcVersionFormat, Tristate.Unknown);
// sanity check the working with its expected status
checkStatus();
return workingCopy;