subversion-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From br...@apache.org
Subject svn commit: r1499094 - in /subversion/trunk/subversion/bindings/javahl: native/ src/org/apache/subversion/javahl/ src/org/apache/subversion/javahl/callback/ src/org/apache/subversion/javahl/remote/ tests/org/apache/subversion/javahl/
Date Tue, 02 Jul 2013 20:16:18 GMT
Author: brane
Date: Tue Jul  2 20:16:17 2013
New Revision: 1499094

URL: http://svn.apache.org/r1499094
Log:
Tweak JavaHL's ISVNReporter interface and implementation so that
finishReport returns the target revision of the edit drive -- since
Ev2 doesn't give us that information.

[in subversion/bindings/javahl/src/org/apache/subversion/javahl]
* ISVNReporter.java (ISVNReporter.finishReport): Change the method interface
   and update the docstring.
* remote/StateReporter.java (ISVNReporter.finishReport): Likewise.

* callback/RemoteStatus.java
  (RemoteStatus.modifiedDirectory, RemoteStatus.modifiedFile
   RemoteStatus.modifiedSymlink, RemoteStatus.deleted): Remove the 'revision'
    argument since it contains information that the API consumer already has.
* (remote/StatusEditor.java): Update all calls of RemoteStatus.


[in subversion/bindings/javahl/native]
* EditorProxy.h (EditorProxyCallbacks): Put the whole svn_delta__extra_baton
   into the proxy callbacks structure.
  (EditorProxy.m_extra_baton): Removed; replaced with ...
  (EditorProxy.m_proxy_callbacks): ... this new private member.
* EditorProxy.cpp (null_extra_baton): Removed.
  (EditorProxy::EditorProxy): Initialize m_proxy_callbacks.
  Update initialisation to use the new member.
* StateReporter.h (StateReporter::finishReport): Update prototype.
  (StateReporter::m_target_revision): New data member.
* StateReporter.cpp (StateReporter::StateReporter): Initialize the new mameber.
  (StateReporter::finishReport): Update prototype and return the value of
   m_target_revision to the caller.

* RemoteSession.cpp (template_status_editor_callbacks):
   Renamed from status_editor_callbacks and updated initialiser.
  (RemoteSession::status): Make a copy of the template proxy callbacks
   and store the address of the reporter's target revision into the
   callbacks' m_extra_baton member.
  (status_target_revision_func): Interpret the baton as a pointer to
   an svn_revnum_t and update its value.

[In subversion/bindings/javahl/tests/org/apache/subversion/javahl]
* SVNRemoteTests.java (SVNRemoteTests.RemoteStatusReceiver):
   Remove all mention of the revision argument.
  (SVNRemoteTests.testSimpleStatus, SVNRemoteTests.testPropchangeStaus):
   Check the value returned from ISVNReporter.finishReport.

Modified:
    subversion/trunk/subversion/bindings/javahl/native/EditorProxy.cpp
    subversion/trunk/subversion/bindings/javahl/native/EditorProxy.h
    subversion/trunk/subversion/bindings/javahl/native/RemoteSession.cpp
    subversion/trunk/subversion/bindings/javahl/native/StateReporter.cpp
    subversion/trunk/subversion/bindings/javahl/native/StateReporter.h
    subversion/trunk/subversion/bindings/javahl/native/org_apache_subversion_javahl_remote_StateReporter.cpp
    subversion/trunk/subversion/bindings/javahl/src/org/apache/subversion/javahl/ISVNReporter.java
    subversion/trunk/subversion/bindings/javahl/src/org/apache/subversion/javahl/callback/RemoteStatus.java
    subversion/trunk/subversion/bindings/javahl/src/org/apache/subversion/javahl/remote/StateReporter.java
    subversion/trunk/subversion/bindings/javahl/src/org/apache/subversion/javahl/remote/StatusEditor.java
    subversion/trunk/subversion/bindings/javahl/tests/org/apache/subversion/javahl/SVNRemoteTests.java

