Author: brane
Date: Tue May 12 12:25:01 2026
New Revision: 1934141

Log:
On the javahl-1.15 branch: Add working copy metadata (compatibility
version and the store-pristine flag) to info results.

* BRANCH-README: Update the DONE list.

[in subversion/bindings/javahl/src/org/apache/subversion/javahl/types/]

* Info.java
  (Info.wcVersion, Info.storePristine): New private members.
  (Info.Info): Deprecate public constructor and add a new private constructor.
  (Info.getWorkingCopyVersion,
   Info.getStorePristine): New accessor methods.

[in subversion/bindings/javahl/tests/org/apache/subversion/javahl/]

* BasicTests.java
  (BasicTests.testBasicInfo): check the new flags in the Info object.

[in subversion/bindings/javahl/native/]

* CreateJ.h
  (CreateJ::Info) Add pool parameter to the prototype.
* CreateJ.cpp
  (CreateJ::Info): Convert the working copy version and store-pristine flag
   from the info structure and call the new Java Info constructor.
* InfoCallback.cpp
  (InfoCallback::singleInfo): Pass the pool to CreateJ::Info.

Modified:
   subversion/branches/javahl-1.15/BRANCH-README
   subversion/branches/javahl-1.15/subversion/bindings/javahl/native/CreateJ.cpp
   subversion/branches/javahl-1.15/subversion/bindings/javahl/native/CreateJ.h
   
subversion/branches/javahl-1.15/subversion/bindings/javahl/native/InfoCallback.cpp
   
subversion/branches/javahl-1.15/subversion/bindings/javahl/src/org/apache/subversion/javahl/types/Info.java
   
subversion/branches/javahl-1.15/subversion/bindings/javahl/tests/org/apache/subversion/javahl/BasicTests.java

Modified: subversion/branches/javahl-1.15/BRANCH-README
==============================================================================
--- subversion/branches/javahl-1.15/BRANCH-README       Tue May 12 12:10:04 
2026        (r1934140)
+++ subversion/branches/javahl-1.15/BRANCH-README       Tue May 12 12:25:01 
2026        (r1934141)
@@ -20,3 +20,4 @@ DONE:
     - SVNClient.checkout
     - SVNClient.list, .callback.ListCallback
   * Update SVNClient.diff to capture stderr.
+  * Add working copy metadata to SVNClient.info() results.

Modified: 
subversion/branches/javahl-1.15/subversion/bindings/javahl/native/CreateJ.cpp
==============================================================================
--- 
subversion/branches/javahl-1.15/subversion/bindings/javahl/native/CreateJ.cpp   
    Tue May 12 12:10:04 2026        (r1934140)
+++ 
subversion/branches/javahl-1.15/subversion/bindings/javahl/native/CreateJ.cpp   
    Tue May 12 12:25:01 2026        (r1934141)
@@ -24,6 +24,7 @@
  * @brief Implementation of the class CreateJ.
  */
 
+#include "svn_client.h"
 #include "svn_error.h"
 
 #include "JNIUtil.h"
@@ -32,6 +33,7 @@
 #include "RevisionRange.h"
 #include "RevisionRangeList.h"
 #include "CreateJ.h"
+#include "Version.hpp"
 #include "../include/org_apache_subversion_javahl_types_Revision.h"
 #include "../include/org_apache_subversion_javahl_CommitItemStateFlags.h"
 
@@ -318,7 +320,7 @@ CreateJ::DirEntry(const char *path, cons
 }
 
 jobject
