Mark, I've got a patch in progress based on these APIs which creates a
first-class Version object to encapsulate this information. While
looking through svn_version.h, I noticed that the SVN_VER_TAG and
SVN_VER_NUMTAG are not represented by your patch.
https://svn.collab.net/repos/svn/trunk/subversion/include/svn_version.h
Do you think there's value in adding them?
- Dan
Implementation note: With SWIG (and our Perl/Python/Ruby bindings),
this information can be generated directly from svn_version.h. javah
doesn't appear to provide a similar facility.
On Fri, 28 Oct 2005, Mark Phippard wrote:
> Based on a discussion we had over on the Subclipse mailing list, Daniel
> Rall asked me to send this to the Subversion dev@ list. He said to
> provide the Java-side of this patch as an illustration and he or someone
> else could look at the C++ side.
>
> Basically, it would be nice from Subclipse to know the version of the
> JavaHL library that is loaded. We have to ship the JavaHL JAR file as
> part of Subclipse but the native library comes from their Subversion
> distribution (except on Windows where we also provide the library). So it
> is possible, as an example, that we are using the 1.2 version of JavaHL on
> the Java side but it is loading a 1.1 native library. This then leads to
> problems when we try to use incompatible features.
>
> I currently work around this by doing "feature" testing such as doing a
> test construction of an object that didn't exist in prior versions or
> calling a new method etc... It would be nicer if there were just a method
> in JavaHL that returns the version of the loaded library.
>
> The attached patch contains my proposal for the sort of methods I would
> like to see on the Java side. When all is said and done, we just need the
> information so feel free to modify the methods to suit what you can or
> cannot do easily on the C++ side to fulfill the methods.
>
> Thanks
>
> Mark
>
>
>
>
> Index: src/org/tigris/subversion/javahl/SVNClient.java
> ===================================================================
> --- src/org/tigris/subversion/javahl/SVNClient.java (revision 17076)
> +++ src/org/tigris/subversion/javahl/SVNClient.java (working copy)
> @@ -1116,4 +1116,28 @@
> public native Info2[] info2(String pathOrUrl, Revision revision,
> Revision pegRevision, boolean recurse)
> throws ClientException;
> +
> + /**
> + * @return The full version string for the loaded JavaHL library
> + * @since 1.3
> + */
> + public native String getLibraryVersion();
> +
> + /**
> + * @return The major version number for the loaded JavaHL library
> + * @since 1.3
> + */
> + public native int getLibraryMajorVersion();
> +
> + /**
> + * @return The minor version number for the loaded JavaHL library
> + * @since 1.3
> + */
> + public native int getLibraryMinorVersion();
> +
> + /**
> + * @return The patch version number for the loaded JavaHL library
> + * @since 1.3
> + */
> + public native int getLibraryPatchVersion();
> }
> Index: src/org/tigris/subversion/javahl/SVNClientInterface.java
> ===================================================================
> --- src/org/tigris/subversion/javahl/SVNClientInterface.java (revision
> 17076)
> +++ src/org/tigris/subversion/javahl/SVNClientInterface.java (working
> copy)
> @@ -30,6 +30,26 @@
> */
> void dispose();
> /**
> + * @return The full version string for the loaded JavaHL library
> + * @since 1.3
> + */
> + public String getLibraryVersion();
> + /**
> + * @return The major version number for the loaded JavaHL library
> + * @since 1.3
> + */
> + public int getLibraryMajorVersion();
> + /**
> + * @return The minor version number for the loaded JavaHL library
> + * @since 1.3
> + */
> + public int getLibraryMinorVersion();
> + /**
> + * @return The patch version number for the loaded JavaHL library
> + * @since 1.3
> + */
> + public int getLibraryPatchVersion();
> + /**
> * @return The name of the working copy's administrative
> * directory, which is usually <code>.svn</code>.
> * @see <a
> Index: src/org/tigris/subversion/javahl/SVNClientSynchronized.java
> ===================================================================
> --- src/org/tigris/subversion/javahl/SVNClientSynchronized.java (revision
> 17076)
> +++ src/org/tigris/subversion/javahl/SVNClientSynchronized.java (working
> copy)
> @@ -1443,5 +1443,53 @@
> return worker.getVersionInfo(path, trailUrl, lastChanged);
> }
> }
> +
> + /**
> + * @return The full version string for the loaded JavaHL library
> + * @since 1.3
> + */
> + public String getLibraryVersion()
> + {
> + synchronized(clazz)
> + {
> + return worker.getLibraryVersion();
> + }
> + }
>
> + /**
> + * @return The major version number for the loaded JavaHL library
> + * @since 1.3
> + */
> + public int getLibraryMajorVersion()
> + {
> + synchronized(clazz)
> + {
> + return worker.getLibraryMajorVersion();
> + }
> + }
> +
> + /**
> + * @return The minor version number for the loaded JavaHL library
> + * @since 1.3
> + */
> + public int getLibraryMinorVersion()
> + {
> + synchronized(clazz)
> + {
> + return worker.getLibraryMinorVersion();
> + }
> + }
> +
> + /**
> + * @return The patch version number for the loaded JavaHL library
> + * @since 1.3
> + */
> + public int getLibraryPatchVersion()
> + {
> + synchronized(clazz)
> + {
> + return worker.getLibraryPatchVersion();
> + }
> + }
> +
> }
---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@subversion.tigris.org
For additional commands, e-mail: dev-help@subversion.tigris.org
Received on Fri Dec 2 22:54:37 2005