Modified: subversion/trunk/subversion/bindings/javahl/native/EditorProxy.cpp
URL: http://svn.apache.org/viewvc/subversion/trunk/subversion/bindings/javahl/native/EditorProxy.cpp?rev=1499094&r1=1499093&r2=1499094&view=diff
==============================================================================
--- subversion/trunk/subversion/bindings/javahl/native/EditorProxy.cpp (original)
+++ subversion/trunk/subversion/bindings/javahl/native/EditorProxy.cpp Tue Jul  2 20:16:17
2013
@@ -35,10 +35,6 @@
 #include "svn_private_config.h"
 
 
-namespace {
-const struct svn_delta__extra_baton null_extra_baton = {0};
-} // anonymous namespace
-
 EditorProxy::EditorProxy(jobject jeditor, apr_pool_t* edit_pool,
                          const char* repos_root_url, const char* base_relpath,
                          svn_cancel_func_t cancel_func, void* cancel_baton,
@@ -52,7 +48,7 @@ EditorProxy::EditorProxy(jobject jeditor
     m_editor(NULL),
     m_delta_editor(NULL),
     m_delta_baton(NULL),
-    m_extra_baton(null_extra_baton)
+    m_proxy_callbacks(callbacks)
 {
   //DEBUG:fprintf(stderr, "  (n) EditorProxy::EditorProxy(...)\n");
 
@@ -77,23 +73,20 @@ EditorProxy::EditorProxy(jobject jeditor
         static_cast<const char*>(apr_pstrdup(edit_pool, repos_root_url));
       m_base_relpath =
         static_cast<const char*>(apr_pstrdup(edit_pool, base_relpath));
-      m_extra_baton.start_edit = callbacks.m_start_edit;
-      m_extra_baton.target_revision = callbacks.m_target_revision;
-      m_extra_baton.baton = callbacks.m_callbacks_baton;
 
       svn_boolean_t found_paths;
       err = svn_delta__delta_from_editor(&m_delta_editor,
                                          &m_delta_baton,
                                          m_editor,
-                                         callbacks.m_unlock_func,
-                                         callbacks.m_callbacks_baton,
+                                         m_proxy_callbacks.m_unlock_func,
+                                         m_proxy_callbacks.m_baton,
                                          &found_paths,
                                          repos_root_url, base_relpath,
-                                         callbacks.m_fetch_props_func,
-                                         callbacks.m_callbacks_baton,
-                                         callbacks.m_fetch_base_func,
-                                         callbacks.m_callbacks_baton,
-                                         &m_extra_baton,
+                                         m_proxy_callbacks.m_fetch_props_func,
+                                         m_proxy_callbacks.m_baton,
+                                         m_proxy_callbacks.m_fetch_base_func,
+                                         m_proxy_callbacks.m_baton,
+                                         &m_proxy_callbacks.m_extra_baton,
                                          edit_pool);
       m_found_paths = found_paths;
     }

Modified: subversion/trunk/subversion/bindings/javahl/native/EditorProxy.h
URL: http://svn.apache.org/viewvc/subversion/trunk/subversion/bindings/javahl/native/EditorProxy.h?rev=1499094&r1=1499093&r2=1499094&view=diff
==============================================================================
--- subversion/trunk/subversion/bindings/javahl/native/EditorProxy.h (original)
+++ subversion/trunk/subversion/bindings/javahl/native/EditorProxy.h Tue Jul  2 20:16:17 2013
@@ -39,9 +39,8 @@ struct EditorProxyCallbacks
   svn_delta__unlock_func_t m_unlock_func;
   svn_delta_fetch_props_func_t m_fetch_props_func;
   svn_delta_fetch_base_func_t m_fetch_base_func;
-  svn_delta__start_edit_func_t m_start_edit;
-  svn_delta__target_revision_func_t m_target_revision;
-  void* m_callbacks_baton;
+  struct svn_delta__extra_baton m_extra_baton;
+  void* m_baton;
 };
 
 /**
@@ -151,9 +150,7 @@ private:
   svn_editor_t* m_editor;
   const svn_delta_editor_t* m_delta_editor;
   void* m_delta_baton;
-
-  // Initialized from the EditorProxyCallbacks struct.
-  struct svn_delta__extra_baton m_extra_baton;
+  EditorProxyCallbacks m_proxy_callbacks;
 };
 
 

Modified: subversion/trunk/subversion/bindings/javahl/native/RemoteSession.cpp
URL: http://svn.apache.org/viewvc/subversion/trunk/subversion/bindings/javahl/native/RemoteSession.cpp?rev=1499094&r1=1499093&r2=1499094&view=diff
==============================================================================
--- subversion/trunk/subversion/bindings/javahl/native/RemoteSession.cpp (original)
+++ subversion/trunk/subversion/bindings/javahl/native/RemoteSession.cpp Tue Jul  2 20:16:17
2013
@@ -686,15 +686,15 @@ status_target_revision_func(void* baton,
 {
   //DEBUG:fprintf(stderr, "  (n) status_target_revision_func(r%lld)\n",
   //DEBUG:        static_cast<long long>(target_revision));
+  *static_cast<svn_revnum_t*>(baton) = target_revision;
   return SVN_NO_ERROR;
 }
 
-const EditorProxyCallbacks status_editor_callbacks = {
+const EditorProxyCallbacks template_status_editor_callbacks = {
   status_unlock_func,
   status_fetch_props_func,
   status_fetch_base_func,
-  status_start_edit_func,
-  status_target_revision_func,
+  { status_start_edit_func, status_target_revision_func, NULL },
   NULL
 };
 } // anonymous namespace
@@ -724,13 +724,16 @@ RemoteSession::status(jobject jthis, jst
                                                session_root_url,
                                                scratch_pool),);
 
+  EditorProxyCallbacks proxy_callbacks =
+    template_status_editor_callbacks;
+  proxy_callbacks.m_extra_baton.baton = &rp->m_target_revision;
 
   apr_pool_t* report_pool = rp->get_report_pool();
   std::auto_ptr<EditorProxy> editor(
       new EditorProxy(jstatus_editor, report_pool,
                       repos_root_url, base_relpath,
                       m_context->checkCancel, m_context,
-                      status_editor_callbacks));
+                      proxy_callbacks));
   if (JNIUtil::isExceptionThrown())
     return;
 

Modified: subversion/trunk/subversion/bindings/javahl/native/StateReporter.cpp
URL: http://svn.apache.org/viewvc/subversion/trunk/subversion/bindings/javahl/native/StateReporter.cpp?rev=1499094&r1=1499093&r2=1499094&view=diff
==============================================================================
--- subversion/trunk/subversion/bindings/javahl/native/StateReporter.cpp (original)
+++ subversion/trunk/subversion/bindings/javahl/native/StateReporter.cpp Tue Jul  2 20:16:17
2013
@@ -38,7 +38,8 @@ StateReporter::StateReporter()
   : m_valid(false),
     m_raw_reporter(NULL),
     m_report_baton(NULL),
-    m_editor(NULL)
+    m_editor(NULL),
+    m_target_revision(SVN_INVALID_REVNUM)
 {}
 
 StateReporter::~StateReporter()
@@ -148,16 +149,18 @@ StateReporter::linkPath(jstring jurl, js
                                         subPool.getPool()),);
 }
 
-void
+jlong
 StateReporter::finishReport()
 {
   //DEBUG:fprintf(stderr, "  (n) StateReporter::finishReport()\n");
 
-  if (!m_valid) { throw_reporter_inactive(); return; }
+  if (!m_valid) { throw_reporter_inactive(); return SVN_INVALID_REVNUM; }
 
   SVN::Pool subPool(pool);
   SVN_JNI_ERR(m_raw_reporter->finish_report(m_report_baton,
-                                            subPool.getPool()),);
+                                            subPool.getPool()),
+              SVN_INVALID_REVNUM);
+  return jlong(m_target_revision);
 }
 
 void

Modified: subversion/trunk/subversion/bindings/javahl/native/StateReporter.h
URL: http://svn.apache.org/viewvc/subversion/trunk/subversion/bindings/javahl/native/StateReporter.h?rev=1499094&r1=1499093&r2=1499094&view=diff
==============================================================================
--- subversion/trunk/subversion/bindings/javahl/native/StateReporter.h (original)
+++ subversion/trunk/subversion/bindings/javahl/native/StateReporter.h Tue Jul  2 20:16:17
2013
@@ -53,7 +53,7 @@ public:
   void deletePath(jstring jpath);
   void linkPath(jstring jurl, jstring jpath, jlong jrevision, jobject jdepth,
                 jboolean jstart_empty, jstring jlock_token);
-  void finishReport();
+  jlong finishReport();
   void abortReport();
 
 private:
@@ -68,6 +68,7 @@ private:
   void set_reporter_data(const svn_ra_reporter3_t* raw_reporter,
                          void* report_baton,
                          EditorProxy* editor);
+  svn_revnum_t m_target_revision;
 };
 
 #endif // JAVAHL_UPDATE_REPORTER_H

Modified: subversion/trunk/subversion/bindings/javahl/native/org_apache_subversion_javahl_remote_StateReporter.cpp
URL: http://svn.apache.org/viewvc/subversion/trunk/subversion/bindings/javahl/native/org_apache_subversion_javahl_remote_StateReporter.cpp?rev=1499094&r1=1499093&r2=1499094&view=diff
==============================================================================
--- subversion/trunk/subversion/bindings/javahl/native/org_apache_subversion_javahl_remote_StateReporter.cpp
(original)
+++ subversion/trunk/subversion/bindings/javahl/native/org_apache_subversion_javahl_remote_StateReporter.cpp
Tue Jul  2 20:16:17 2013
@@ -87,14 +87,14 @@ Java_org_apache_subversion_javahl_remote
   reporter->linkPath(jurl, jpath, jrevision, jdepth, jstart_empty, jlock_token);
 }
 
-JNIEXPORT void JNICALL
+JNIEXPORT jlong JNICALL
 Java_org_apache_subversion_javahl_remote_StateReporter_finishReport(
     JNIEnv* env, jobject jthis)
 {
   JNIEntry(StateReporter, finishReport);
   StateReporter* reporter = StateReporter::getCppObject(jthis);
-  CPPADDR_NULL_PTR(reporter,);
-  reporter->finishReport();
+  CPPADDR_NULL_PTR(reporter, SVN_INVALID_REVNUM);
+  return reporter->finishReport();
 }
 
 JNIEXPORT void JNICALL

Modified: subversion/trunk/subversion/bindings/javahl/src/org/apache/subversion/javahl/ISVNReporter.java
URL: http://svn.apache.org/viewvc/subversion/trunk/subversion/bindings/javahl/src/org/apache/subversion/javahl/ISVNReporter.java?rev=1499094&r1=1499093&r2=1499094&view=diff
==============================================================================
--- subversion/trunk/subversion/bindings/javahl/src/org/apache/subversion/javahl/ISVNReporter.java
(original)
+++ subversion/trunk/subversion/bindings/javahl/src/org/apache/subversion/javahl/ISVNReporter.java
Tue Jul  2 20:16:17 2013
@@ -134,16 +134,22 @@ public interface ISVNReporter
                   String lockToken)
             throws ClientException;
 
-
     /**
      * The report driver calls this when the state report is finished.
      * Any directories or files not explicitly "set" are assumed to be
      * at the baseline revision originally passed into do_update(). No
      * other reporting functions, including {@link abortReport()},
      * should be called after calling this function.
+     *
+     * @return The target revision of the resulting editor drive. In
+     *         the case of {@link ISVNRemote#status}, this is the
+     *         revision against which the status call was performed;
+     *         in the case of {@link ISVNRemote#update}, it is the
+     *         revision updated to.
+     *
      * @throws ClientException
      */
-    void finishReport() throws ClientException;
+    long finishReport() throws ClientException;
 
     /**
      * If an error occurs during a report, this routine should cause

Modified: subversion/trunk/subversion/bindings/javahl/src/org/apache/subversion/javahl/callback/RemoteStatus.java
URL: http://svn.apache.org/viewvc/subversion/trunk/subversion/bindings/javahl/src/org/apache/subversion/javahl/callback/RemoteStatus.java?rev=1499094&r1=1499093&r2=1499094&view=diff
==============================================================================
--- subversion/trunk/subversion/bindings/javahl/src/org/apache/subversion/javahl/callback/RemoteStatus.java
(original)
+++ subversion/trunk/subversion/bindings/javahl/src/org/apache/subversion/javahl/callback/RemoteStatus.java
Tue Jul  2 20:16:17 2013
@@ -56,37 +56,36 @@ public interface RemoteStatus
     /**
      * A directory was modified.
      * @param relativePath The session-relative path of the directory.
-     * @param revision The revision in which it was last modified.
      * @param childrenModified The directory contents changed.
      * @param propsModified The directory's properties changed.
      */
-    void modifiedDirectory(String relativePath, long revision,
-                           boolean childrenModified, boolean propsModified);
+    void modifiedDirectory(String relativePath,
+                           boolean childrenModified,
+                           boolean propsModified);
 
     /**
      * A file was modified.
      * @param relativePath The session-relative path of the directory.
-     * @param revision The revision in which it was last modified.
      * @param textModified The file contents changed.
      * @param propsModified The file's properties changed.
      */
-    void modifiedFile(String relativePath, long revision,
-                      boolean textModified, boolean propsModified);
+    void modifiedFile(String relativePath,
+                      boolean textModified,
+                      boolean propsModified);
 
     /**
      * A symbolic link was modified.
      * @param relativePath The session-relative path of the symlink.
-     * @param revision The revision in which it was last modified.
      * @param textModified The link target changed.
      * @param propsModified The symlink's properties changed.
      */
-    void modifiedSymlink(String relativePath, long revision,
-                         boolean targetModified, boolean propsModified);
+    void modifiedSymlink(String relativePath,
+                         boolean targetModified,
+                         boolean propsModified);
 
     /**
      * An entry was deleted.
      * @param relativePath The session-relative path of the entry.
-     * @param revision The revision in which it was deleted.
      */
-    void deleted(String relativePath, long revision);
+    void deleted(String relativePath);
 }

Modified: subversion/trunk/subversion/bindings/javahl/src/org/apache/subversion/javahl/remote/StateReporter.java
URL: http://svn.apache.org/viewvc/subversion/trunk/subversion/bindings/javahl/src/org/apache/subversion/javahl/remote/StateReporter.java?rev=1499094&r1=1499093&r2=1499094&view=diff
==============================================================================
--- subversion/trunk/subversion/bindings/javahl/src/org/apache/subversion/javahl/remote/StateReporter.java
(original)
+++ subversion/trunk/subversion/bindings/javahl/src/org/apache/subversion/javahl/remote/StateReporter.java
Tue Jul  2 20:16:17 2013
@@ -59,7 +59,7 @@ public class StateReporter extends JNIOb
                                 String lockToken)
         throws ClientException;
 