-CreateJ::Info(const char *path, const svn_client_info2_t *info)
+CreateJ::Info(const char *path, const svn_client_info2_t *info, apr_pool_t 
*pool)
 {
   JNIEnv *env = JNIUtil::getEnv();
 
@@ -346,6 +348,7 @@ CreateJ::Info(const char *path, const sv
                              JAVAHL_ARG("/types/Checksum;")
                              "Ljava/lang/String;JJ"
                              JAVAHL_ARG("/types/Depth;Ljava/util/Set;")
+                             JAVAHL_ARG("/types/Version;Z")
                              ")V");
       if (mid == 0 || JNIUtil::isJavaExceptionThrown())
         POP_AND_RETURN_NULL;
@@ -365,6 +368,8 @@ CreateJ::Info(const char *path, const sv
   jlong jworkingSize = -1;
   jlong jcopyfrom_rev = -1;
   jlong jtext_time = -1;
+  jobject jwc_version = NULL;
+  jboolean jstore_pristine = JNI_TRUE;
   if (info->wc_info)
     {
       jwcroot = JNIUtil::makeJString(info->wc_info->wcroot_abspath);
@@ -418,6 +423,16 @@ CreateJ::Info(const char *path, const sv
           if (JNIUtil::isJavaExceptionThrown())
             POP_AND_RETURN_NULL;
         }
+
+      if (info->wc_info->wc_format > 0)
+        {
+          const svn_version_t *wc_ver
+            = svn_client_wc_version_from_format(info->wc_info->wc_format, 
pool);
+          if (wc_ver != NULL)
+            jwc_version = ::JavaHL::Version::getInstance(::Java::Env(env), 
*wc_ver);
+        }
+
+      jstore_pristine = info->wc_info->store_pristine ? JNI_TRUE : JNI_FALSE;
     }
 
   jstring jurl = JNIUtil::makeJString(info->URL);
@@ -455,7 +470,8 @@ CreateJ::Info(const char *path, const sv
                                   jscheduleKind, jcopyFromUrl,
                                   jcopyfrom_rev, jtext_time, jchecksum,
                                   jchangelist, jworkingSize,
-                                  (jlong) info->size, jdepth, jconflicts);
+                                  (jlong) info->size, jdepth, jconflicts,
+                                  jwc_version, jstore_pristine);
 
   return env->PopLocalFrame(jinfo2);
 }

Modified: 
subversion/branches/javahl-1.15/subversion/bindings/javahl/native/CreateJ.h
==============================================================================
--- subversion/branches/javahl-1.15/subversion/bindings/javahl/native/CreateJ.h 
Tue May 12 12:10:04 2026        (r1934140)
+++ subversion/branches/javahl-1.15/subversion/bindings/javahl/native/CreateJ.h 
Tue May 12 12:25:01 2026        (r1934141)
@@ -54,7 +54,7 @@ class CreateJ
            const svn_dirent_t *dirent);
 
   static jobject
-  Info(const char *path, const svn_client_info2_t *info);
+  Info(const char *path, const svn_client_info2_t *info, apr_pool_t *pool);
 
   static jobject
   Lock(const svn_lock_t *lock);

Modified: 
subversion/branches/javahl-1.15/subversion/bindings/javahl/native/InfoCallback.cpp
==============================================================================
--- 
subversion/branches/javahl-1.15/subversion/bindings/javahl/native/InfoCallback.cpp
  Tue May 12 12:10:04 2026        (r1934140)
+++ 
subversion/branches/javahl-1.15/subversion/bindings/javahl/native/InfoCallback.cpp
  Tue May 12 12:25:01 2026        (r1934141)
@@ -90,7 +90,7 @@ InfoCallback::singleInfo(const char *pat
         POP_AND_RETURN(SVN_NO_ERROR);
     }
 
-  jobject jinfo2 = CreateJ::Info(path, info);
+  jobject jinfo2 = CreateJ::Info(path, info, pool);
   if (jinfo2 == NULL || JNIUtil::isJavaExceptionThrown())
     POP_AND_RETURN(SVN_NO_ERROR);
 

Modified: 
subversion/branches/javahl-1.15/subversion/bindings/javahl/src/org/apache/subversion/javahl/types/Info.java
==============================================================================
--- 
subversion/branches/javahl-1.15/subversion/bindings/javahl/src/org/apache/subversion/javahl/types/Info.java
 Tue May 12 12:10:04 2026        (r1934140)
+++ 
subversion/branches/javahl-1.15/subversion/bindings/javahl/src/org/apache/subversion/javahl/types/Info.java
 Tue May 12 12:25:01 2026        (r1934141)
