subversion-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From br...@apache.org
Subject svn commit: r1493649 - in /subversion/branches/javahl-ra/subversion/bindings/javahl: native/ src/org/apache/subversion/javahl/ src/org/apache/subversion/javahl/remote/ tests/org/apache/subversion/javahl/
Date Mon, 17 Jun 2013 06:22:40 GMT
Author: brane
Date: Mon Jun 17 06:22:39 2013
New Revision: 1493649

URL: http://svn.apache.org/r1493649
Log:
On the javahl-ra branch:
Implement ISVNRemote.getSessionRelativePath and ISVNRemote.getReposRelativePath.

[in subversion/bindings/javahl/src/org/apache/subversion/javahl]
* ISVNRemote.java (ISVNRemote.getReposRelativePath):
   Renamed from getRepositoryRelativePath.
* remote/RemoteSession.java
  (ISVNRemote.getReposRelativePath, ISVNRemote.getSessionRelativePath):
   Declare native methods.
  (thrownotimplemented): Remove.

[in subversion/bindings/javahl/tests/org/apache/subversion/javahl]
* SVNRemoteTests.java (SVNRemoteTests.testGetRelativePath): New test case.

[in subversion/bindings/javahl/native]
* RemoteSession.h, RemoteSession.cpp
  (RemoteSession::getReposRelativePath, RemoteSession::getSessionRelativePath)
   New methods.
* org_apache_subversion_javahl_remote_RemoteSession.cpp
  (Java_org_apache_subversion_javahl_remote_RemoteSession_getSessionRelativePath):
   Implement native methods.

Modified:
    subversion/branches/javahl-ra/subversion/bindings/javahl/native/RemoteSession.cpp
    subversion/branches/javahl-ra/subversion/bindings/javahl/native/RemoteSession.h
    subversion/branches/javahl-ra/subversion/bindings/javahl/native/org_apache_subversion_javahl_remote_RemoteSession.cpp
    subversion/branches/javahl-ra/subversion/bindings/javahl/src/org/apache/subversion/javahl/ISVNRemote.java
    subversion/branches/javahl-ra/subversion/bindings/javahl/src/org/apache/subversion/javahl/remote/RemoteSession.java
    subversion/branches/javahl-ra/subversion/bindings/javahl/tests/org/apache/subversion/javahl/SVNRemoteTests.java

Modified: subversion/branches/javahl-ra/subversion/bindings/javahl/native/RemoteSession.cpp
URL: http://svn.apache.org/viewvc/subversion/branches/javahl-ra/subversion/bindings/javahl/native/RemoteSession.cpp?rev=1493649&r1=1493648&r2=1493649&view=diff
==============================================================================
--- subversion/branches/javahl-ra/subversion/bindings/javahl/native/RemoteSession.cpp (original)
+++ subversion/branches/javahl-ra/subversion/bindings/javahl/native/RemoteSession.cpp Mon
Jun 17 06:22:39 2013
@@ -275,7 +275,8 @@ RemoteSession::dispose(jobject jthis)
 
 void RemoteSession::reparent(const char* url)
 {
-  SVN_JNI_ERR(svn_ra_reparent(m_session, url, pool.getPool()), );
+  SVN::Pool subPool(pool);
+  SVN_JNI_ERR(svn_ra_reparent(m_session, url, subPool.getPool()), );
 }
 
 jstring
@@ -294,6 +295,38 @@ RemoteSession::getSessionUrl()
 }
 
 jstring