-    public native void finishReport() throws ClientException;
+    public native long finishReport() throws ClientException;
 
     public native void abortReport() throws ClientException;
 

Modified: subversion/trunk/subversion/bindings/javahl/src/org/apache/subversion/javahl/remote/StatusEditor.java
URL: http://svn.apache.org/viewvc/subversion/trunk/subversion/bindings/javahl/src/org/apache/subversion/javahl/remote/StatusEditor.java?rev=1499094&r1=1499093&r2=1499094&view=diff
==============================================================================
--- subversion/trunk/subversion/bindings/javahl/src/org/apache/subversion/javahl/remote/StatusEditor.java
(original)
+++ subversion/trunk/subversion/bindings/javahl/src/org/apache/subversion/javahl/remote/StatusEditor.java
Tue Jul  2 20:16:17 2013
@@ -104,7 +104,7 @@ class StatusEditor implements ISVNEditor
     {
         //DEBUG:System.err.println("  [J] StatusEditor.alterDirectory");
         checkState();
-        receiver.modifiedDirectory(relativePath, revision, (children != null),
+        receiver.modifiedDirectory(relativePath, (children != null),
                                    props_changed(properties));
     }
 
@@ -116,7 +116,7 @@ class StatusEditor implements ISVNEditor
     {
         //DEBUG:System.err.println("  [J] StatusEditor.alterFile");
         checkState();
-        receiver.modifiedFile(relativePath, revision,
+        receiver.modifiedFile(relativePath,
                               (checksum != null && contents != null),
                               props_changed(properties));
     }
@@ -128,7 +128,7 @@ class StatusEditor implements ISVNEditor
     {
         //DEBUG:System.err.println("  [J] StatusEditor.alterSymlink");
         checkState();
-        receiver.modifiedSymlink(relativePath, revision, (target != null),
+        receiver.modifiedSymlink(relativePath, (target != null),
                                  props_changed(properties));
     }
 
@@ -136,7 +136,7 @@ class StatusEditor implements ISVNEditor
     {
         //DEBUG:System.err.println("  [J] StatusEditor.delete");
         checkState();
-        receiver.deleted(relativePath, revision);
+        receiver.deleted(relativePath);
     }
 
     public void copy(String sourceRelativePath,

Modified: subversion/trunk/subversion/bindings/javahl/tests/org/apache/subversion/javahl/SVNRemoteTests.java
URL: http://svn.apache.org/viewvc/subversion/trunk/subversion/bindings/javahl/tests/org/apache/subversion/javahl/SVNRemoteTests.java?rev=1499094&r1=1499093&r2=1499094&view=diff
==============================================================================
--- subversion/trunk/subversion/bindings/javahl/tests/org/apache/subversion/javahl/SVNRemoteTests.java
(original)
+++ subversion/trunk/subversion/bindings/javahl/tests/org/apache/subversion/javahl/SVNRemoteTests.java
Tue Jul  2 20:16:17 2013
@@ -793,7 +793,6 @@ public class SVNRemoteTests extends SVNT
             public boolean textChanged = false;
             public boolean propsChanged = false;
             public boolean deleted = false;
-            public long revision = -1;
 
             StatInfo(String relpath, char kind, boolean added)
             {
@@ -802,14 +801,13 @@ public class SVNRemoteTests extends SVNT
                 this.deleted = !added;
             }
 
-            StatInfo(String relpath, char kind, long revision,
+            StatInfo(String relpath, char kind,
                      boolean textChanged, boolean propsChanged)
             {
                 this.relpath = relpath;
                 this.kind = kind;
                 this.textChanged = textChanged;
                 this.propsChanged = propsChanged;
-                this.revision = revision;
             }
         }
 
@@ -830,28 +828,28 @@ public class SVNRemoteTests extends SVNT
             status.add(new StatInfo(relativePath, 'L', true));
         }
 
-        public void modifiedDirectory(String relativePath, long revision,
+        public void modifiedDirectory(String relativePath,
                                       boolean childrenModified, boolean propsModified)
         {
-            status.add(new StatInfo(relativePath, 'D', revision,
+            status.add(new StatInfo(relativePath, 'D',
                                     childrenModified, propsModified));
         }
 
-        public void modifiedFile(String relativePath, long revision,
+        public void modifiedFile(String relativePath,
                                  boolean textModified, boolean propsModified)
         {
-            status.add(new StatInfo(relativePath, 'F', revision,
+            status.add(new StatInfo(relativePath, 'F',
                                     textModified, propsModified));
         }
 
-        public void modifiedSymlink(String relativePath, long revision,
+        public void modifiedSymlink(String relativePath,
                                     boolean targetModified, boolean propsModified)
         {
-            status.add(new StatInfo(relativePath, 'L', revision,
+            status.add(new StatInfo(relativePath, 'L',
                                     targetModified, propsModified));
         }
 
-        public void deleted(String relativePath, long revision)
+        public void deleted(String relativePath)
         {
             status.add(new StatInfo(relativePath, ' ', false));
         }
@@ -866,7 +864,7 @@ public class SVNRemoteTests extends SVNT
                                          Depth.infinity, receiver);
         try {
             rp.setPath("", 0, Depth.infinity, true, null);
-            rp.finishReport();
+            assertEquals(1, rp.finishReport());
         } finally {
             rp.dispose();
         }
@@ -891,7 +889,7 @@ public class SVNRemoteTests extends SVNT
                                          Depth.infinity, receiver);
         try {
             rp.setPath("", 1, Depth.infinity, false, null);
-            rp.finishReport();
+            assertEquals(2, rp.finishReport());
         } finally {
             rp.dispose();
         }
@@ -901,6 +899,5 @@ public class SVNRemoteTests extends SVNT
         assertEquals('F', mod.kind);
         assertEquals(false, mod.textChanged);
         assertEquals(true, mod.propsChanged);
-        assertEquals(1, mod.revision);
     }
 }



Mime
View raw message