subversion-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From julianf...@apache.org
Subject svn commit: r1685233 [2/3] - in /subversion/branches/move-tracking-2: ./ subversion/ subversion/bindings/javahl/native/ subversion/bindings/javahl/src/org/apache/subversion/javahl/types/ subversion/bindings/javahl/tests/org/apache/subversion/javahl/ su...
Date Sat, 13 Jun 2015 10:21:20 GMT
Modified: subversion/branches/move-tracking-2/subversion/bindings/javahl/native/Revision.cpp
URL: http://svn.apache.org/viewvc/subversion/branches/move-tracking-2/subversion/bindings/javahl/native/Revision.cpp?rev=1685233&r1=1685232&r2=1685233&view=diff
==============================================================================
--- subversion/branches/move-tracking-2/subversion/bindings/javahl/native/Revision.cpp (original)
+++ subversion/branches/move-tracking-2/subversion/bindings/javahl/native/Revision.cpp Sat Jun 13 10:21:18 2015
@@ -57,12 +57,12 @@ Revision::Revision(jobject jthis, bool h
       static jfieldID fid = 0;
       if (fid == 0)
         {
-          jclass clazz = env->FindClass(JAVA_PACKAGE"/types/Revision");
+          jclass clazz = env->FindClass(JAVAHL_CLASS("/types/Revision"));
           if (JNIUtil::isJavaExceptionThrown())
             POP_AND_RETURN_NOTHING();
 
           fid = env->GetFieldID(clazz, "revKind",
-                                "L"JAVA_PACKAGE"/types/Revision$Kind;");
+                                JAVAHL_ARG("/types/Revision$Kind;"));
           if (JNIUtil::isJavaExceptionThrown())
             POP_AND_RETURN_NOTHING();
         }