+RemoteSession::getSessionRelativePath(const char* url)
+{
+  SVN::Pool subPool(pool);
+  const char* rel_path;
+
+  SVN_JNI_ERR(svn_ra_get_path_relative_to_session(
+                  m_session, &rel_path, url, subPool.getPool()),
+              NULL);
+  jstring jrel_path = JNIUtil::makeJString(rel_path);
+  if (JNIUtil::isJavaExceptionThrown())
+    return NULL;
+
+  return jrel_path;
+}
+
+jstring
+RemoteSession::getReposRelativePath(const char* url)
+{
+  SVN::Pool subPool(pool);
+  const char* rel_path;
+
+  SVN_JNI_ERR(svn_ra_get_path_relative_to_root(
+                  m_session, &rel_path, url, subPool.getPool()),
+              NULL);
+  jstring jrel_path = JNIUtil::makeJString(rel_path);
+  if (JNIUtil::isJavaExceptionThrown())
+    return NULL;
+
+  return jrel_path;
+}
+
+jstring
 RemoteSession::getReposUUID()
 {
   SVN::Pool subPool(pool);

Modified: subversion/branches/javahl-ra/subversion/bindings/javahl/native/RemoteSession.h
URL: http://svn.apache.org/viewvc/subversion/branches/javahl-ra/subversion/bindings/javahl/native/RemoteSession.h?rev=1493649&r1=1493648&r2=1493649&view=diff
==============================================================================
--- subversion/branches/javahl-ra/subversion/bindings/javahl/native/RemoteSession.h (original)
+++ subversion/branches/javahl-ra/subversion/bindings/javahl/native/RemoteSession.h Mon Jun
17 06:22:39 2013
@@ -60,6 +60,8 @@ class RemoteSession : public SVNBase
 
     void reparent(const char* url);
     jstring getSessionUrl();
+    jstring getSessionRelativePath(const char* url);
+    jstring getReposRelativePath(const char* url);
     jstring getReposUUID();
     jobject getLatestRevision();
 

Modified: subversion/branches/javahl-ra/subversion/bindings/javahl/native/org_apache_subversion_javahl_remote_RemoteSession.cpp
URL: http://svn.apache.org/viewvc/subversion/branches/javahl-ra/subversion/bindings/javahl/native/org_apache_subversion_javahl_remote_RemoteSession.cpp?rev=1493649&r1=1493648&r2=1493649&view=diff
==============================================================================
--- subversion/branches/javahl-ra/subversion/bindings/javahl/native/org_apache_subversion_javahl_remote_RemoteSession.cpp
(original)
+++ subversion/branches/javahl-ra/subversion/bindings/javahl/native/org_apache_subversion_javahl_remote_RemoteSession.cpp
Mon Jun 17 06:22:39 2013
@@ -80,6 +80,34 @@ Java_org_apache_subversion_javahl_remote
 }
 
 JNIEXPORT jstring JNICALL