@@ -155,6 +155,19 @@ public class Info implements java.io.Ser
     private Set<ConflictDescriptor> conflict;
 
     /**
+     * The working copy compatibility version.
+     * May be <code>null</code>.
+     * @since 1.15
+     */
+    private Version wcVersion;
+
+    /**
+     * True if the working copy stores pristine files.
+     * @since 1.15
+     */
+    private boolean storePristine = true;
+
+    /**
      * constructor to build the object by native code. See fields for
      * parameters
      * @param path
@@ -175,8 +188,10 @@ public class Info implements java.io.Ser
      * @param textTime
      * @param checksum
      * @param depth
-     * @param treeConflict
+     * @param conflict
+     * @deprecated
      */
+    @Deprecated
     public Info(String path, String wcroot, String url, long rev, NodeKind 
kind,
           String reposRootUrl, String reposUUID, long lastChangedRev,
           long lastChangedDate, String lastChangedAuthor, Lock lock,
@@ -210,6 +225,32 @@ public class Info implements java.io.Ser
     }
 
     /**
+     * Constructor to build the object by native code.
+     * <p>
+     * Behaves like the deprecated version with additional arguments:
+     * @param wcVersion
+     * @param storePristine
+     * @since 1.15
+     */
+    @SuppressWarnings("deprecation")  // because we call the deprecated ctor
+    private Info(String path, String wcroot, String url, long rev, NodeKind 
kind,
+          String reposRootUrl, String reposUUID, long lastChangedRev,
+          long lastChangedDate, String lastChangedAuthor, Lock lock,
+          boolean hasWcInfo, ScheduleKind schedule, String copyFromUrl,
+          long copyFromRev, long textTime, Checksum checksum,
+          String changelistName, long workingSize, long reposSize, Depth depth,
+          Set<ConflictDescriptor> conflict, Version wcVersion, boolean 
storePristine)
+    {
+        this(path, wcroot, url, rev, kind, reposRootUrl, reposUUID,
+             lastChangedRev, lastChangedDate, lastChangedAuthor,
+             lock, hasWcInfo, schedule, copyFromUrl, copyFromRev,
+             textTime, checksum, changelistName, workingSize,
+             reposSize, depth, conflict);
+        this.wcVersion = wcVersion;
+        this.storePristine = storePristine;
+    }
+
+    /**
      * return the path of the item
      */
     public String getPath()
@@ -400,7 +441,7 @@ public class Info implements java.io.Ser
     }
 
     /**
-     * @return the tree conflict of which this node is a victim, or null if 
none
+     * @return The tree conflict of which this node is a victim, or null if 
none
      */
     public Set<ConflictDescriptor> getConflicts()
     {
@@ -408,6 +449,24 @@ public class Info implements java.io.Ser
     }
 
     /**
+     * @return The working copy compatibility version.
+     * @since 1.15
+     */
+    public Version getWorkingCopyVersion()
+    {
+        return wcVersion;
+    }
+
+    /**
+     * @return True if the working copy stores pristine content.
+     * @since 1.15
+     */
+    public boolean getStorePristine()
+    {
+        return storePristine;
+    }
+
+    /**
      * @return A string representation of this info.
      */
     public String toString()

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
       Tue May 12 12:10:04 2026        (r1934140)
+++ 
subversion/branches/javahl-1.15/subversion/bindings/javahl/tests/org/apache/subversion/javahl/BasicTests.java
       Tue May 12 12:25:01 2026        (r1934141)
@@ -2607,6 +2607,13 @@ public class BasicTests extends SVNTests
                      Info.ScheduleKind.normal, info.getSchedule());
         assertEquals("wrong node kind from info", NodeKind.file,
                      info.getKind());
+        assertTrue("unexpected store-pristine", info.getStorePristine());
+
+        Version current = info.getWorkingCopyVersion();
+        assertNotNull("WC version not available", current);
+        Version expected = client.defaultWcVersion();
+        assertTrue("unexpected WC version", current.isAtLeast(expected));
+        assertTrue("unexpected WC version", expected.isAtLeast(current));
     }
 
     /**

Reply via email to