@@ -81,7 +81,7 @@ Revision::Revision(jobject jthis, bool h
             if (fidNum == 0)
               {
                 jclass clazz =
-                  env->FindClass(JAVA_PACKAGE"/types/Revision$Number");
+                  env->FindClass(JAVAHL_CLASS("/types/Revision$Number"));
                 if (JNIUtil::isJavaExceptionThrown())
                   POP_AND_RETURN_NOTHING();
 
@@ -99,7 +99,7 @@ Revision::Revision(jobject jthis, bool h
             if (fidDate == 0)
               {
                 jclass clazz =
-                  env->FindClass(JAVA_PACKAGE"/types/Revision$DateSpec");
+                  env->FindClass(JAVAHL_CLASS("/types/Revision$DateSpec"));
                 if (JNIUtil::isJavaExceptionThrown())
                   POP_AND_RETURN_NOTHING();
 
@@ -158,7 +158,7 @@ jobject
 Revision::makeJRevision(svn_revnum_t rev)
 {
   JNIEnv *env = JNIUtil::getEnv();
-  jclass clazz = env->FindClass(JAVA_PACKAGE "/types/Revision");
+  jclass clazz = env->FindClass(JAVAHL_CLASS("/types/Revision"));
   if (JNIUtil::isJavaExceptionThrown())
     return NULL;
 
@@ -166,7 +166,7 @@ Revision::makeJRevision(svn_revnum_t rev
   if (getInstance == 0)
     {
       getInstance = env->GetStaticMethodID(clazz, "getInstance",
-                                           "(J)L" JAVA_PACKAGE "/types/Revision;");
+                                           "(J)" JAVAHL_ARG("/types/Revision;"));
       if (JNIUtil::isExceptionThrown())
         return NULL;
     }

Modified: subversion/branches/move-tracking-2/subversion/bindings/javahl/native/RevisionRange.cpp
URL: http://svn.apache.org/viewvc/subversion/branches/move-tracking-2/subversion/bindings/javahl/native/RevisionRange.cpp?rev=1685233&r1=1685232&r2=1685233&view=diff
==============================================================================
--- subversion/branches/move-tracking-2/subversion/bindings/javahl/native/RevisionRange.cpp (original)
+++ subversion/branches/move-tracking-2/subversion/bindings/javahl/native/RevisionRange.cpp Sat Jun 13 10:21:18 2015
@@ -52,7 +52,7 @@ void get_range_info(jobject jrange,
 {
   JNIEnv *env = JNIUtil::getEnv();
 
-  jclass clazz = env->FindClass(JAVA_PACKAGE"/types/RevisionRange");
+  jclass clazz = env->FindClass(JAVAHL_CLASS("/types/RevisionRange"));
   if (JNIUtil::isExceptionThrown())
     return;
 
@@ -63,7 +63,7 @@ void get_range_info(jobject jrange,
       if (fmid == 0)
         {
           fmid = env->GetMethodID(clazz, "getFromRevision",
-                                  "()L"JAVA_PACKAGE"/types/Revision;");
+                                  "()" JAVAHL_ARG("/types/Revision;"));
           if (JNIUtil::isJavaExceptionThrown())
             return;
         }
@@ -87,7 +87,7 @@ void get_range_info(jobject jrange,
       if (tmid == 0)
         {
           tmid = env->GetMethodID(clazz, "getToRevision",
-                                  "()L"JAVA_PACKAGE"/types/Revision;");
+                                  "()" JAVAHL_ARG("/types/Revision;"));
           if (JNIUtil::isJavaExceptionThrown())
             return;
         }
@@ -163,7 +163,7 @@ RevisionRange::makeJRevisionRange(svn_me
 {
     JNIEnv *env = JNIUtil::getEnv();
 
-    jclass rangeClazz = env->FindClass(JAVA_PACKAGE "/types/RevisionRange");
+    jclass rangeClazz = env->FindClass(JAVAHL_CLASS("/types/RevisionRange"));
     if (JNIUtil::isJavaExceptionThrown())
         return NULL;
     static jmethodID rangeCtor = 0;

Modified: subversion/branches/move-tracking-2/subversion/bindings/javahl/native/RevisionRangeList.cpp
URL: http://svn.apache.org/viewvc/subversion/branches/move-tracking-2/subversion/bindings/javahl/native/RevisionRangeList.cpp?rev=1685233&r1=1685232&r2=1685233&view=diff
==============================================================================
--- subversion/branches/move-tracking-2/subversion/bindings/javahl/native/RevisionRangeList.cpp (original)
+++ subversion/branches/move-tracking-2/subversion/bindings/javahl/native/RevisionRangeList.cpp Sat Jun 13 10:21:18 2015
@@ -60,7 +60,7 @@ RevisionRangeList RevisionRangeList::cre
       jmethodID mid = 0;
       if (mid == 0)
         {
-          jclass cls = env->FindClass(JAVA_PACKAGE"/types/RevisionRangeList");
+          jclass cls = env->FindClass(JAVAHL_CLASS("/types/RevisionRangeList"));
           if (JNIUtil::isJavaExceptionThrown())
             return RevisionRangeList(NULL, pool);
 

Modified: subversion/branches/move-tracking-2/subversion/bindings/javahl/native/SVNClient.cpp
URL: http://svn.apache.org/viewvc/subversion/branches/move-tracking-2/subversion/bindings/javahl/native/SVNClient.cpp?rev=1685233&r1=1685232&r2=1685233&view=diff
==============================================================================
--- subversion/branches/move-tracking-2/subversion/bindings/javahl/native/SVNClient.cpp (original)
+++ subversion/branches/move-tracking-2/subversion/bindings/javahl/native/SVNClient.cpp Sat Jun 13 10:21:18 2015
@@ -96,21 +96,21 @@ SVNClient *SVNClient::getCppObject(jobje
 {
     static jfieldID fid = 0;
     jlong cppAddr = SVNBase::findCppAddrForJObject(jthis, &fid,
-                                                   JAVA_PACKAGE"/SVNClient");
+                                                   JAVAHL_CLASS("/SVNClient"));
     return (cppAddr == 0 ? NULL : reinterpret_cast<SVNClient *>(cppAddr));
 }
 
 void SVNClient::dispose(jobject jthis)
 {
     static jfieldID fid = 0;
-    SVNBase::dispose(jthis, &fid, JAVA_PACKAGE"/SVNClient");
+    SVNBase::dispose(jthis, &fid, JAVAHL_CLASS("/SVNClient"));
 }
 
 jobject SVNClient::getVersionExtended(bool verbose)
 {
     JNIEnv *const env = JNIUtil::getEnv();
 
-    jclass clazz = env->FindClass(JAVA_PACKAGE"/types/VersionExtended");
+    jclass clazz = env->FindClass(JAVAHL_CLASS("/types/VersionExtended"));
     if (JNIUtil::isJavaExceptionThrown())
         return NULL;
 

Modified: subversion/branches/move-tracking-2/subversion/bindings/javahl/native/SVNRepos.cpp
URL: http://svn.apache.org/viewvc/subversion/branches/move-tracking-2/subversion/bindings/javahl/native/SVNRepos.cpp?rev=1685233&r1=1685232&r2=1685233&view=diff
==============================================================================
--- subversion/branches/move-tracking-2/subversion/bindings/javahl/native/SVNRepos.cpp (original)
+++ subversion/branches/move-tracking-2/subversion/bindings/javahl/native/SVNRepos.cpp Sat Jun 13 10:21:18 2015
@@ -50,14 +50,14 @@ SVNRepos *SVNRepos::getCppObject(jobject
 {
   static jfieldID fid = 0;
   jlong cppAddr = SVNBase::findCppAddrForJObject(jthis, &fid,
-                                                 JAVA_PACKAGE"/SVNRepos");
+                                                 JAVAHL_CLASS("/SVNRepos"));
   return (cppAddr == 0 ? NULL : reinterpret_cast<SVNRepos *>(cppAddr));
 }
 
 void SVNRepos::dispose(jobject jthis)
 {
   static jfieldID fid = 0;
-  SVNBase::dispose(jthis, &fid, JAVA_PACKAGE"/SVNRepos");
+  SVNBase::dispose(jthis, &fid, JAVAHL_CLASS("/SVNRepos"));
 }
 
 void SVNRepos::cancelOperation()
@@ -716,7 +716,7 @@ jobject SVNRepos::lslocks(File &path, sv
               NULL);
 
   JNIEnv *env = JNIUtil::getEnv();
-  jclass clazz = env->FindClass(JAVA_PACKAGE"/types/Lock");
+  jclass clazz = env->FindClass(JAVAHL_CLASS("/types/Lock"));
   if (JNIUtil::isJavaExceptionThrown())
     return NULL;
 

Modified: subversion/branches/move-tracking-2/subversion/bindings/javahl/native/StateReporter.cpp
URL: http://svn.apache.org/viewvc/subversion/branches/move-tracking-2/subversion/bindings/javahl/native/StateReporter.cpp?rev=1685233&r1=1685232&r2=1685233&view=diff
==============================================================================
--- subversion/branches/move-tracking-2/subversion/bindings/javahl/native/StateReporter.cpp (original)
+++ subversion/branches/move-tracking-2/subversion/bindings/javahl/native/StateReporter.cpp Sat Jun 13 10:21:18 2015
@@ -50,7 +50,7 @@ StateReporter::getCppObject(jobject jthi
 {
   static jfieldID fid = 0;
   jlong cppAddr = SVNBase::findCppAddrForJObject(jthis, &fid,
-      JAVA_PACKAGE"/remote/StateReporter");
+      JAVAHL_CLASS("/remote/StateReporter"));
   return (cppAddr == 0 ? NULL : reinterpret_cast<StateReporter*>(cppAddr));
 }
 
@@ -63,7 +63,7 @@ StateReporter::dispose(jobject jthis)
     abortReport();
 
   static jfieldID fid = 0;
-  SVNBase::dispose(jthis, &fid, JAVA_PACKAGE"/remote/StateReporter");
+  SVNBase::dispose(jthis, &fid, JAVAHL_CLASS("/remote/StateReporter"));
 }
 
 namespace {

Modified: subversion/branches/move-tracking-2/subversion/bindings/javahl/native/StatusCallback.cpp
URL: http://svn.apache.org/viewvc/subversion/branches/move-tracking-2/subversion/bindings/javahl/native/StatusCallback.cpp?rev=1685233&r1=1685232&r2=1685233&view=diff
==============================================================================
--- subversion/branches/move-tracking-2/subversion/bindings/javahl/native/StatusCallback.cpp (original)
+++ subversion/branches/move-tracking-2/subversion/bindings/javahl/native/StatusCallback.cpp Sat Jun 13 10:21:18 2015
@@ -81,13 +81,13 @@ StatusCallback::doStatus(const char *loc
   // it can be cached.
   if (mid == 0)
     {
-      jclass clazz = env->FindClass(JAVA_PACKAGE"/callback/StatusCallback");
+      jclass clazz = env->FindClass(JAVAHL_CLASS("/callback/StatusCallback"));
       if (JNIUtil::isJavaExceptionThrown())
         POP_AND_RETURN(SVN_NO_ERROR);
 
       mid = env->GetMethodID(clazz, "doStatus",
                              "(Ljava/lang/String;"
-                             "L"JAVA_PACKAGE"/types/Status;)V");
+                             JAVAHL_ARG("/types/Status;") ")V");
       if (JNIUtil::isJavaExceptionThrown() || mid == 0)
         POP_AND_RETURN(SVN_NO_ERROR);
     }

Modified: subversion/branches/move-tracking-2/subversion/bindings/javahl/native/SubversionException.cpp
URL: http://svn.apache.org/viewvc/subversion/branches/move-tracking-2/subversion/bindings/javahl/native/SubversionException.cpp?rev=1685233&r1=1685232&r2=1685233&view=diff
==============================================================================
--- subversion/branches/move-tracking-2/subversion/bindings/javahl/native/SubversionException.cpp (original)
+++ subversion/branches/move-tracking-2/subversion/bindings/javahl/native/SubversionException.cpp Sat Jun 13 10:21:18 2015
@@ -27,6 +27,6 @@
 namespace JavaHL {
 
 const char* const SubversionException::m_class_name =
-  JAVA_PACKAGE"/SubversionException";
+  JAVAHL_CLASS("/SubversionException");
 
 } // namespace JavaHL

Modified: subversion/branches/move-tracking-2/subversion/bindings/javahl/native/VersionExtended.cpp
URL: http://svn.apache.org/viewvc/subversion/branches/move-tracking-2/subversion/bindings/javahl/native/VersionExtended.cpp?rev=1685233&r1=1685232&r2=1685233&view=diff
==============================================================================
--- subversion/branches/move-tracking-2/subversion/bindings/javahl/native/VersionExtended.cpp (original)
+++ subversion/branches/move-tracking-2/subversion/bindings/javahl/native/VersionExtended.cpp Sat Jun 13 10:21:18 2015
@@ -27,7 +27,7 @@
 #include "JNIUtil.h"
 #include "VersionExtended.h"
 
-const VersionExtended *
+VersionExtended *
 VersionExtended::getCppObject(jobject jthis)
 {
   if (!jthis)
@@ -35,7 +35,7 @@ VersionExtended::getCppObject(jobject jt
 
   static jfieldID fid = 0;
   jlong cppAddr = SVNBase::findCppAddrForJObject(
-      jthis, &fid, JAVA_PACKAGE"/types/VersionExtended");
+      jthis, &fid, JAVAHL_CLASS("/types/VersionExtended"));
   return (cppAddr == 0 ? NULL : reinterpret_cast<VersionExtended *>(cppAddr));
 }
 
@@ -46,7 +46,7 @@ static jobject getWrapperAddress(jobject
   if (!*fid)
     {
       *fid = env->GetFieldID(env->GetObjectClass(jthat), "wrapper",
-                             "L"JAVA_PACKAGE"/types/VersionExtended;");
+                             JAVAHL_ARG("/types/VersionExtended;"));
       if (JNIUtil::isJavaExceptionThrown())
         {
           *fid = 0;
@@ -94,5 +94,5 @@ VersionExtended::~VersionExtended() {}
 void VersionExtended::dispose(jobject jthis)
 {
   static jfieldID fid = 0;
-  SVNBase::dispose(jthis, &fid, JAVA_PACKAGE"/types/VersionExtended");
+  SVNBase::dispose(jthis, &fid, JAVAHL_CLASS("/types/VersionExtended"));
 }

Modified: subversion/branches/move-tracking-2/subversion/bindings/javahl/native/VersionExtended.h
URL: http://svn.apache.org/viewvc/subversion/branches/move-tracking-2/subversion/bindings/javahl/native/VersionExtended.h?rev=1685233&r1=1685232&r2=1685233&view=diff
==============================================================================
--- subversion/branches/move-tracking-2/subversion/bindings/javahl/native/VersionExtended.h (original)
+++ subversion/branches/move-tracking-2/subversion/bindings/javahl/native/VersionExtended.h Sat Jun 13 10:21:18 2015
@@ -33,7 +33,7 @@
 class VersionExtended : public SVNBase
 {
 public:
-  static const VersionExtended *getCppObject(jobject jthis);
+  static VersionExtended *getCppObject(jobject jthis);
   static const VersionExtended *getCppObjectFromLinkedLib(jobject jthat);
   static const VersionExtended *getCppObjectFromLoadedLib(jobject jthat);
   static const VersionExtended *getCppObjectFromLinkedLibIterator(jobject jthat);

Modified: subversion/branches/move-tracking-2/subversion/bindings/javahl/native/org_apache_subversion_javahl_types_VersionExtended.cpp
URL: http://svn.apache.org/viewvc/subversion/branches/move-tracking-2/subversion/bindings/javahl/native/org_apache_subversion_javahl_types_VersionExtended.cpp?rev=1685233&r1=1685232&r2=1685233&view=diff
==============================================================================
--- subversion/branches/move-tracking-2/subversion/bindings/javahl/native/org_apache_subversion_javahl_types_VersionExtended.cpp (original)
+++ subversion/branches/move-tracking-2/subversion/bindings/javahl/native/org_apache_subversion_javahl_types_VersionExtended.cpp Sat Jun 13 10:21:18 2015
@@ -33,8 +33,24 @@
 #include "JNIStackElement.h"
 #include <string>
 
+#include "svn_private_config.h"
+
 // VersionExtended native methods
 
+JNIEXPORT void JNICALL
+Java_org_apache_subversion_javahl_types_VersionExtended_dispose(
+    JNIEnv *env, jobject jthis)
+{
+  JNIEntry(VersionExtended, dispose);
+  VersionExtended *const vx = VersionExtended::getCppObject(jthis);
+  if (vx == NULL)
+    {
+      JNIUtil::throwError(_("bad C++ this"));
+      return;
+    }
+  vx->dispose(jthis);
+}
+
 JNIEXPORT jstring JNICALL
 Java_org_apache_subversion_javahl_types_VersionExtended_getBuildDate(
     JNIEnv *env, jobject jthis)

Modified: subversion/branches/move-tracking-2/subversion/bindings/javahl/native/org_apache_subversion_javahl_util_ConfigImpl_Category.cpp
URL: http://svn.apache.org/viewvc/subversion/branches/move-tracking-2/subversion/bindings/javahl/native/org_apache_subversion_javahl_util_ConfigImpl_Category.cpp?rev=1685233&r1=1685232&r2=1685233&view=diff
==============================================================================
--- subversion/branches/move-tracking-2/subversion/bindings/javahl/native/org_apache_subversion_javahl_util_ConfigImpl_Category.cpp (original)
+++ subversion/branches/move-tracking-2/subversion/bindings/javahl/native/org_apache_subversion_javahl_util_ConfigImpl_Category.cpp Sat Jun 13 10:21:18 2015
@@ -275,7 +275,7 @@ Java_org_apache_subversion_javahl_util_C
         static jmethodID mid = 0;
         if (0 == mid)
           {
-            jclass cls = e->FindClass(JAVA_PACKAGE"/ISVNConfig$Enumerator");
+            jclass cls = e->FindClass(JAVAHL_CLASS("/ISVNConfig$Enumerator"));
             if (JNIUtil::isJavaExceptionThrown())
               return false;
             mid = e->GetMethodID(cls, "option",

Modified: subversion/branches/move-tracking-2/subversion/bindings/javahl/native/org_apache_subversion_javahl_util_SubstLib.cpp
URL: http://svn.apache.org/viewvc/subversion/branches/move-tracking-2/subversion/bindings/javahl/native/org_apache_subversion_javahl_util_SubstLib.cpp?rev=1685233&r1=1685232&r2=1685233&view=diff
==============================================================================
--- subversion/branches/move-tracking-2/subversion/bindings/javahl/native/org_apache_subversion_javahl_util_SubstLib.cpp (original)
+++ subversion/branches/move-tracking-2/subversion/bindings/javahl/native/org_apache_subversion_javahl_util_SubstLib.cpp Sat Jun 13 10:21:18 2015
@@ -61,7 +61,7 @@ build_keywords_common(Java::Env env, con
   svn_string_t* keywords_string = keywords_contents.get_string(pool);
   const char* revision = (jrevision < 0 ? NULL
                           : apr_psprintf(pool.getPool(),
-                                         "%"APR_UINT64_T_FMT,
+                                         "%" APR_UINT64_T_FMT,
                                          apr_uint64_t(jrevision)));
   const Java::String::Contents url_contents(url);
   const Java::String::Contents root_url_contents(repos_root_url);

Modified: subversion/branches/move-tracking-2/subversion/bindings/javahl/src/org/apache/subversion/javahl/types/VersionExtended.java
URL: http://svn.apache.org/viewvc/subversion/branches/move-tracking-2/subversion/bindings/javahl/src/org/apache/subversion/javahl/types/VersionExtended.java?rev=1685233&r1=1685232&r2=1685233&view=diff
==============================================================================
--- subversion/branches/move-tracking-2/subversion/bindings/javahl/src/org/apache/subversion/javahl/types/VersionExtended.java (original)
+++ subversion/branches/move-tracking-2/subversion/bindings/javahl/src/org/apache/subversion/javahl/types/VersionExtended.java Sat Jun 13 10:21:18 2015
@@ -41,6 +41,21 @@ public class VersionExtended
     }
 
     /**
+     * Release the native peer. This method must be called to release
+     * the native resources held by this object.
+     * <p>
+     * Once this method is called, all object references obtained from
+     * the iterators returned by {@link #getLinkedLibs()} and
+     * {@link #getLoadedLibs()} become invalid and should no longer be used.
+     */
+    public native void dispose();
+
+    /**
+     * release the native peer (should use dispose instead)
+     */
+    public native void finalize();
+
+    /**
      * @return The date when the libsvn_subr library was compiled, in
      * the format defined by the C standard macro #__DATE__.
      */

Modified: subversion/branches/move-tracking-2/subversion/bindings/javahl/tests/org/apache/subversion/javahl/BasicTests.java
URL: http://svn.apache.org/viewvc/subversion/branches/move-tracking-2/subversion/bindings/javahl/tests/org/apache/subversion/javahl/BasicTests.java?rev=1685233&r1=1685232&r2=1685233&view=diff
==============================================================================
--- subversion/branches/move-tracking-2/subversion/bindings/javahl/tests/org/apache/subversion/javahl/BasicTests.java (original)
+++ subversion/branches/move-tracking-2/subversion/bindings/javahl/tests/org/apache/subversion/javahl/BasicTests.java Sat Jun 13 10:21:18 2015
@@ -139,9 +139,10 @@ public class BasicTests extends SVNTests
      */
     public void testVersionExtendedQuiet() throws Throwable
     {
+        VersionExtended vx = null;
         try
         {
-            VersionExtended vx = client.getVersionExtended(false);
+            vx = client.getVersionExtended(false);
             String result = vx.getBuildDate();
             if (result == null || result.trim().length() == 0)
                 throw new Exception("Build date empty");
@@ -160,6 +161,11 @@ public class BasicTests extends SVNTests
             fail("VersionExtended should always be available unless the " +
                  "native libraries failed to initialize: " + e);
         }
+        finally
+        {
+            if (vx != null)
+                vx.dispose();
+        }
     }
 
     /**
@@ -168,9 +174,10 @@ public class BasicTests extends SVNTests
      */
     public void testVersionExtendedVerbose() throws Throwable
     {
+        VersionExtended vx = null;
         try
         {
-            VersionExtended vx = client.getVersionExtended(true);
+            vx = client.getVersionExtended(true);
             String result = vx.getRuntimeHost();
             if (result == null || result.trim().length() == 0)
                 throw new Exception("Runtime host empty");
@@ -216,6 +223,11 @@ public class BasicTests extends SVNTests
             fail("VersionExtended should always be available unless the " +
                  "native libraries failed to initialize: " + e);
         }
+        finally
+        {
+            if (vx != null)
+                vx.dispose();
+        }
     }
 
     /**

Modified: subversion/branches/move-tracking-2/subversion/bindings/swig/core.i
URL: http://svn.apache.org/viewvc/subversion/branches/move-tracking-2/subversion/bindings/swig/core.i?rev=1685233&r1=1685232&r2=1685233&view=diff
==============================================================================
--- subversion/branches/move-tracking-2/subversion/bindings/swig/core.i (original)
+++ subversion/branches/move-tracking-2/subversion/bindings/swig/core.i Sat Jun 13 10:21:18 2015
@@ -532,8 +532,10 @@
         $1 = NULL;
     }
     else if (SvPOK($input)) {
-        if (_global_pool == NULL)
+        if (_global_pool == NULL) {
             _global_pool = svn_swig_pl_make_pool((SV *)NULL);
+            SPAGAIN;
+        }
         $1 = apr_pstrdup(_global_pool, SvPV_nolen($input));
     }
     else {

Modified: subversion/branches/move-tracking-2/subversion/bindings/swig/include/svn_containers.swg
URL: http://svn.apache.org/viewvc/subversion/branches/move-tracking-2/subversion/bindings/swig/include/svn_containers.swg?rev=1685233&r1=1685232&r2=1685233&view=diff
==============================================================================
--- subversion/branches/move-tracking-2/subversion/bindings/swig/include/svn_containers.swg (original)
+++ subversion/branches/move-tracking-2/subversion/bindings/swig/include/svn_containers.swg Sat Jun 13 10:21:18 2015
@@ -269,8 +269,10 @@
 %typemap(in) apr_hash_t *PROPHASH
   (apr_pool_t *_global_pool = NULL)
 {
-  if (_global_pool == NULL)
+  if (_global_pool == NULL) {
     _global_pool = svn_swig_pl_make_pool((SV *)NULL);
+    SPAGAIN;
+  }
   $1 = svn_swig_pl_hash_to_prophash($input, _global_pool);  
 }
 %typemap(out) apr_hash_t *PROPHASH

Modified: subversion/branches/move-tracking-2/subversion/bindings/swig/include/svn_string.swg
URL: http://svn.apache.org/viewvc/subversion/branches/move-tracking-2/subversion/bindings/swig/include/svn_string.swg?rev=1685233&r1=1685232&r2=1685233&view=diff
==============================================================================
--- subversion/branches/move-tracking-2/subversion/bindings/swig/include/svn_string.swg (original)
+++ subversion/branches/move-tracking-2/subversion/bindings/swig/include/svn_string.swg Sat Jun 13 10:21:18 2015
@@ -90,6 +90,7 @@ typedef struct svn_string_t svn_string_t
 %typemap(in) svn_stringbuf_t * {
     apr_size_t len;
     char *buf;
+    apr_pool_t *pool;
 
     if (!SvOK($input)) {
         $1 = NULL;
@@ -97,8 +98,9 @@ typedef struct svn_string_t svn_string_t
         buf = SvPV($input, len);
         /* Another case of ugly pool handling, this should use the current
            default pool, or make a new one if it doesn't exist yet */
-        $1 = svn_stringbuf_ncreate(buf,len,
-                                   svn_swig_pl_make_pool ((SV *)NULL));
+        pool = svn_swig_pl_make_pool ((SV *)NULL);
+        SPAGAIN;
+        $1 = svn_stringbuf_ncreate(buf,len, pool);
     } else {
         croak("Not a string");
     }

Modified: subversion/branches/move-tracking-2/subversion/bindings/swig/include/svn_types.swg
URL: http://svn.apache.org/viewvc/subversion/branches/move-tracking-2/subversion/bindings/swig/include/svn_types.swg?rev=1685233&r1=1685232&r2=1685233&view=diff
==============================================================================
--- subversion/branches/move-tracking-2/subversion/bindings/swig/include/svn_types.swg (original)
+++ subversion/branches/move-tracking-2/subversion/bindings/swig/include/svn_types.swg Sat Jun 13 10:21:18 2015
@@ -423,9 +423,11 @@ svn_ ## TYPE ## _swig_rb_closed(VALUE se
         if (SvOK(exception_handler)) {
             SV *callback_result;
 
+            PUTBACK;
             svn_swig_pl_callback_thunk (CALL_SV, exception_handler,
                                         &callback_result, "S", $1,
                                         $1_descriptor);
+            SPAGAIN;
         } else {
             $result = SWIG_NewPointerObj($1, $1_descriptor, 0);
             argvi++;
@@ -548,6 +550,7 @@ svn_ ## TYPE ## _swig_rb_closed(VALUE se
 %typemap(in) apr_pool_t *pool "";
 %typemap(default) apr_pool_t *pool(apr_pool_t *_global_pool) {
     _global_pool = $1 = svn_swig_pl_make_pool (ST(items-1));
+    SPAGAIN;
 }
 #endif
 #ifdef SWIGRUBY
@@ -935,15 +938,24 @@ svn_ ## TYPE ## _swig_rb_closed(VALUE se
 #ifdef SWIGPERL
 %typemap(in) svn_stream_t * {
     svn_swig_pl_make_stream (&$1, $input);
+    SPAGAIN;
 }
 
 %typemap(out) svn_stream_t * {
-    $result = svn_swig_pl_from_stream ($1);
+    SV* tmp;
+    PUTBACK;
+    tmp = svn_swig_pl_from_stream ($1);
+    SPAGAIN;
+    $result = tmp;
     argvi++;
 }
 
 %typemap(argout) svn_stream_t ** {
-  %append_output(svn_swig_pl_from_stream(*$1));
+    SV *tmp;
+    PUTBACK;
+    tmp = svn_swig_pl_from_stream(*$1);
+    SPAGAIN;
+    %append_output(tmp);
 }
 #endif
 
@@ -1116,7 +1128,11 @@ svn_ ## TYPE ## _swig_rb_closed(VALUE se
 }
 
 %typemap(argout) unsigned char *result_digest {
-    %append_output(svn_swig_pl_from_md5($1));
+    SV *tmp;
+    PUTBACK;
+    tmp = svn_swig_pl_from_md5($1);
+    SPAGAIN;
+    %append_output(tmp);
 }
 #endif
 
@@ -1170,8 +1186,10 @@ svn_ ## TYPE ## _swig_rb_closed(VALUE se
 %typemap(in) svn_opt_revision_t * 
   (svn_opt_revision_t rev, apr_pool_t *_global_pool = NULL)
 {
-  if (_global_pool == NULL)
+  if (_global_pool == NULL) {
     _global_pool = svn_swig_pl_make_pool((SV *)NULL);
+    SPAGAIN;
+  }
   $1 = svn_swig_pl_set_revision(&rev, $input, TRUE, _global_pool);
 }
 #endif

Modified: subversion/branches/move-tracking-2/subversion/bindings/swig/perl/libsvn_swig_perl/swigutil_pl.c
URL: http://svn.apache.org/viewvc/subversion/branches/move-tracking-2/subversion/bindings/swig/perl/libsvn_swig_perl/swigutil_pl.c?rev=1685233&r1=1685232&r2=1685233&view=diff
==============================================================================
--- subversion/branches/move-tracking-2/subversion/bindings/swig/perl/libsvn_swig_perl/swigutil_pl.c (original)
+++ subversion/branches/move-tracking-2/subversion/bindings/swig/perl/libsvn_swig_perl/swigutil_pl.c Sat Jun 13 10:21:18 2015
@@ -520,6 +520,7 @@ svn_opt_revision_t *svn_swig_pl_set_revi
    put returned value in result if result is not NULL
 */
 
+/* NOTE: calls back into Perl (directly) */
 svn_error_t *svn_swig_pl_callback_thunk(perl_func_invoker_t caller_func,
                                         void *func,
                                         SV **result,
@@ -670,6 +671,7 @@ static item_baton * make_baton(apr_pool_
     return newb;
 }
 
+/* NOTE: calls back into Perl (by calling svn_swig_pl_callback_thunk) */
 static svn_error_t * close_baton(void *baton, const char *method, apr_pool_t *pool)
 {
     item_baton *ib = baton;
@@ -690,6 +692,7 @@ static svn_error_t * close_baton(void *b
     return SVN_NO_ERROR;
 }
 
+/* NOTE: calls back into Perl (by calling svn_swig_pl_callback_thunk) */
 static svn_error_t * thunk_set_target_revision(void *edit_baton,
                                                svn_revnum_t target_revision,
                                                apr_pool_t *pool)
@@ -703,6 +706,7 @@ static svn_error_t * thunk_set_target_re
     return SVN_NO_ERROR;
 }
 
+/* NOTE: calls back into Perl (by calling svn_swig_pl_callback_thunk) */
 static svn_error_t * thunk_open_root(void *edit_baton,
                                      svn_revnum_t base_revision,
                                      apr_pool_t *dir_pool,
@@ -720,6 +724,7 @@ static svn_error_t * thunk_open_root(voi
     return SVN_NO_ERROR;
 }
 
+/* NOTE: calls back into Perl (by calling svn_swig_pl_callback_thunk) */
 static svn_error_t * thunk_delete_entry(const char *path,
                                         svn_revnum_t revision,
                                         void *parent_baton,
@@ -734,6 +739,7 @@ static svn_error_t * thunk_delete_entry(
     return SVN_NO_ERROR;
 }
 
+/* NOTE: calls back into Perl (by calling svn_swig_pl_callback_thunk) */
 static svn_error_t * thunk_add_directory(const char *path,
                                          void *parent_baton,
                                          const char *copyfrom_path,
@@ -753,6 +759,7 @@ static svn_error_t * thunk_add_directory
     return SVN_NO_ERROR;
 }
 
+/* NOTE: calls back into Perl (by calling svn_swig_pl_callback_thunk) */
 static svn_error_t * thunk_open_directory(const char *path,
                                           void *parent_baton,
                                           svn_revnum_t base_revision,
@@ -772,6 +779,7 @@ static svn_error_t * thunk_open_director
     return SVN_NO_ERROR;
 }
 
+/* NOTE: calls back into Perl (by calling svn_swig_pl_callback_thunk) */
 static svn_error_t * thunk_change_dir_prop(void *dir_baton,
                                            const char *name,
                                            const svn_string_t *value,
@@ -787,12 +795,14 @@ static svn_error_t * thunk_change_dir_pr
     return SVN_NO_ERROR;
 }
 
+/* NOTE: calls back into Perl (by calling close_baton) */
 static svn_error_t * thunk_close_directory(void *dir_baton,
                                            apr_pool_t *pool)
 {
     return close_baton(dir_baton, "close_directory", pool);
 }
 
+/* NOTE: calls back into Perl (by calling svn_swig_pl_callback_thunk) */
 static svn_error_t * thunk_absent_directory(const char *path,
                                             void *parent_baton,
                                             apr_pool_t *pool)
@@ -807,6 +817,7 @@ static svn_error_t * thunk_absent_direct
     return SVN_NO_ERROR;
 }
 
+/* NOTE: calls back into Perl (by calling svn_swig_pl_callback_thunk) */
 static svn_error_t * thunk_add_file(const char *path,
                                     void *parent_baton,
                                     const char *copyfrom_path,
@@ -827,6 +838,7 @@ static svn_error_t * thunk_add_file(cons
     return SVN_NO_ERROR;
 }
 
+/* NOTE: calls back into Perl (by calling svn_swig_pl_callback_thunk) */
 static svn_error_t * thunk_open_file(const char *path,
                                      void *parent_baton,
                                      svn_revnum_t base_revision,
@@ -845,6 +857,7 @@ static svn_error_t * thunk_open_file(con
     return SVN_NO_ERROR;
 }
 
+/* NOTE: calls back into Perl (by calling svn_swig_pl_callback_thunk) */
 static svn_error_t * thunk_window_handler(svn_txdelta_window_t *window,
                                           void *baton)
 {
@@ -865,6 +878,7 @@ static svn_error_t * thunk_window_handle
     return SVN_NO_ERROR;
 }
 
+/* NOTE: calls back into Perl (by calling svn_swig_pl_callback_thunk) */
 static svn_error_t *
 thunk_apply_textdelta(void *file_baton,
                       const char *base_checksum,
@@ -909,6 +923,7 @@ thunk_apply_textdelta(void *file_baton,
     return SVN_NO_ERROR;
 }
 
+/* NOTE: calls back into Perl (by calling svn_swig_pl_callback_thunk) */
 static svn_error_t * thunk_change_file_prop(void *file_baton,
                                             const char *name,
                                             const svn_string_t *value,
@@ -924,6 +939,7 @@ static svn_error_t * thunk_change_file_p
     return SVN_NO_ERROR;
 }
 
+/* NOTE: calls back into Perl (by calling svn_swig_pl_callback_thunk) */
 static svn_error_t * thunk_close_file(void *file_baton,
                                       const char *text_checksum,
                                       apr_pool_t *pool)
@@ -940,6 +956,7 @@ static svn_error_t * thunk_close_file(vo
     return SVN_NO_ERROR;
 }
 
+/* NOTE: calls back into Perl (by calling svn_swig_pl_callback_thunk) */
 static svn_error_t * thunk_absent_file(const char *path,
                                        void *parent_baton,
                                        apr_pool_t *pool)
@@ -954,12 +971,14 @@ static svn_error_t * thunk_absent_file(c
     return SVN_NO_ERROR;
 }
 
+/* NOTE: calls back into Perl (by calling close_baton) */
 static svn_error_t * thunk_close_edit(void *edit_baton,
                                       apr_pool_t *pool)
 {
     return close_baton(edit_baton, "close_edit", pool);
 }
 
+/* NOTE: calls back into Perl (by calling close_baton) */
 static svn_error_t * thunk_abort_edit(void *edit_baton,
                                       apr_pool_t *pool)
 {
@@ -967,18 +986,6 @@ static svn_error_t * thunk_abort_edit(vo
 }
 
 
-void
-svn_swig_pl_wrap_window_handler(svn_txdelta_window_handler_t *handler,
-                                void **h_baton,
-                                SV *callback,
-                                apr_pool_t *pool)
-{
-    *handler = thunk_window_handler;
-    *h_baton = callback;
-    SvREFCNT_inc(callback);
-    svn_swig_pl_hold_ref_in_pool(pool, callback);
-}
-
 void svn_swig_pl_make_editor(svn_delta_editor_t **editor,
                              void **edit_baton,
                              SV *perl_editor,
@@ -1008,6 +1015,7 @@ void svn_swig_pl_make_editor(svn_delta_e
     svn_swig_pl_hold_ref_in_pool(pool, perl_editor);
 }
 
+/* NOTE: calls back into Perl (by calling svn_swig_pl_callback_thunk) */
 svn_error_t *svn_swig_pl_thunk_log_receiver(void *baton,
                                             apr_hash_t *changed_paths,
                                             svn_revnum_t rev,
@@ -1032,6 +1040,7 @@ svn_error_t *svn_swig_pl_thunk_log_recei
     return SVN_NO_ERROR;
 }
 
+/* NOTE: calls back into Perl (by calling svn_swig_pl_callback_thunk) */
 svn_error_t *svn_swig_pl_thunk_log_entry_receiver(void *baton,
                                                   svn_log_entry_t *log_entry,
                                                   apr_pool_t *pool)
@@ -1050,6 +1059,7 @@ svn_error_t *svn_swig_pl_thunk_log_entry
     return SVN_NO_ERROR;
 }
 
+/* NOTE: calls back into Perl (by calling svn_swig_pl_callback_thunk) */
 svn_error_t * svn_swig_pl_thunk_client_diff_summarize_func(
                      const svn_client_diff_summarize_t *diff,
                      void *baton,
@@ -1069,6 +1079,7 @@ svn_error_t * svn_swig_pl_thunk_client_d
     return SVN_NO_ERROR;
 }
 
+/* NOTE: calls back into Perl (by calling svn_swig_pl_callback_thunk) */
 svn_error_t *svn_swig_pl_thunk_history_func(void *baton,
                                             const char *path,
                                             svn_revnum_t revision,
@@ -1086,6 +1097,7 @@ svn_error_t *svn_swig_pl_thunk_history_f
     return SVN_NO_ERROR;
 }
 
+/* NOTE: calls back into Perl (by calling svn_swig_pl_callback_thunk) */
 svn_error_t *svn_swig_pl_thunk_authz_func(svn_boolean_t *allowed,
                                           svn_fs_root_t *root,
                                           const char *path,
@@ -1108,6 +1120,7 @@ svn_error_t *svn_swig_pl_thunk_authz_fun
     return SVN_NO_ERROR;
 }
 
+/* NOTE: calls back into Perl (by calling svn_swig_pl_callback_thunk) */
 svn_error_t *svn_swig_pl_thunk_commit_callback(svn_revnum_t new_revision,
                                                const char *date,
                                                const char *author,
@@ -1122,6 +1135,7 @@ svn_error_t *svn_swig_pl_thunk_commit_ca
     return SVN_NO_ERROR;
 }
 
+/* NOTE: calls back into Perl (by calling svn_swig_pl_callback_thunk) */
 svn_error_t *svn_swig_pl_thunk_commit_callback2(const svn_commit_info_t *commit_info,
                                                 void *baton,
                                                 apr_pool_t *pool)
@@ -1140,6 +1154,7 @@ svn_error_t *svn_swig_pl_thunk_commit_ca
 
 /* Wrap RA */
 
+/* NOTE: calls back into Perl (by calling svn_swig_pl_callback_thunk) */
 static svn_error_t * thunk_open_tmp_file(apr_file_t **fp,
                                          void *callback_baton,
                                          apr_pool_t *pool)
@@ -1158,11 +1173,12 @@ static svn_error_t * thunk_open_tmp_file
     return SVN_NO_ERROR;
 }
 
-svn_error_t *thunk_get_wc_prop(void *baton,
-                               const char *relpath,
-                               const char *name,
-                               const svn_string_t **value,
-                               apr_pool_t *pool)
+/* NOTE: calls back into Perl (by calling svn_swig_pl_callback_thunk) */
+static svn_error_t *thunk_get_wc_prop(void *baton,
+                                      const char *relpath,
+                                      const char *name,
+                                      const svn_string_t **value,
+                                      apr_pool_t *pool)
 {
     SV *result;
     char *data;
@@ -1215,6 +1231,7 @@ svn_error_t *svn_swig_pl_make_callbacks(
     return SVN_NO_ERROR;
 }
 
+/* NOTE: calls back into Perl (by calling svn_swig_pl_callback_thunk) */
 svn_error_t *svn_swig_pl_thunk_gnome_keyring_unlock_prompt(char **keyring_password,
                                                            const char *keyring_name,
                                                            void *baton,
@@ -1243,6 +1260,7 @@ svn_error_t *svn_swig_pl_thunk_gnome_key
     return SVN_NO_ERROR;
 }
 
+/* NOTE: calls back into Perl (by calling svn_swig_pl_callback_thunk) */
 svn_error_t *svn_swig_pl_thunk_simple_prompt(svn_auth_cred_simple_t **cred,
                                              void *baton,
                                              const char *realm,
@@ -1264,6 +1282,7 @@ svn_error_t *svn_swig_pl_thunk_simple_pr
     return SVN_NO_ERROR;
 }
 
+/* NOTE: calls back into Perl (by calling svn_swig_pl_callback_thunk) */
 svn_error_t *svn_swig_pl_thunk_username_prompt(svn_auth_cred_username_t **cred,
                                                void *baton,
                                                const char *realm,
@@ -1284,6 +1303,7 @@ svn_error_t *svn_swig_pl_thunk_username_
     return SVN_NO_ERROR;
 }
 
+/* NOTE: calls back into Perl (by calling svn_swig_pl_callback_thunk) */
 svn_error_t *svn_swig_pl_thunk_ssl_server_trust_prompt(
                               svn_auth_cred_ssl_server_trust_t **cred,
                               void *baton,
@@ -1318,6 +1338,7 @@ svn_error_t *svn_swig_pl_thunk_ssl_serve
     return SVN_NO_ERROR;
 }
 
+/* NOTE: calls back into Perl (by calling svn_swig_pl_callback_thunk) */
 svn_error_t *svn_swig_pl_thunk_ssl_client_cert_prompt(
                 svn_auth_cred_ssl_client_cert_t **cred,
                 void *baton,
@@ -1339,6 +1360,7 @@ svn_error_t *svn_swig_pl_thunk_ssl_clien
     return SVN_NO_ERROR;
 }
 
+/* NOTE: calls back into Perl (by calling svn_swig_pl_callback_thunk) */
 svn_error_t *svn_swig_pl_thunk_ssl_client_cert_pw_prompt(
                                      svn_auth_cred_ssl_client_cert_pw_t **cred,
                                      void *baton,
@@ -1361,6 +1383,7 @@ svn_error_t *svn_swig_pl_thunk_ssl_clien
 }
 
 /* Thunked version of svn_wc_notify_func_t callback type */
+/* NOTE: calls back into Perl (by calling svn_swig_pl_callback_thunk) */
 void svn_swig_pl_notify_func(void * baton,
                              const char *path,
                              svn_wc_notify_action_t action,
@@ -1382,6 +1405,7 @@ void svn_swig_pl_notify_func(void * bato
 }
 
 /* Thunked version of svn_client_get_commit_log3_t callback type. */
+/* NOTE: calls back into Perl (by calling svn_swig_pl_callback_thunk) */
 svn_error_t *svn_swig_pl_get_commit_log_func(const char **log_msg,
                                              const char **tmp_file,
                                              const apr_array_header_t *
@@ -1444,6 +1468,7 @@ svn_error_t *svn_swig_pl_get_commit_log_
 }
 
 /* Thunked version of svn_client_info_t callback type. */
+/* NOTE: calls back into Perl (by calling svn_swig_pl_callback_thunk) */
 svn_error_t *svn_swig_pl_info_receiver(void *baton,
                                        const char *path,
                                        const svn_info_t *info,
@@ -1475,6 +1500,7 @@ svn_error_t *svn_swig_pl_info_receiver(v
 
 
 /* Thunked version of svn_wc_cancel_func_t callback type. */
+/* NOTE: calls back into Perl (by calling svn_swig_pl_callback_thunk) */
 svn_error_t *svn_swig_pl_cancel_func(void *cancel_baton) {
     SV *result;
     svn_error_t *ret_val;
@@ -1504,6 +1530,7 @@ svn_error_t *svn_swig_pl_cancel_func(voi
 }
 
 /* Thunked version of svn_wc_status_func_t callback type. */
+/* NOTE: calls back into Perl (by calling svn_swig_pl_callback_thunk) */
 void svn_swig_pl_status_func(void *baton,
                              const char *path,
                              svn_wc_status_t *status)
@@ -1520,6 +1547,7 @@ void svn_swig_pl_status_func(void *baton
 }
 
 /* Thunked version of svn_wc_status_func2_t callback type. */
+/* NOTE: calls back into Perl (by calling svn_swig_pl_callback_thunk) */
 void svn_swig_pl_status_func2(void *baton,
                               const char *path,
                               svn_wc_status2_t *status)
@@ -1536,6 +1564,7 @@ void svn_swig_pl_status_func2(void *bato
 }
 
 /* Thunked version of svn_wc_status_func3_t callback type. */
+/* NOTE: calls back into Perl (by calling svn_swig_pl_callback_thunk) */
 svn_error_t *svn_swig_pl_status_func3(void *baton,
                                       const char *path,
                                       svn_wc_status2_t *status,
@@ -1568,6 +1597,7 @@ svn_error_t *svn_swig_pl_status_func3(vo
 
 
 /* Thunked version of svn_client_blame_receiver_t callback type. */
+/* NOTE: calls back into Perl (by calling svn_swig_pl_callback_thunk) */
 svn_error_t *svn_swig_pl_blame_func(void *baton,
                                     apr_int64_t line_no,
                                     svn_revnum_t revision,
@@ -1596,6 +1626,7 @@ svn_error_t *svn_swig_pl_blame_func(void
 }
 
 /* Thunked config enumerator */
+/* NOTE: calls back into Perl (by calling svn_swig_pl_callback_thunk) */
 svn_boolean_t svn_swig_pl_thunk_config_enumerator(const char *name, const char *value, void *baton)
 {
     SV *result;
@@ -1639,6 +1670,7 @@ void svn_swig_pl_set_current_pool(apr_po
   set_current_pool_cb(pool);
 }
 
+/* NOTE: calls back into Perl (by calling svn_swig_pl_callback_thunk) */
 apr_pool_t *svn_swig_pl_make_pool(SV *obj)
 {
     apr_pool_t *pool;
@@ -1667,6 +1699,7 @@ typedef struct io_baton_t {
     IO *io;
 } io_baton_t;
 
+/* NOTE: calls back into Perl (by calling svn_swig_pl_callback_thunk) */
 static svn_error_t *io_handle_read(void *baton,
                                    char *buffer,
                                    apr_size_t *len)
@@ -1690,6 +1723,7 @@ static svn_error_t *io_handle_read(void
     return SVN_NO_ERROR;
 }
 
+/* NOTE: calls back into Perl (by calling svn_swig_pl_callback_thunk) */
 static svn_error_t *io_handle_write(void *baton,
                                     const char *data,
                                     apr_size_t *len)
@@ -1710,6 +1744,7 @@ static svn_error_t *io_handle_write(void
     return SVN_NO_ERROR;
 }
 
+/* NOTE: calls back into Perl (by calling svn_swig_pl_callback_thunk) */
 static svn_error_t *io_handle_close(void *baton)
 {
     io_baton_t *io = baton;
@@ -1733,6 +1768,7 @@ static apr_status_t io_handle_cleanup(vo
     return APR_SUCCESS;
 }
 
+/* NOTE: calls back into Perl (by calling svn_swig_pl_callback_thunk) */
 svn_error_t *svn_swig_pl_make_stream(svn_stream_t **stream, SV *obj)
 {
     IO *io;
@@ -1778,6 +1814,7 @@ svn_error_t *svn_swig_pl_make_stream(svn
     return SVN_NO_ERROR;
 }
 
+/* NOTE: calls back into Perl (by calling svn_swig_pl_callback_thunk) */
 svn_error_t *svn_swig_pl_ra_lock_callback(
                     void *baton,
                     const char *path,
@@ -1797,6 +1834,7 @@ svn_error_t *svn_swig_pl_ra_lock_callbac
   return SVN_NO_ERROR;
 }
 
+/* NOTE: calls back into Perl (by calling svn_swig_pl_callback_thunk) */
 SV *svn_swig_pl_from_stream(svn_stream_t *stream)
 {
     SV *ret;
@@ -1848,6 +1886,7 @@ void svn_swig_pl_hold_ref_in_pool(apr_po
     apr_pool_cleanup_register(pool, sv, cleanup_refcnt, apr_pool_cleanup_null);
 }
 
+/* NOTE: calls back into Perl (by calling svn_swig_pl_callback_thunk) */
 SV *svn_swig_pl_from_md5(unsigned char *digest)
 {
     SV *ret;

Modified: subversion/branches/move-tracking-2/subversion/bindings/swig/perl/libsvn_swig_perl/swigutil_pl.h
URL: http://svn.apache.org/viewvc/subversion/branches/move-tracking-2/subversion/bindings/swig/perl/libsvn_swig_perl/swigutil_pl.h?rev=1685233&r1=1685232&r2=1685233&view=diff
==============================================================================
--- subversion/branches/move-tracking-2/subversion/bindings/swig/perl/libsvn_swig_perl/swigutil_pl.h (original)
+++ subversion/branches/move-tracking-2/subversion/bindings/swig/perl/libsvn_swig_perl/swigutil_pl.h Sat Jun 13 10:21:18 2015
@@ -209,13 +209,6 @@ svn_error_t *svn_swig_pl_thunk_ssl_clien
    svn_boolean_t may_save,
    apr_pool_t *pool);
 
-/* thunked callback for svn_ra_get_wc_prop_func_t */
-svn_error_t *thunk_get_wc_prop(void *baton,
-                               const char *relpath,
-                               const char *name,
-                               const svn_string_t **value,
-                               apr_pool_t *pool);
-
 /* Thunked version of svn_wc_notify_func_t callback type */
 void svn_swig_pl_notify_func(void * baton,
                              const char *path,
@@ -278,11 +271,6 @@ void svn_swig_pl_make_editor(svn_delta_e
                              SV *perl_editor,
                              apr_pool_t *pool);
 
-void svn_swig_pl_wrap_window_handler(svn_txdelta_window_handler_t *handler,
-                                     void **h_baton,
-                                     SV *callback,
-                                     apr_pool_t *pool);
-
 /* svn_stream_t helpers */
 svn_error_t *svn_swig_pl_make_stream(svn_stream_t **stream, SV *obj);
 SV *svn_swig_pl_from_stream(svn_stream_t *stream);

Modified: subversion/branches/move-tracking-2/subversion/bindings/swig/python/libsvn_swig_py/swigutil_py.c
URL: http://svn.apache.org/viewvc/subversion/branches/move-tracking-2/subversion/bindings/swig/python/libsvn_swig_py/swigutil_py.c?rev=1685233&r1=1685232&r2=1685233&view=diff
==============================================================================
--- subversion/branches/move-tracking-2/subversion/bindings/swig/python/libsvn_swig_py/swigutil_py.c (original)
+++ subversion/branches/move-tracking-2/subversion/bindings/swig/python/libsvn_swig_py/swigutil_py.c Sat Jun 13 10:21:18 2015
@@ -1529,8 +1529,9 @@ finished:
 static svn_error_t *callback_bad_return_error(const char *message)
 {
   PyErr_SetString(PyExc_TypeError, message);
-  return svn_error_create(APR_EGENERAL, NULL,
-                          "Python callback returned an invalid object");
+  return svn_error_createf(APR_EGENERAL, NULL,
+                           "Python callback returned an invalid object: %s",
+                           message);
 }
 
 /* Return a generic error about not being able to map types. */

Modified: subversion/branches/move-tracking-2/subversion/bindings/swig/svn_client.i
URL: http://svn.apache.org/viewvc/subversion/branches/move-tracking-2/subversion/bindings/swig/svn_client.i?rev=1685233&r1=1685232&r2=1685233&view=diff
==============================================================================
--- subversion/branches/move-tracking-2/subversion/bindings/swig/svn_client.i (original)
+++ subversion/branches/move-tracking-2/subversion/bindings/swig/svn_client.i Sat Jun 13 10:21:18 2015
@@ -293,8 +293,9 @@ Callback: svn_client_diff_summarize_func
  */
 #ifdef SWIGPERL
 %typemap(in) apr_hash_t *config {
-  $1 = svn_swig_pl_objs_to_hash_by_name ($input, "svn_config_t *",
-                                         svn_swig_pl_make_pool ((SV *)NULL));
+  apr_pool_t *pool = svn_swig_pl_make_pool ((SV *)NULL);
+  SPAGAIN;
+  $1 = svn_swig_pl_objs_to_hash_by_name ($input, "svn_config_t *", pool);
 }
 
 %typemap(out) apr_hash_t *config {

Modified: subversion/branches/move-tracking-2/subversion/include/private/svn_subr_private.h
URL: http://svn.apache.org/viewvc/subversion/branches/move-tracking-2/subversion/include/private/svn_subr_private.h?rev=1685233&r1=1685232&r2=1685233&view=diff
==============================================================================
--- subversion/branches/move-tracking-2/subversion/include/private/svn_subr_private.h (original)
+++ subversion/branches/move-tracking-2/subversion/include/private/svn_subr_private.h Sat Jun 13 10:21:18 2015
@@ -537,20 +537,21 @@ svn__decode_uint(apr_uint64_t *val,
                  const unsigned char *p,
                  const unsigned char *end);
 
-/* Get the data from IN, compress it according to the specified
- * COMPRESSION_METHOD and write the result to OUT.
+/* Compress the data from DATA with length LEN, it according to the
+ * specified COMPRESSION_METHOD and write the result to OUT.
  * SVN__COMPRESSION_NONE is valid for COMPRESSION_METHOD.
  */
 svn_error_t *
-svn__compress(svn_stringbuf_t *in,
+svn__compress(const void *data, apr_size_t len,
               svn_stringbuf_t *out,
               int compression_method);
 
-/* Get the compressed data from IN, decompress it and write the result to
- * OUT.  Return an error if the decompressed size is larger than LIMIT.
+/* Decompress the compressed data from DATA with length LEN and write the
+ * result to OUT.  Return an error if the decompressed size is larger than
+ * LIMIT.
  */
 svn_error_t *
-svn__decompress(svn_stringbuf_t *in,
+svn__decompress(const void *data, apr_size_t len,
                 svn_stringbuf_t *out,
                 apr_size_t limit);
 

Modified: subversion/branches/move-tracking-2/subversion/include/svn_client.h
URL: http://svn.apache.org/viewvc/subversion/branches/move-tracking-2/subversion/include/svn_client.h?rev=1685233&r1=1685232&r2=1685233&view=diff
==============================================================================
--- subversion/branches/move-tracking-2/subversion/include/svn_client.h (original)
+++ subversion/branches/move-tracking-2/subversion/include/svn_client.h Sat Jun 13 10:21:18 2015
@@ -4362,14 +4362,57 @@ svn_client_revert(const apr_array_header
  */
 
 /**
+ * Return the absolute path to the conflicted working copy node described
+ * by @a conflict.
+ *
+ * @since New in 1.10. 
+ */
+const char *
+svn_client_conflict_get_local_abspath(
+  const svn_wc_conflict_description2_t *conflict);
+
+/**
+ * Return the operation during which the conflict described by @a
+ * conflict was recorded.
+ *
+ * @since New in 1.10. 
+ */
+svn_wc_operation_t
+svn_client_conflict_get_operation(
+  const svn_wc_conflict_description2_t *conflict);
+
+/**
+ * Return the action an update, switch, or merge operation attempted to
+ * perform on the working copy node described by @a conflict.
+ * 
+ * @since New in 1.10. 
+ */
+svn_wc_conflict_action_t
+svn_client_conflict_get_incoming_change(
+  const svn_wc_conflict_description2_t *conflict);
+
+/**
+ * Return the reason why the attempted action performed by an update, switch,
+ * or merge operation conflicted with the state of the node in the working copy.
+ *
+ * During update and switch operations this local change is part of uncommitted
+ * modifications in the working copy. During merge operations it may
+ * additionally be part of the history of the merge target branch, anywhere
+ * between the common ancestor revision and the working copy revision.
+ * 
+ * @since New in 1.10. 
+ */
+svn_wc_conflict_reason_t
+svn_client_conflict_get_local_change(
+  const svn_wc_conflict_description2_t *conflict);
+
+/**
  * Accessor functions for svn_wc_conflict_description2_t. This is a temporary
  * API for eventually replacing svn_wc_conflict_description2_t with an opaque
  * type and providing improved APIs for conflict resolution.
  * 
  * @since New in 1.10. 
  */
-#define svn_client_conflict_get_local_abspath(conflict) \
-  ((conflict)->local_abspath)
 
 #define svn_client_conflict_get_node_kind(conflict) \
   ((conflict)->node_kind)
@@ -4386,12 +4429,6 @@ svn_client_revert(const apr_array_header
 #define svn_client_conflict_get_mime_type(conflict) \
   ((conflict)->mime_type)
 
-#define svn_client_conflict_get_action(conflict) \
-  ((conflict)->action)
-
-#define svn_client_conflict_get_reason(conflict) \
-  ((conflict)->reason)
-
 #define svn_client_conflict_get_base_abspath(conflict) \
   ((conflict)->base_abspath)
 
@@ -4404,9 +4441,6 @@ svn_client_revert(const apr_array_header
 #define svn_client_conflict_get_merged_file(conflict) \
   ((conflict)->merged_file)
 
-#define svn_client_conflict_get_operation(conflict) \
-  ((conflict)->operation)
-
 #define svn_client_conflict_get_src_left_version(conflict) \
   ((conflict)->src_left_version)
 

Modified: subversion/branches/move-tracking-2/subversion/include/svn_config.h
URL: http://svn.apache.org/viewvc/subversion/branches/move-tracking-2/subversion/include/svn_config.h?rev=1685233&r1=1685232&r2=1685233&view=diff
==============================================================================
--- subversion/branches/move-tracking-2/subversion/include/svn_config.h (original)
+++ subversion/branches/move-tracking-2/subversion/include/svn_config.h Sat Jun 13 10:21:18 2015
@@ -63,6 +63,12 @@ typedef struct svn_config_t svn_config_t
  * @{
  */
 
+/* If you add a new SVN_CONFIG_* category/section/option macro to this group,
+ * you have to re-run gen-make.py manually.
+ *
+ * ### This should be fixed in the build system; see issue #4581.
+ */
+
  /* This list of #defines is intentionally presented as a nested list
     that matches the in-config hierarchy.  */
 

Modified: subversion/branches/move-tracking-2/subversion/include/svn_error_codes.h
URL: http://svn.apache.org/viewvc/subversion/branches/move-tracking-2/subversion/include/svn_error_codes.h?rev=1685233&r1=1685232&r2=1685233&view=diff
==============================================================================
--- subversion/branches/move-tracking-2/subversion/include/svn_error_codes.h (original)
+++ subversion/branches/move-tracking-2/subversion/include/svn_error_codes.h Sat Jun 13 10:21:18 2015
@@ -923,9 +923,9 @@ SVN_ERROR_START
              "Repository upgrade is not supported")
 
   /** @since New in 1.9. */
-  SVN_ERRDEF(SVN_ERR_REPOS_CORRUPTED,
+  SVN_ERRDEF(SVN_ERR_REPOS_VERIFY_FAILED,
              SVN_ERR_REPOS_CATEGORY_START + 11,
-             "Repository is corrupt")
+             "Repository verification failed")
 
   /* generic RA errors */
 

Modified: subversion/branches/move-tracking-2/subversion/include/svn_ra.h
URL: http://svn.apache.org/viewvc/subversion/branches/move-tracking-2/subversion/include/svn_ra.h?rev=1685233&r1=1685232&r2=1685233&view=diff
==============================================================================
--- subversion/branches/move-tracking-2/subversion/include/svn_ra.h (original)
+++ subversion/branches/move-tracking-2/subversion/include/svn_ra.h Sat Jun 13 10:21:18 2015
@@ -1967,7 +1967,7 @@ svn_ra_get_locks(svn_ra_session_t *sessi
 
 /**
  * Replay the changes from a range of revisions between @a start_revision
- * and @a end_revision.
+ * and @a end_revision (inclusive).
  *
  * When receiving information for one revision, a callback @a revstart_func is
  * called; this callback will provide an editor and baton through which the

Modified: subversion/branches/move-tracking-2/subversion/libsvn_client/resolved.c
URL: http://svn.apache.org/viewvc/subversion/branches/move-tracking-2/subversion/libsvn_client/resolved.c?rev=1685233&r1=1685232&r2=1685233&view=diff
==============================================================================
--- subversion/branches/move-tracking-2/subversion/libsvn_client/resolved.c (original)
+++ subversion/branches/move-tracking-2/subversion/libsvn_client/resolved.c Sat Jun 13 10:21:18 2015
@@ -144,3 +144,34 @@ svn_client_resolve(const char *path,
 
   return svn_error_trace(err);
 }
+
+
+/*** Dealing with conflicts. ***/
+
+const char *
+svn_client_conflict_get_local_abspath(
+  const svn_wc_conflict_description2_t *conflict)
+{
+  return conflict->local_abspath;
+}
+
+svn_wc_operation_t
+svn_client_conflict_get_operation(
+  const svn_wc_conflict_description2_t *conflict)
+{
+  return conflict->operation;
+}
+
+svn_wc_conflict_action_t
+svn_client_conflict_get_incoming_change(
+  const svn_wc_conflict_description2_t *conflict)
+{
+  return conflict->action;
+}
+
+svn_wc_conflict_reason_t
+svn_client_conflict_get_local_change(
+  const svn_wc_conflict_description2_t *conflict)
+{
+  return conflict->reason;
+}

Modified: subversion/branches/move-tracking-2/subversion/libsvn_delta/svndiff.c
URL: http://svn.apache.org/viewvc/subversion/branches/move-tracking-2/subversion/libsvn_delta/svndiff.c?rev=1685233&r1=1685232&r2=1685233&view=diff
==============================================================================
--- subversion/branches/move-tracking-2/subversion/libsvn_delta/svndiff.c (original)
+++ subversion/branches/move-tracking-2/subversion/libsvn_delta/svndiff.c Sat Jun 13 10:21:18 2015
@@ -36,6 +36,20 @@
 #include "private/svn_string_private.h"
 #include "private/svn_dep_compat.h"
 
+static const char SVNDIFF_V0[] = { 'S', 'V', 'N', 0 };
+static const char SVNDIFF_V1[] = { 'S', 'V', 'N', 1 };
+
+#define SVNDIFF_HEADER_SIZE (sizeof(SVNDIFF_V0))
+
+static const char *
+get_svndiff_header(int version)
+{
+  if (version == 1)
+    return SVNDIFF_V1;
+  else
+    return SVNDIFF_V0;
+}
+
 /* ----- Text delta to svndiff ----- */
 
 /* We make one of these and get it passed back to us in calls to the
@@ -72,7 +86,7 @@ static svn_error_t *
 send_simple_insertion_window(svn_txdelta_window_t *window,
                              struct encoder_baton *eb)
 {
-  unsigned char headers[4 + 5 * SVN__MAX_ENCODED_UINT_LEN
+  unsigned char headers[SVNDIFF_HEADER_SIZE + 5 * SVN__MAX_ENCODED_UINT_LEN
                           + MAX_INSTRUCTION_LEN];
   unsigned char ibuf[MAX_INSTRUCTION_LEN];
   unsigned char *header_current;
@@ -89,11 +103,8 @@ send_simple_insertion_window(svn_txdelta
   if (!eb->header_done)
     {
       eb->header_done = TRUE;
-      headers[0] = 'S';
-      headers[1] = 'V';
-      headers[2] = 'N';
-      headers[3] = (unsigned char)eb->version;
-      header_current = headers + 4;
+      memcpy(headers, get_svndiff_header(eb->version), SVNDIFF_HEADER_SIZE);
+      header_current = headers + SVNDIFF_HEADER_SIZE;
     }
   else
     {
@@ -155,10 +166,9 @@ window_handler(svn_txdelta_window_t *win
   /* Make sure we write the header.  */
   if (!eb->header_done)
     {
-      char svnver[4] = {'S','V','N','\0'};
-      len = 4;
-      svnver[3] = (char)eb->version;
-      SVN_ERR(svn_stream_write(eb->output, svnver, &len));
+      len = SVNDIFF_HEADER_SIZE;
+      SVN_ERR(svn_stream_write(eb->output, get_svndiff_header(eb->version),
+                               &len));
       eb->header_done = TRUE;
     }
 
@@ -215,19 +225,17 @@ window_handler(svn_txdelta_window_t *win
   append_encoded_int(header, window->tview_len);
   if (eb->version == 1)
     {
-      SVN_ERR(svn__compress(instructions, i1, eb->compression_level));
+      SVN_ERR(svn__compress(instructions->data, instructions->len,
+                            i1, eb->compression_level));
       instructions = i1;
     }
   append_encoded_int(header, instructions->len);
   if (eb->version == 1)
     {
       svn_stringbuf_t *compressed = svn_stringbuf_create_empty(pool);
-      svn_stringbuf_t *original = svn_stringbuf_create_empty(pool);
-      original->data = (char *)window->new_data->data; /* won't be modified */
-      original->len = window->new_data->len;
-      original->blocksize = window->new_data->len + 1;
 
-      SVN_ERR(svn__compress(original, compressed, eb->compression_level));
+      SVN_ERR(svn__compress(window->new_data->data, window->new_data->len,
+                            compressed, eb->compression_level));
       newdata = svn_stringbuf__morph_into_string(compressed);
     }
   else
@@ -334,6 +342,17 @@ struct decode_baton
 
   /* svndiff version in use by delta.  */
   unsigned char version;
+
+  /* Length of parsed delta window header. 0 if window is not parsed yet. */
+  apr_size_t window_header_len;
+
+  /* Five integer fields of parsed delta window header. Valid only if
+     WINDOW_HEADER_LEN > 0 */
+  svn_filesize_t  sview_offset;
+  apr_size_t sview_len;
+  apr_size_t tview_len;
+  apr_size_t inslen;
+  apr_size_t newlen;
 };
 
 
@@ -483,21 +502,6 @@ count_and_verify_instructions(int *ninst
   return SVN_NO_ERROR;
 }
 
-static svn_error_t *
-zlib_decode(const unsigned char *in, apr_size_t inLen, svn_stringbuf_t *out,
-            apr_size_t limit)
-{
-  /* construct a fake string buffer as parameter to svn__decompress.
-     This is fine as that function never writes to it. */
-  svn_stringbuf_t compressed;
-  compressed.pool = NULL;
-  compressed.data = (char *)in;
-  compressed.len = inLen;
-  compressed.blocksize = inLen + 1;
-
-  return svn__decompress(&compressed, out, limit);
-}
-
 /* Given the five integer fields of a window header and a pointer to
    the remainder of the window contents, fill in a delta window
    structure *WINDOW.  New allocations will be performed in POOL;
@@ -513,7 +517,7 @@ decode_window(svn_txdelta_window_t *wind
   int ninst;
   apr_size_t npos;
   svn_txdelta_op_t *ops, *op;
-  svn_string_t *new_data = apr_palloc(pool, sizeof(*new_data));
+  svn_string_t *new_data;
 
   window->sview_offset = sview_offset;
   window->sview_len = sview_len;
@@ -526,28 +530,22 @@ decode_window(svn_txdelta_window_t *wind
       svn_stringbuf_t *instout = svn_stringbuf_create_empty(pool);
       svn_stringbuf_t *ndout = svn_stringbuf_create_empty(pool);
 
-      SVN_ERR(zlib_decode(insend, newlen, ndout,
-                          SVN_DELTA_WINDOW_SIZE));
-      SVN_ERR(zlib_decode(data, insend - data, instout,
-                          MAX_INSTRUCTION_SECTION_LEN));
+      SVN_ERR(svn__decompress(insend, newlen, ndout,
+                              SVN_DELTA_WINDOW_SIZE));
+      SVN_ERR(svn__decompress(data, insend - data, instout,
+                              MAX_INSTRUCTION_SECTION_LEN));
 
       newlen = ndout->len;
       data = (unsigned char *)instout->data;
       insend = (unsigned char *)instout->data + instout->len;
 
-      new_data->data = (const char *) ndout->data;
-      new_data->len = newlen;
+      new_data = svn_stringbuf__morph_into_string(ndout);
     }
   else
     {
       /* Copy the data because an svn_string_t must have the invariant
          data[len]=='\0'. */
-      char *buf = apr_palloc(pool, newlen + 1);
-
-      memcpy(buf, insend, newlen);
-      buf[newlen] = '\0';
-      new_data->data = buf;
-      new_data->len = newlen;
+      new_data = svn_string_ncreate((const char*)insend, newlen, pool);
     }
 
   /* Count the instructions and make sure they are all valid.  */
@@ -578,10 +576,6 @@ decode_window(svn_txdelta_window_t *wind
   return SVN_NO_ERROR;
 }
 
-static const char SVNDIFF_V0[] = { 'S', 'V', 'N', 0 };
-static const char SVNDIFF_V1[] = { 'S', 'V', 'N', 1 };
-#define SVNDIFF_HEADER_SIZE (sizeof(SVNDIFF_V0))
-
 static svn_error_t *
 write_handler(void *baton,
               const char *buffer,
@@ -589,8 +583,6 @@ write_handler(void *baton,
 {
   struct decode_baton *db = (struct decode_baton *) baton;
   const unsigned char *p, *end;
-  svn_filesize_t sview_offset;
-  apr_size_t sview_len, tview_len, inslen, newlen, remaining;
   apr_size_t buflen = *len;
 
   /* Chew up four bytes at the beginning for the header.  */
@@ -628,90 +620,114 @@ write_handler(void *baton,
 
   while (1)
     {
-      apr_pool_t *newpool;
       svn_txdelta_window_t window;
 
       /* Read the header, if we have enough bytes for that.  */
       p = (const unsigned char *) db->buffer->data;
       end = (const unsigned char *) db->buffer->data + db->buffer->len;
 
-      p = decode_file_offset(&sview_offset, p, end);
-      if (p == NULL)
-        return SVN_NO_ERROR;
-
-      p = decode_size(&sview_len, p, end);
-      if (p == NULL)
-        return SVN_NO_ERROR;
-
-      p = decode_size(&tview_len, p, end);
-      if (p == NULL)
-        return SVN_NO_ERROR;
-
-      p = decode_size(&inslen, p, end);
-      if (p == NULL)
-        return SVN_NO_ERROR;
-
-      p = decode_size(&newlen, p, end);
-      if (p == NULL)
-        return SVN_NO_ERROR;
-
-      if (tview_len > SVN_DELTA_WINDOW_SIZE ||
-          sview_len > SVN_DELTA_WINDOW_SIZE ||
-          /* for svndiff1, newlen includes the original length */
-          newlen > SVN_DELTA_WINDOW_SIZE + SVN__MAX_ENCODED_UINT_LEN ||
-          inslen > MAX_INSTRUCTION_SECTION_LEN)
-        return svn_error_create(SVN_ERR_SVNDIFF_CORRUPT_WINDOW, NULL,
-                                _("Svndiff contains a too-large window"));
-
-      /* Check for integer overflow.  */
-      if (sview_offset < 0 || inslen + newlen < inslen
-          || sview_len + tview_len < sview_len
-          || (apr_size_t)sview_offset + sview_len < (apr_size_t)sview_offset)
-        return svn_error_create(SVN_ERR_SVNDIFF_CORRUPT_WINDOW, NULL,
-                                _("Svndiff contains corrupt window header"));
-
-      /* Check for source windows which slide backwards.  */
-      if (sview_len > 0
-          && (sview_offset < db->last_sview_offset
+      if (db->window_header_len == 0)
+        {
+          svn_filesize_t sview_offset;
+          apr_size_t sview_len, tview_len, inslen, newlen;
+          const unsigned char *hdr_start = p;
+
+          p = decode_file_offset(&sview_offset, p, end);
+          if (p == NULL)
+              break;
+
+          p = decode_size(&sview_len, p, end);
+          if (p == NULL)
+              break;
+
+          p = decode_size(&tview_len, p, end);
+          if (p == NULL)
+              break;
+
+          p = decode_size(&inslen, p, end);
+          if (p == NULL)
+              break;
+
+          p = decode_size(&newlen, p, end);
+          if (p == NULL)
+              break;
+
+          if (tview_len > SVN_DELTA_WINDOW_SIZE ||
+              sview_len > SVN_DELTA_WINDOW_SIZE ||
+              /* for svndiff1, newlen includes the original length */
+              newlen > SVN_DELTA_WINDOW_SIZE + SVN__MAX_ENCODED_UINT_LEN ||
+              inslen > MAX_INSTRUCTION_SECTION_LEN)
+            return svn_error_create(
+                     SVN_ERR_SVNDIFF_CORRUPT_WINDOW, NULL,
+                     _("Svndiff contains a too-large window"));
+
+          /* Check for integer overflow.  */
+          if (sview_offset < 0 || inslen + newlen < inslen
+              || sview_len + tview_len < sview_len
+              || (apr_size_t)sview_offset + sview_len < (apr_size_t)sview_offset)
+            return svn_error_create(
+                      SVN_ERR_SVNDIFF_CORRUPT_WINDOW, NULL,
+                      _("Svndiff contains corrupt window header"));
+
+          /* Check for source windows which slide backwards.  */
+          if (sview_len > 0
+              && (sview_offset < db->last_sview_offset
               || (sview_offset + sview_len
                   < db->last_sview_offset + db->last_sview_len)))
-        return svn_error_create
-          (SVN_ERR_SVNDIFF_BACKWARD_VIEW, NULL,
-           _("Svndiff has backwards-sliding source views"));
+            return svn_error_create(
+                     SVN_ERR_SVNDIFF_BACKWARD_VIEW, NULL,
+                     _("Svndiff has backwards-sliding source views"));
+
+          /* Remember parsed window header. */
+          db->window_header_len = p - hdr_start;
+          db->sview_offset = sview_offset;
+          db->sview_len = sview_len;
+          db->tview_len = tview_len;
+          db->inslen = inslen;
+          db->newlen = newlen;
+        }
+      else
+        {
+          /* Skip already parsed window header. */
+          p += db->window_header_len;
+        }
 
       /* Wait for more data if we don't have enough bytes for the
          whole window.  */
-      if ((apr_size_t) (end - p) < inslen + newlen)
+      if ((apr_size_t) (end - p) < db->inslen + db->newlen)
         return SVN_NO_ERROR;
 
       /* Decode the window and send it off. */
-      SVN_ERR(decode_window(&window, sview_offset, sview_len, tview_len,
-                            inslen, newlen, p, db->subpool,
-                            db->version));
+      SVN_ERR(decode_window(&window, db->sview_offset, db->sview_len,
+                            db->tview_len, db->inslen, db->newlen, p,
+                            db->subpool, db->version));
       SVN_ERR(db->consumer_func(&window, db->consumer_baton));
 
-      /* Make a new subpool and buffer, saving aside the remaining
-         data in the old buffer.  */
-      newpool = svn_pool_create(db->pool);
-      p += inslen + newlen;
-      remaining = db->buffer->data + db->buffer->len - (const char *) p;
-      db->buffer =
-        svn_stringbuf_ncreate((const char *) p, remaining, newpool);
+      p += db->inslen + db->newlen;
+
+      /* Remove processed data from the buffer.  */
+      svn_stringbuf_remove(db->buffer, 0, db->buffer->len - (end - p));
+
+      /* Reset window header length. */
+      db->window_header_len = 0;
 
       /* Remember the offset and length of the source view for next time.  */
-      db->last_sview_offset = sview_offset;
-      db->last_sview_len = sview_len;
+      db->last_sview_offset = db->sview_offset;
+      db->last_sview_len = db->sview_len;
 
-      /* We've copied stuff out of the old pool. Toss that pool and use
-         our new pool.
-         ### might be nice to avoid the copy and just use svn_pool_clear
-         ### to get rid of whatever the "other stuff" is. future project...
-      */
-      svn_pool_destroy(db->subpool);
-      db->subpool = newpool;
+      /* Clear subpool. */
+      svn_pool_clear(db->subpool);
     }
 
-  /* NOTREACHED */
+  /* At this point we processed all integral windows and DB->BUFFER is empty
+     or contains partially read window header.
+     Check that unprocessed data is not larger than theoretical maximum
+     window header size. */
+  if (db->buffer->len > 5 * SVN__MAX_ENCODED_UINT_LEN)
+    return svn_error_create(SVN_ERR_SVNDIFF_CORRUPT_WINDOW, NULL,
+                            _("Svndiff contains a too-large window header"));
+
+  return SVN_NO_ERROR;
 }
 
 /* Minimal svn_stream_t write handler, doing nothing */
@@ -749,23 +765,25 @@ svn_txdelta_parse_svndiff(svn_txdelta_wi
                           svn_boolean_t error_on_early_close,
                           apr_pool_t *pool)
 {
-  apr_pool_t *subpool = svn_pool_create(pool);
-  struct decode_baton *db = apr_palloc(pool, sizeof(*db));
   svn_stream_t *stream;
 
-  db->consumer_func = handler;
-  db->consumer_baton = handler_baton;
-  db->pool = subpool;
-  db->subpool = svn_pool_create(subpool);
-  db->buffer = svn_stringbuf_create_empty(db->subpool);
-  db->last_sview_offset = 0;
-  db->last_sview_len = 0;
-  db->header_bytes = 0;
-  db->error_on_early_close = error_on_early_close;
-  stream = svn_stream_create(db, pool);
-
   if (handler != svn_delta_noop_window_handler)
     {
+      apr_pool_t *subpool = svn_pool_create(pool);
+      struct decode_baton *db = apr_palloc(pool, sizeof(*db));
+
+      db->consumer_func = handler;
+      db->consumer_baton = handler_baton;
+      db->pool = subpool;
+      db->subpool = svn_pool_create(subpool);
+      db->buffer = svn_stringbuf_create_empty(db->pool);
+      db->last_sview_offset = 0;
+      db->last_sview_len = 0;
+      db->header_bytes = 0;
+      db->error_on_early_close = error_on_early_close;
+      db->window_header_len = 0;
+      stream = svn_stream_create(db, pool);
+
       svn_stream_set_write(stream, write_handler);
       svn_stream_set_close(stream, close_handler);
     }
@@ -773,6 +791,7 @@ svn_txdelta_parse_svndiff(svn_txdelta_wi
     {
       /* And else we just ignore everything as efficiently as we can.
          by only hooking a no-op handler */
+      stream = svn_stream_create(NULL, pool);
       svn_stream_set_write(stream, noop_write_handler);
     }
   return stream;

Modified: subversion/branches/move-tracking-2/subversion/libsvn_delta/text_delta.c
URL: http://svn.apache.org/viewvc/subversion/branches/move-tracking-2/subversion/libsvn_delta/text_delta.c?rev=1685233&r1=1685232&r2=1685233&view=diff
==============================================================================
--- subversion/branches/move-tracking-2/subversion/libsvn_delta/text_delta.c (original)
+++ subversion/branches/move-tracking-2/subversion/libsvn_delta/text_delta.c Sat Jun 13 10:21:18 2015
@@ -180,8 +180,7 @@ svn_txdelta_window_dup(const svn_txdelta
   build_baton.num_ops = window->num_ops;
   build_baton.src_ops = window->src_ops;
   build_baton.ops_size = window->num_ops;
-  build_baton.ops = apr_palloc(pool, ops_size);
-  memcpy(build_baton.ops, window->ops, ops_size);
+  build_baton.ops = apr_pmemdup(pool, window->ops, ops_size);
   build_baton.new_data =
     svn_stringbuf_create_from_string(window->new_data, pool);
 

Modified: subversion/branches/move-tracking-2/subversion/libsvn_fs_fs/cached_data.c
URL: http://svn.apache.org/viewvc/subversion/branches/move-tracking-2/subversion/libsvn_fs_fs/cached_data.c?rev=1685233&r1=1685232&r2=1685233&view=diff
==============================================================================
--- subversion/branches/move-tracking-2/subversion/libsvn_fs_fs/cached_data.c (original)
+++ subversion/branches/move-tracking-2/subversion/libsvn_fs_fs/cached_data.c Sat Jun 13 10:21:18 2015
@@ -1056,7 +1056,7 @@ svn_fs_fs__check_rep(representation_t *r
       if (   entry == NULL
           || entry->type < SVN_FS_FS__ITEM_TYPE_FILE_REP
           || entry->type > SVN_FS_FS__ITEM_TYPE_DIR_PROPS)
-        return svn_error_createf(SVN_ERR_REPOS_CORRUPTED, NULL,
+        return svn_error_createf(SVN_ERR_FS_CORRUPT, NULL,
                                  _("No representation found at offset %s "
                                    "for item %s in revision %ld"),
                                  apr_off_t_toa(scratch_pool, offset),

Modified: subversion/branches/move-tracking-2/subversion/libsvn_fs_fs/fs_fs.c
URL: http://svn.apache.org/viewvc/subversion/branches/move-tracking-2/subversion/libsvn_fs_fs/fs_fs.c?rev=1685233&r1=1685232&r2=1685233&view=diff
==============================================================================
--- subversion/branches/move-tracking-2/subversion/libsvn_fs_fs/fs_fs.c (original)
+++ subversion/branches/move-tracking-2/subversion/libsvn_fs_fs/fs_fs.c Sat Jun 13 10:21:18 2015
@@ -1126,7 +1126,9 @@ svn_fs_fs__open(svn_fs_t *fs, const char
   /* Global configuration options. */
   SVN_ERR(read_global_config(fs));
 
-  return get_youngest(&(ffd->youngest_rev_cache), fs, pool);
+  ffd->youngest_rev_cache = 0;
+
+  return SVN_NO_ERROR;
 }
 
 /* Wrapper around svn_io_file_create which ignores EEXIST. */

Modified: subversion/branches/move-tracking-2/subversion/libsvn_fs_fs/pack.c
URL: http://svn.apache.org/viewvc/subversion/branches/move-tracking-2/subversion/libsvn_fs_fs/pack.c?rev=1685233&r1=1685232&r2=1685233&view=diff
==============================================================================
--- subversion/branches/move-tracking-2/subversion/libsvn_fs_fs/pack.c (original)
+++ subversion/branches/move-tracking-2/subversion/libsvn_fs_fs/pack.c Sat Jun 13 10:21:18 2015
@@ -384,6 +384,8 @@ close_pack_context(pack_context_t *conte
   SVN_ERR(svn_io_remove_file2(proto_l2p_index_path, FALSE, pool));
   SVN_ERR(svn_io_remove_file2(proto_p2l_index_path, FALSE, pool));
 
+  /* Ensure that packed file is written to disk.*/
+  SVN_ERR(svn_io_file_flush_to_disk(context->pack_file, pool));
   SVN_ERR(svn_io_file_close(context->pack_file, pool));
 
   return SVN_NO_ERROR;
@@ -1654,7 +1656,9 @@ pack_phys_addressed(const char *pack_fil
                     apr_pool_t *pool)
 {
   const char *pack_file_path, *manifest_file_path;
-  svn_stream_t *pack_stream, *manifest_stream;
+  apr_file_t *pack_file;
+  apr_file_t *manifest_file;
+  svn_stream_t *manifest_stream;
   svn_revnum_t end_rev, rev;
   apr_off_t next_offset;
   apr_pool_t *iterpool;
@@ -1663,13 +1667,18 @@ pack_phys_addressed(const char *pack_fil
   pack_file_path = svn_dirent_join(pack_file_dir, PATH_PACKED, pool);
   manifest_file_path = svn_dirent_join(pack_file_dir, PATH_MANIFEST, pool);
 
-  /* Create the new directory and pack file. */
-  SVN_ERR(svn_stream_open_writable(&pack_stream, pack_file_path, pool,
-                                    pool));
+  /* Create the new directory and pack file.
+   * Use unbuffered apr_file_t since we're going to write using 16kb
+   * chunks. */
+  SVN_ERR(svn_io_file_open(&pack_file, pack_file_path,
+                           APR_WRITE | APR_CREATE | APR_EXCL,
+                           APR_OS_DEFAULT, pool));
 
   /* Create the manifest file. */
-  SVN_ERR(svn_stream_open_writable(&manifest_stream, manifest_file_path,
-                                   pool, pool));
+  SVN_ERR(svn_io_file_open(&manifest_file, manifest_file_path,
+                           APR_WRITE | APR_BUFFERED | APR_CREATE | APR_EXCL,
+                           APR_OS_DEFAULT, pool));
+  manifest_stream = svn_stream_from_aprfile2(manifest_file, TRUE, pool);
 
   end_rev = start_rev + max_files_per_dir - 1;
   next_offset = 0;
@@ -1696,16 +1705,24 @@ pack_phys_addressed(const char *pack_fil
 
       /* Copy all the bits from the rev file to the end of the pack file. */
       SVN_ERR(svn_stream_open_readonly(&rev_stream, path, iterpool, iterpool));
-      SVN_ERR(svn_stream_copy3(rev_stream, svn_stream_disown(pack_stream,
-                                                             iterpool),
+      SVN_ERR(svn_stream_copy3(rev_stream,
+                               svn_stream_from_aprfile2(pack_file, TRUE, pool),
                                cancel_func, cancel_baton, iterpool));
     }
 
-  /* disallow write access to the manifest file */
+  /* Close stream over APR file. */
   SVN_ERR(svn_stream_close(manifest_stream));
+
+  /* Ensure that pack file is written to disk. */
+  SVN_ERR(svn_io_file_flush_to_disk(manifest_file, pool));
+  SVN_ERR(svn_io_file_close(manifest_file, pool));
+
+  /* disallow write access to the manifest file */
   SVN_ERR(svn_io_set_file_read_only(manifest_file_path, FALSE, iterpool));
 
-  SVN_ERR(svn_stream_close(pack_stream));
+  /* Ensure that pack file is written to disk. */
+  SVN_ERR(svn_io_file_flush_to_disk(pack_file, pool));
+  SVN_ERR(svn_io_file_close(pack_file, pool));
 
   svn_pool_destroy(iterpool);
 

Modified: subversion/branches/move-tracking-2/subversion/libsvn_fs_fs/revprops.c
URL: http://svn.apache.org/viewvc/subversion/branches/move-tracking-2/subversion/libsvn_fs_fs/revprops.c?rev=1685233&r1=1685232&r2=1685233&view=diff
==============================================================================
--- subversion/branches/move-tracking-2/subversion/libsvn_fs_fs/revprops.c (original)
+++ subversion/branches/move-tracking-2/subversion/libsvn_fs_fs/revprops.c Sat Jun 13 10:21:18 2015
@@ -410,7 +410,8 @@ parse_packed_revprops(svn_fs_t *fs,
    * length header to remove) */
   svn_stringbuf_t *compressed = revprops->packed_revprops;
   svn_stringbuf_t *uncompressed = svn_stringbuf_create_empty(pool);
-  SVN_ERR(svn__decompress(compressed, uncompressed, APR_SIZE_MAX));
+  SVN_ERR(svn__decompress(compressed->data, compressed->len,
+                          uncompressed, APR_SIZE_MAX));
 
   /* read first revision number and number of revisions in the pack */
   stream = svn_stream_from_stringbuf(uncompressed, scratch_pool);
@@ -811,7 +812,7 @@ repack_revprops(svn_fs_t *fs,
   SVN_ERR(svn_stream_close(stream));
 
   /* compress / store the data */
-  SVN_ERR(svn__compress(uncompressed,
+  SVN_ERR(svn__compress(uncompressed->data, uncompressed->len,
                         compressed,
                         ffd->compress_packed_revprops
                           ? SVN_DELTA_COMPRESSION_LEVEL_DEFAULT
@@ -1020,16 +1021,14 @@ write_packed_revprop(const char **final_
       *final_path = svn_dirent_join(revprops->folder, PATH_MANIFEST, pool);
       SVN_ERR(svn_io_open_unique_file3(&file, tmp_path, revprops->folder,
                                        svn_io_file_del_none, pool, pool));
-
+      stream = svn_stream_from_aprfile2(file, TRUE, pool);
       for (i = 0; i < revprops->manifest->nelts; ++i)
         {
           const char *filename = APR_ARRAY_IDX(revprops->manifest, i,
                                                const char*);
-          SVN_ERR(svn_io_file_write_full(file, filename, strlen(filename),
-                                         NULL, pool));
-          SVN_ERR(svn_io_file_putc('\n', file, pool));
+          SVN_ERR(svn_stream_printf(stream, pool, "%s\n", filename));
         }
-
+      SVN_ERR(svn_stream_close(stream));
       SVN_ERR(svn_io_file_flush_to_disk(file, pool));
       SVN_ERR(svn_io_file_close(file, pool));
     }
@@ -1170,7 +1169,6 @@ svn_fs_fs__copy_revprops(const char *pac
   apr_file_t *pack_file;
   svn_revnum_t rev;
   apr_pool_t *iterpool = svn_pool_create(scratch_pool);
-  svn_stream_t *stream;
 
   /* create empty data buffer and a write stream on top of it */
   svn_stringbuf_t *uncompressed
@@ -1194,6 +1192,7 @@ svn_fs_fs__copy_revprops(const char *pac
   for (rev = start_rev; rev <= end_rev; rev++)
     {
       const char *path;
+      svn_stream_t *stream;
 
       svn_pool_clear(iterpool);
 
@@ -1212,12 +1211,14 @@ svn_fs_fs__copy_revprops(const char *pac
   SVN_ERR(svn_stream_close(pack_stream));
 
   /* compress the content (or just store it for COMPRESSION_LEVEL 0) */
-  SVN_ERR(svn__compress(uncompressed, compressed, compression_level));
+  SVN_ERR(svn__compress(uncompressed->data, uncompressed->len,
+                        compressed, compression_level));
 
   /* write the pack file content to disk */
-  stream = svn_stream_from_aprfile2(pack_file, FALSE, scratch_pool);
-  SVN_ERR(svn_stream_write(stream, compressed->data, &compressed->len));
-  SVN_ERR(svn_stream_close(stream));
+  SVN_ERR(svn_io_file_write_full(pack_file, compressed->data, compressed->len,
+                                 NULL, scratch_pool));
+  SVN_ERR(svn_io_file_flush_to_disk(pack_file, scratch_pool));
+  SVN_ERR(svn_io_file_close(pack_file, scratch_pool));
 
   svn_pool_destroy(iterpool);
 
@@ -1236,6 +1237,7 @@ svn_fs_fs__pack_revprops_shard(const cha
                                apr_pool_t *scratch_pool)
 {
   const char *manifest_file_path, *pack_filename = NULL;
+  apr_file_t *manifest_file;
   svn_stream_t *manifest_stream;
   svn_revnum_t start_rev, end_rev, rev;
   apr_off_t total_size;
@@ -1252,8 +1254,12 @@ svn_fs_fs__pack_revprops_shard(const cha
 
   /* Create the new directory and manifest file stream. */
   SVN_ERR(svn_io_dir_make(pack_file_dir, APR_OS_DEFAULT, scratch_pool));
-  SVN_ERR(svn_stream_open_writable(&manifest_stream, manifest_file_path,
-                                   scratch_pool, scratch_pool));
+
+  SVN_ERR(svn_io_file_open(&manifest_file, manifest_file_path,
+                           APR_WRITE | APR_BUFFERED | APR_CREATE | APR_EXCL,
+                           APR_OS_DEFAULT, scratch_pool));
+  manifest_stream = svn_stream_from_aprfile2(manifest_file, TRUE,
+                                             scratch_pool);
 
   /* revisions to handle. Special case: revision 0 */
   start_rev = (svn_revnum_t) (shard * max_files_per_dir);
@@ -1320,8 +1326,10 @@ svn_fs_fs__pack_revprops_shard(const cha
                                      compression_level, cancel_func,
                                      cancel_baton, iterpool));
 
-  /* flush the manifest file and update permissions */
+  /* flush the manifest file to disk and update permissions */
   SVN_ERR(svn_stream_close(manifest_stream));
+  SVN_ERR(svn_io_file_flush_to_disk(manifest_file, iterpool));
+  SVN_ERR(svn_io_file_close(manifest_file, iterpool));
   SVN_ERR(svn_io_copy_perms(shard_path, pack_file_dir, iterpool));
 
   svn_pool_destroy(iterpool);

Modified: subversion/branches/move-tracking-2/subversion/libsvn_fs_fs/structure-indexes
URL: http://svn.apache.org/viewvc/subversion/branches/move-tracking-2/subversion/libsvn_fs_fs/structure-indexes?rev=1685233&r1=1685232&r2=1685233&view=diff
==============================================================================
--- subversion/branches/move-tracking-2/subversion/libsvn_fs_fs/structure-indexes (original)
+++ subversion/branches/move-tracking-2/subversion/libsvn_fs_fs/structure-indexes Sat Jun 13 10:21:18 2015
@@ -192,11 +192,11 @@ at the beginning of the file is optional
 
   <bof>         /* begin of proto index file for revision r and following */
   (0, 0)        /* mark start of revision r, optional for first rev */
-  (off, item)*  /* zero to many mappings in random order */
+  (off, item)*  /* zero or more mappings in random order */
   (0, 0)        /* mark start of revision r + 1 */
-  (off, item)*  /* zero to many mappings in random order */
+  (off, item)*  /* zero or more mappings in random order */
   (0, 0)        /* mark start of revision r + 2 */
-  (off, item)*  /* zero to many mappings in random order */
+  (off, item)*  /* zero or more mappings in random order */
   ...
   <eof>         /* end of file. */
 

Modified: subversion/branches/move-tracking-2/subversion/libsvn_fs_fs/verify.c
URL: http://svn.apache.org/viewvc/subversion/branches/move-tracking-2/subversion/libsvn_fs_fs/verify.c?rev=1685233&r1=1685232&r2=1685233&view=diff
==============================================================================
--- subversion/branches/move-tracking-2/subversion/libsvn_fs_fs/verify.c (original)
+++ subversion/branches/move-tracking-2/subversion/libsvn_fs_fs/verify.c Sat Jun 13 10:21:18 2015
@@ -851,13 +851,15 @@ svn_fs_fs__verify(svn_fs_t *fs,
                   apr_pool_t *pool)
 {
   fs_fs_data_t *ffd = fs->fsap_data;
-  svn_revnum_t youngest = ffd->youngest_rev_cache; /* cache is current */
 
   /* Input validation. */
   if (! SVN_IS_VALID_REVNUM(start))
     start = 0;
   if (! SVN_IS_VALID_REVNUM(end))
-    end = youngest;
+    {
+      SVN_ERR(svn_fs_fs__youngest_rev(&end, fs, pool));
+    }
+
   SVN_ERR(svn_fs_fs__ensure_revision_exists(start, fs, pool));
   SVN_ERR(svn_fs_fs__ensure_revision_exists(end, fs, pool));
 



Mime
View raw message