+Java_org_apache_subversion_javahl_remote_RemoteSession_getSessionRelativePath(
+    JNIEnv *env, jobject jthis, jstring jurl)
+{
+  JNIEntry(RemoteSession, getSessionUrl);
+  RemoteSession *ras = RemoteSession::getCppObject(jthis);
+  CPPADDR_NULL_PTR(ras, NULL);
+
+  JNIStringHolder url(jurl);
+  if (JNIUtil::isJavaExceptionThrown())
+    return NULL;
+  return ras->getSessionRelativePath(url);
+}
+
+JNIEXPORT jstring JNICALL
+Java_org_apache_subversion_javahl_remote_RemoteSession_getReposRelativePath(
+    JNIEnv *env, jobject jthis, jstring jurl)
+{
+  JNIEntry(RemoteSession, getSessionUrl);
+  RemoteSession *ras = RemoteSession::getCppObject(jthis);
+  CPPADDR_NULL_PTR(ras, NULL);
+
+  JNIStringHolder url(jurl);
+  if (JNIUtil::isJavaExceptionThrown())
+    return NULL;
+  return ras->getReposRelativePath(url);
+}
+
+JNIEXPORT jstring JNICALL
 Java_org_apache_subversion_javahl_remote_RemoteSession_getSessionUrl(
     JNIEnv *env, jobject jthis)
 {

Modified: subversion/branches/javahl-ra/subversion/bindings/javahl/src/org/apache/subversion/javahl/ISVNRemote.java
URL: http://svn.apache.org/viewvc/subversion/branches/javahl-ra/subversion/bindings/javahl/src/org/apache/subversion/javahl/ISVNRemote.java?rev=1493649&r1=1493648&r2=1493649&view=diff
==============================================================================
--- subversion/branches/javahl-ra/subversion/bindings/javahl/src/org/apache/subversion/javahl/ISVNRemote.java
(original)
+++ subversion/branches/javahl-ra/subversion/bindings/javahl/src/org/apache/subversion/javahl/ISVNRemote.java
Mon Jun 17 06:22:39 2013
@@ -75,7 +75,7 @@ public interface ISVNRemote
      * @param url Must be a child of the repository root URL.
      * @throws ClientException
      */
-    String getRepositoryRelativePath(String url) throws ClientException;
+    String getReposRelativePath(String url) throws ClientException;
 
     /**
      * Get the UUID of the session's repository.

Modified: subversion/branches/javahl-ra/subversion/bindings/javahl/src/org/apache/subversion/javahl/remote/RemoteSession.java
URL: http://svn.apache.org/viewvc/subversion/branches/javahl-ra/subversion/bindings/javahl/src/org/apache/subversion/javahl/remote/RemoteSession.java?rev=1493649&r1=1493648&r2=1493649&view=diff
==============================================================================
--- subversion/branches/javahl-ra/subversion/bindings/javahl/src/org/apache/subversion/javahl/remote/RemoteSession.java
(original)
+++ subversion/branches/javahl-ra/subversion/bindings/javahl/src/org/apache/subversion/javahl/remote/RemoteSession.java
Mon Jun 17 06:22:39 2013
@@ -47,17 +47,11 @@ public class RemoteSession extends JNIOb
 
     public native String getSessionUrl() throws ClientException;
 
-    public String getSessionRelativePath(String url) throws ClientException
-    {
-        thrownotimplemented("getSessionRelativePath");
-        return null;
-    }
+    public native String getSessionRelativePath(String url)
+            throws ClientException;
 
-    public String getRepositoryRelativePath(String url) throws ClientException
-    {
-        thrownotimplemented("getRepositoryRelativePath");
-        return null;
-    }
+    public native String getReposRelativePath(String url)
+            throws ClientException;
 
     public native String getReposUUID() throws ClientException;
 
@@ -95,10 +89,4 @@ public class RemoteSession extends JNIOb
      */
     private RemoteSessionContext sessionContext = new RemoteSessionContext();
     private class RemoteSessionContext extends OperationContext {}
-
-
-    private void thrownotimplemented(String message)
-    {
-        throw new RuntimeException("Not implemented: " + message);
-    }
 }

Modified: subversion/branches/javahl-ra/subversion/bindings/javahl/tests/org/apache/subversion/javahl/SVNRemoteTests.java
URL: http://svn.apache.org/viewvc/subversion/branches/javahl-ra/subversion/bindings/javahl/tests/org/apache/subversion/javahl/SVNRemoteTests.java?rev=1493649&r1=1493648&r2=1493649&view=diff
==============================================================================
--- subversion/branches/javahl-ra/subversion/bindings/javahl/tests/org/apache/subversion/javahl/SVNRemoteTests.java
(original)
+++ subversion/branches/javahl-ra/subversion/bindings/javahl/tests/org/apache/subversion/javahl/SVNRemoteTests.java
Mon Jun 17 06:22:39 2013
@@ -201,4 +201,17 @@ public class SVNRemoteTests extends SVNT
         session.reparent(newUrl);
         assertEquals(newUrl, session.getSessionUrl());
     }
+
+    public void testGetRelativePath() throws Exception
+    {
+        ISVNRemote session = getSession();
+        String baseUrl = session.getSessionUrl() + "/A/B/E";
+        session.reparent(baseUrl);
+
+        String relPath = session.getSessionRelativePath(baseUrl + "/alpha");
+        assertEquals("alpha", relPath);
+
+        relPath = session.getReposRelativePath(baseUrl + "/beta");
+        assertEquals("A/B/E/beta", relPath);
+    }
 }



Mime
View raw message