subversion-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From julianf...@apache.org
Subject svn commit: r1689125 - in /subversion/branches/move-tracking-2: ./ subversion/ subversion/bindings/javahl/native/ subversion/bindings/javahl/src/org/apache/subversion/javahl/ subversion/bindings/javahl/src/org/apache/subversion/javahl/callback/ subvers...
Date Sat, 04 Jul 2015 09:16:47 GMT
Author: julianfoad
Date: Sat Jul  4 09:16:47 2015
New Revision: 1689125

URL: http://svn.apache.org/r1689125
Log:
On the 'move-tracking-2' branch: catch up to trunk@1689123.

Added:
    subversion/branches/move-tracking-2/subversion/bindings/javahl/native/ReposVerifyCallback.cpp
      - copied unchanged from r1689123, subversion/trunk/subversion/bindings/javahl/native/ReposVerifyCallback.cpp
    subversion/branches/move-tracking-2/subversion/bindings/javahl/native/ReposVerifyCallback.h
      - copied unchanged from r1689123, subversion/trunk/subversion/bindings/javahl/native/ReposVerifyCallback.h
    subversion/branches/move-tracking-2/subversion/bindings/javahl/src/org/apache/subversion/javahl/callback/ReposVerifyCallback.java
      - copied unchanged from r1689123, subversion/trunk/subversion/bindings/javahl/src/org/apache/subversion/javahl/callback/ReposVerifyCallback.java
Modified:
    subversion/branches/move-tracking-2/   (props changed)
    subversion/branches/move-tracking-2/subversion/   (props changed)
    subversion/branches/move-tracking-2/subversion/bindings/javahl/native/JNIUtil.cpp
    subversion/branches/move-tracking-2/subversion/bindings/javahl/native/JNIUtil.h
    subversion/branches/move-tracking-2/subversion/bindings/javahl/native/SVNRepos.cpp
    subversion/branches/move-tracking-2/subversion/bindings/javahl/native/SVNRepos.h
    subversion/branches/move-tracking-2/subversion/bindings/javahl/native/org_apache_subversion_javahl_SVNRepos.cpp
    subversion/branches/move-tracking-2/subversion/bindings/javahl/src/org/apache/subversion/javahl/ISVNRepos.java
    subversion/branches/move-tracking-2/subversion/bindings/javahl/src/org/apache/subversion/javahl/ReposNotifyInformation.java
    subversion/branches/move-tracking-2/subversion/bindings/javahl/src/org/apache/subversion/javahl/SVNRepos.java
    subversion/branches/move-tracking-2/subversion/bindings/javahl/tests/org/apache/subversion/javahl/SVNReposTests.java
    subversion/branches/move-tracking-2/subversion/include/svn_fs.h
    subversion/branches/move-tracking-2/subversion/include/svn_repos.h
    subversion/branches/move-tracking-2/subversion/libsvn_client/merge.c
    subversion/branches/move-tracking-2/subversion/libsvn_fs_fs/pack.c
    subversion/branches/move-tracking-2/subversion/libsvn_fs_fs/transaction.c
    subversion/branches/move-tracking-2/subversion/libsvn_repos/fs-wrap.c
    subversion/branches/move-tracking-2/subversion/svnadmin/svnadmin.c
    subversion/branches/move-tracking-2/subversion/tests/cmdline/svnadmin_tests.py

Propchange: subversion/branches/move-tracking-2/
------------------------------------------------------------------------------
--- svn:mergeinfo (original)
+++ svn:mergeinfo Sat Jul  4 09:16:47 2015
@@ -90,4 +90,4 @@
 /subversion/branches/verify-at-commit:1462039-1462408
 /subversion/branches/verify-keep-going:1439280-1546110
 /subversion/branches/wc-collate-path:1402685-1480384
-/subversion/trunk:1606692-1688211
+/subversion/trunk:1606692-1689123

Propchange: subversion/branches/move-tracking-2/subversion/
------------------------------------------------------------------------------
--- svn:mergeinfo (original)
+++ svn:mergeinfo Sat Jul  4 09:16:47 2015
@@ -82,4 +82,4 @@
 /subversion/branches/verify-at-commit/subversion:1462039-1462408
 /subversion/branches/verify-keep-going/subversion:1439280-1546110
 /subversion/branches/wc-collate-path/subversion:1402685-1480384
-/subversion/trunk/subversion:1606692-1688211
+/subversion/trunk/subversion:1606692-1689123

Modified: subversion/branches/move-tracking-2/subversion/bindings/javahl/native/JNIUtil.cpp
URL: http://svn.apache.org/viewvc/subversion/branches/move-tracking-2/subversion/bindings/javahl/native/JNIUtil.cpp?rev=1689125&r1=1689124&r2=1689125&view=diff
==============================================================================
--- subversion/branches/move-tracking-2/subversion/bindings/javahl/native/JNIUtil.cpp (original)
+++ subversion/branches/move-tracking-2/subversion/bindings/javahl/native/JNIUtil.cpp Sat
Jul  4 09:16:47 2015
@@ -570,13 +570,13 @@ std::string JNIUtil::makeSVNErrorMessage
   return buffer;
 }
 
-void JNIUtil::wrappedHandleSVNError(svn_error_t *err, jthrowable jcause)
+jthrowable JNIUtil::wrappedCreateClientException(svn_error_t *err, jthrowable jcause)
 {
   jstring jmessage;
   jobject jstack;
   std::string msg = makeSVNErrorMessage(err, &jmessage, &jstack);
   if (JNIUtil::isJavaExceptionThrown())
-    return;
+    return NULL;
 
   const char *source = NULL;
 #ifdef SVN_DEBUG
@@ -604,11 +604,11 @@ void JNIUtil::wrappedHandleSVNError(svn_
   // Create a local frame for our references
   env->PushLocalFrame(LOCAL_FRAME_SIZE);
   if (JNIUtil::isJavaExceptionThrown())
-    return;
+    return NULL;
 
   jclass clazz = env->FindClass(JAVAHL_CLASS("/ClientException"));
   if (isJavaExceptionThrown())
-    POP_AND_RETURN_NOTHING();
+    POP_AND_RETURN_NULL;
 
   if (getLogLevel() >= exceptionLog)
     {
@@ -622,11 +622,11 @@ void JNIUtil::wrappedHandleSVNError(svn_
       g_logStream << std::endl;
     }
   if (isJavaExceptionThrown())
-    POP_AND_RETURN_NOTHING();
+    POP_AND_RETURN_NULL;
 
   jstring jsource = makeJString(source);
   if (isJavaExceptionThrown())
-    POP_AND_RETURN_NOTHING();
+    POP_AND_RETURN_NULL;
 
   jmethodID mid = env->GetMethodID(clazz, "<init>",
                                    "(Ljava/lang/String;"
@@ -634,12 +634,12 @@ void JNIUtil::wrappedHandleSVNError(svn_
                                    "Ljava/lang/String;I"
                                    "Ljava/util/List;)V");
   if (isJavaExceptionThrown())
-    POP_AND_RETURN_NOTHING();
+    POP_AND_RETURN_NULL;
   jobject nativeException = env->NewObject(clazz, mid, jmessage, jcause,
                                            jsource, jint(err->apr_err),
                                            jstack);
   if (isJavaExceptionThrown())
-    POP_AND_RETURN_NOTHING();
+    POP_AND_RETURN_NULL;
 
 #ifdef SVN_ERR__TRACING
   // Add all the C error stack trace information to the Java Exception
@@ -651,7 +651,7 @@ void JNIUtil::wrappedHandleSVNError(svn_
       mid_gst = env->GetMethodID(clazz, "getStackTrace",
                                  "()[Ljava/lang/StackTraceElement;");
       if (isJavaExceptionThrown())
-        POP_AND_RETURN_NOTHING();
+        POP_AND_RETURN_NULL;
     }
   Array stackTraceArray((jobjectArray) env->CallObjectMethod(nativeException,
                                                              mid_gst));
@@ -670,18 +670,18 @@ void JNIUtil::wrappedHandleSVNError(svn_
 
   jclass stClazz = env->FindClass("java/lang/StackTraceElement");
   if (isJavaExceptionThrown())
-    POP_AND_RETURN_NOTHING();
+    POP_AND_RETURN_NULL;
 
   const jsize stSize = static_cast<jsize>(newStackTrace.size());
   if (stSize < 0 || stSize != newStackTrace.size())
     {
       env->ThrowNew(env->FindClass("java.lang.ArithmeticException"),
                     "Overflow converting C size_t to JNI jsize");
-      POP_AND_RETURN_NOTHING();
+      POP_AND_RETURN_NULL;
     }
   jobjectArray jStackTrace = env->NewObjectArray(stSize, stClazz, NULL);
   if (isJavaExceptionThrown())
-    POP_AND_RETURN_NOTHING();
+    POP_AND_RETURN_NULL;
 
   int i = 0;
   for (std::vector<jobject>::const_iterator it = newStackTrace.begin();
@@ -698,25 +698,34 @@ void JNIUtil::wrappedHandleSVNError(svn_
       mid_sst = env->GetMethodID(clazz, "setStackTrace",
                                  "([Ljava/lang/StackTraceElement;)V");
       if (isJavaExceptionThrown())
-        POP_AND_RETURN_NOTHING();
+        POP_AND_RETURN_NULL;
     }
   env->CallVoidMethod(nativeException, mid_sst, jStackTrace);
   if (isJavaExceptionThrown())
-    POP_AND_RETURN_NOTHING();
+    POP_AND_RETURN_NULL;
 #endif
 
-  env->Throw(static_cast<jthrowable>(env->PopLocalFrame(nativeException)));
+  return static_cast<jthrowable>(env->PopLocalFrame(nativeException));
 }
 
-void JNIUtil::handleSVNError(svn_error_t *err, jthrowable jcause)
+jthrowable JNIUtil::createClientException(svn_error_t *err, jthrowable jcause)
 {
+  jthrowable jexc = NULL;
   try {
-    wrappedHandleSVNError(err, jcause);
+    jexc = wrappedCreateClientException(err, jcause);
   } catch (...) {
     svn_error_clear(err);
     throw;
   }
   svn_error_clear(err);
+  return jexc;
+}
+
+void JNIUtil::handleSVNError(svn_error_t *err, jthrowable jcause)
+{
+  jthrowable jexc = createClientException(err, jcause);
+  if (jexc)
+    getEnv()->Throw(jexc);
 }
 
 void JNIUtil::putFinalizedClient(SVNBase *object)

Modified: subversion/branches/move-tracking-2/subversion/bindings/javahl/native/JNIUtil.h
URL: http://svn.apache.org/viewvc/subversion/branches/move-tracking-2/subversion/bindings/javahl/native/JNIUtil.h?rev=1689125&r1=1689124&r2=1689125&view=diff
==============================================================================
--- subversion/branches/move-tracking-2/subversion/bindings/javahl/native/JNIUtil.h (original)
+++ subversion/branches/move-tracking-2/subversion/bindings/javahl/native/JNIUtil.h Sat Jul
 4 09:16:47 2015
@@ -136,6 +136,13 @@ class JNIUtil
   static svn_error_t* checkJavaException(apr_status_t errorcode);
 
   /**
+   * Create a Java exception corresponding to err, and run
+   * svn_error_clear() on err.
+   */
+  static jthrowable createClientException(svn_error_t *err,
+                                          jthrowable jcause = NULL);
+
+  /**
    * Throw a Java exception corresponding to err, and run
    * svn_error_clear() on err.
    */
@@ -178,7 +185,8 @@ class JNIUtil
   friend bool initialize_jni_util(JNIEnv *env);
   static bool JNIGlobalInit(JNIEnv *env);
 
-  static void wrappedHandleSVNError(svn_error_t *err, jthrowable jcause);
+  static jthrowable wrappedCreateClientException(svn_error_t *err,
+                                                 jthrowable jcause);
   static void putErrorsInTrace(svn_error_t *err,
                                std::vector<jobject> &stackTrace);
 

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=1689125&r1=1689124&r2=1689125&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
Jul  4 09:16:47 2015
@@ -26,7 +26,6 @@
 
 #include "SVNRepos.h"
 #include "CreateJ.h"
-#include "ReposNotifyCallback.h"
 #include "JNIUtil.h"
 #include "svn_error_codes.h"
 #include "svn_repos.h"
@@ -595,7 +594,8 @@ SVNRepos::getRevnum(svn_revnum_t *revnum
 void
 SVNRepos::verify(File &path, Revision &revisionStart, Revision &revisionEnd,
                  bool checkNormalization, bool metadataOnly,
-                 ReposNotifyCallback *notifyCallback)
+                 ReposNotifyCallback *notifyCallback,
+                 ReposVerifyCallback *verifyCallback)
 {
   SVN::Pool requestPool;
   svn_repos_t *repos;
@@ -641,11 +641,12 @@ SVNRepos::verify(File &path, Revision &r
   SVN_JNI_ERR(svn_repos_verify_fs3(repos, lower, upper,
                                    checkNormalization,
                                    metadataOnly,
-                                   notifyCallback != NULL
-                                    ? ReposNotifyCallback::notify
-                                    : NULL,
+                                   (!notifyCallback ? NULL
+                                    : ReposNotifyCallback::notify),
                                    notifyCallback,
-                                   NULL, NULL, /* verify callback/baton */
+                                   (!verifyCallback ? NULL
+                                    : ReposVerifyCallback::callback),
+                                   verifyCallback,
                                    checkCancel, this /* cancel callback/baton */,
                                    requestPool.getPool()), );
 }

Modified: subversion/branches/move-tracking-2/subversion/bindings/javahl/native/SVNRepos.h
URL: http://svn.apache.org/viewvc/subversion/branches/move-tracking-2/subversion/bindings/javahl/native/SVNRepos.h?rev=1689125&r1=1689124&r2=1689125&view=diff
==============================================================================
--- subversion/branches/move-tracking-2/subversion/bindings/javahl/native/SVNRepos.h (original)
+++ subversion/branches/move-tracking-2/subversion/bindings/javahl/native/SVNRepos.h Sat Jul
 4 09:16:47 2015
@@ -35,6 +35,7 @@
 #include "InputStream.h"
 #include "MessageReceiver.h"
 #include "ReposNotifyCallback.h"
+#include "ReposVerifyCallback.h"
 #include "ReposFreezeAction.h"
 #include "StringArray.h"
 #include "File.h"
@@ -46,7 +47,8 @@ class SVNRepos : public SVNBase
   jobject lslocks(File &path, svn_depth_t depth);
   void verify(File &path, Revision &revisionStart, Revision &revisionEnd,
               bool checkNormalization, bool metadataOnly,
-              ReposNotifyCallback *notifyCallback);
+              ReposNotifyCallback *notifyCallback,
+              ReposVerifyCallback *verifyCallback);
   void setRevProp(File &path, Revision &revision,
                   const char *propName, const char *propValue,
                   bool usePreRevPropChangeHook,

Modified: subversion/branches/move-tracking-2/subversion/bindings/javahl/native/org_apache_subversion_javahl_SVNRepos.cpp
URL: http://svn.apache.org/viewvc/subversion/branches/move-tracking-2/subversion/bindings/javahl/native/org_apache_subversion_javahl_SVNRepos.cpp?rev=1689125&r1=1689124&r2=1689125&view=diff
==============================================================================
--- subversion/branches/move-tracking-2/subversion/bindings/javahl/native/org_apache_subversion_javahl_SVNRepos.cpp
(original)
+++ subversion/branches/move-tracking-2/subversion/bindings/javahl/native/org_apache_subversion_javahl_SVNRepos.cpp
Sat Jul  4 09:16:47 2015
@@ -420,7 +420,7 @@ Java_org_apache_subversion_javahl_SVNRep
     JNIEnv *env, jobject jthis, jobject jpath,
     jobject jrevisionStart, jobject jrevisionEnd,
     jboolean jcheckNormalization, jboolean jmetadataOnly,
-    jobject jcallback)
+    jobject jnotifyCallback, jobject jverifyCallback)
 {
   JNIEntry(SVNRepos, verify);
   SVNRepos *cl = SVNRepos::getCppObject(jthis);
@@ -442,13 +442,18 @@ Java_org_apache_subversion_javahl_SVNRep
   if (JNIUtil::isExceptionThrown())
     return;
 
-  ReposNotifyCallback callback(jcallback);
+  ReposNotifyCallback notify_cb(jnotifyCallback);
+  if (JNIUtil::isExceptionThrown())
+    return;
+
+  ReposVerifyCallback verify_cb(jverifyCallback);
   if (JNIUtil::isExceptionThrown())
     return;
 
   cl->verify(path, revisionStart, revisionEnd,
              jcheckNormalization, jmetadataOnly,
-             jcallback != NULL ? &callback : NULL);
+             jnotifyCallback != NULL ? &notify_cb : NULL,
+             jverifyCallback != NULL ? &verify_cb : NULL);
 }
 
 JNIEXPORT jobject JNICALL

Modified: subversion/branches/move-tracking-2/subversion/bindings/javahl/src/org/apache/subversion/javahl/ISVNRepos.java
URL: http://svn.apache.org/viewvc/subversion/branches/move-tracking-2/subversion/bindings/javahl/src/org/apache/subversion/javahl/ISVNRepos.java?rev=1689125&r1=1689124&r2=1689125&view=diff
==============================================================================
--- subversion/branches/move-tracking-2/subversion/bindings/javahl/src/org/apache/subversion/javahl/ISVNRepos.java
(original)
+++ subversion/branches/move-tracking-2/subversion/bindings/javahl/src/org/apache/subversion/javahl/ISVNRepos.java
Sat Jul  4 09:16:47 2015
@@ -29,6 +29,7 @@ import java.io.InputStream;
 import java.io.File;
 
 import org.apache.subversion.javahl.callback.ReposNotifyCallback;
+import org.apache.subversion.javahl.callback.ReposVerifyCallback;
 import org.apache.subversion.javahl.callback.ReposFreezeAction;
 import org.apache.subversion.javahl.types.*;
 
@@ -295,30 +296,44 @@ public interface ISVNRepos {
     /**
      * Verify the repository at <code>path</code> between revisions
      * <code>start</code> and <code>end</code>.
+     *<p>
+     * If <code>verifyCallback</code> is <code>null</code>, verification
+     * will stop at the first encountered error. Otherwise, the verification
+     * process may continue, depending on the value returned from the
+     * invocation of <code>verifyCallback</code>.
      *
      * @param path              the path to the repository
      * @param start             the first revision
      * @param end               the last revision
-         * @param checkNormalization report directory entry and mergeinfo name collisions
-         *                           caused by denormalized Unicode representations
-         * @param metadataOnly      check only metadata, not file contents
-         * @param callback          the callback to receive notifications
+     * @param checkNormalization report directory entry and mergeinfo name collisions
+     *                           caused by denormalized Unicode representations
+     * @param metadataOnly      check only metadata, not file contents
+     * @param notifyCallback    the callback to receive notifications
+     * @param verifyCallback    the callback to receive verification status
      * @throws ClientException If an error occurred.
-         * @since 1.9
+     * @since 1.9
      */
     public abstract void verify(File path, Revision start, Revision end,
-                boolean checkNormalization, boolean metadataOnly,
-                ReposNotifyCallback callback)
+                boolean checkNormalization,
+                boolean metadataOnly,
+                ReposNotifyCallback notifyCallback,
+                ReposVerifyCallback verifyCallback)
             throws ClientException;
 
     /**
      * Verify the repository at <code>path</code> between revisions
      * <code>start</code> and <code>end</code>.
+     *<p>
+     *<b>Note:</b> Behaves like the 1.9 version with
+     *             <code>checkNormailzation</code> and
+     *             <code>metadataOnly</code> set to <code>false</code>
+     *             and <code>verifyCallback</code> set to
+     *             <code>null</code>.
      *
      * @param path              the path to the repository
      * @param start             the first revision
      * @param end               the last revision
-         * @param callback          the callback to receive notifications
+     * @param callback          the callback to receive notifications
      * @throws ClientException If an error occurred.
      */
     public abstract void verify(File path, Revision start, Revision end,

Modified: subversion/branches/move-tracking-2/subversion/bindings/javahl/src/org/apache/subversion/javahl/ReposNotifyInformation.java
URL: http://svn.apache.org/viewvc/subversion/branches/move-tracking-2/subversion/bindings/javahl/src/org/apache/subversion/javahl/ReposNotifyInformation.java?rev=1689125&r1=1689124&r2=1689125&view=diff
==============================================================================
--- subversion/branches/move-tracking-2/subversion/bindings/javahl/src/org/apache/subversion/javahl/ReposNotifyInformation.java
(original)
+++ subversion/branches/move-tracking-2/subversion/bindings/javahl/src/org/apache/subversion/javahl/ReposNotifyInformation.java
Sat Jul  4 09:16:47 2015
@@ -35,7 +35,7 @@ public class ReposNotifyInformation exte
     // Update the serialVersionUID when there is a incompatible change made to
     // this class.  See the java documentation for when a change is incompatible.
     // http://java.sun.com/javase/7/docs/platform/serialization/spec/version.html#6678
-    private static final long serialVersionUID = 1L;
+    private static final long serialVersionUID = 2L;
 
     /**
      * The {@link Action} which triggered this event.

Modified: subversion/branches/move-tracking-2/subversion/bindings/javahl/src/org/apache/subversion/javahl/SVNRepos.java
URL: http://svn.apache.org/viewvc/subversion/branches/move-tracking-2/subversion/bindings/javahl/src/org/apache/subversion/javahl/SVNRepos.java?rev=1689125&r1=1689124&r2=1689125&view=diff
==============================================================================
--- subversion/branches/move-tracking-2/subversion/bindings/javahl/src/org/apache/subversion/javahl/SVNRepos.java
(original)
+++ subversion/branches/move-tracking-2/subversion/bindings/javahl/src/org/apache/subversion/javahl/SVNRepos.java
Sat Jul  4 09:16:47 2015
@@ -29,6 +29,7 @@ import java.io.InputStream;
 import java.io.File;
 
 import org.apache.subversion.javahl.callback.ReposNotifyCallback;
+import org.apache.subversion.javahl.callback.ReposVerifyCallback;
 import org.apache.subversion.javahl.callback.ReposFreezeAction;
 import org.apache.subversion.javahl.types.*;
 
@@ -238,12 +239,14 @@ public class SVNRepos implements ISVNRep
                        ReposNotifyCallback callback)
             throws ClientException
     {
-        verify(path, start, end, false, false, callback);
+        verify(path, start, end, false, false, callback, null);
     }
 
     public native void verify(File path, Revision start, Revision end,
-                              boolean checkNormalization, boolean metadataOnly,
-                              ReposNotifyCallback callback)
+                       boolean checkNormalization,
+                       boolean metadataOnly,
+                       ReposNotifyCallback notifyCallback,
+                       ReposVerifyCallback verifyCallback)
             throws ClientException;
 
     /**

Modified: subversion/branches/move-tracking-2/subversion/bindings/javahl/tests/org/apache/subversion/javahl/SVNReposTests.java
URL: http://svn.apache.org/viewvc/subversion/branches/move-tracking-2/subversion/bindings/javahl/tests/org/apache/subversion/javahl/SVNReposTests.java?rev=1689125&r1=1689124&r2=1689125&view=diff
==============================================================================
--- subversion/branches/move-tracking-2/subversion/bindings/javahl/tests/org/apache/subversion/javahl/SVNReposTests.java
(original)
+++ subversion/branches/move-tracking-2/subversion/bindings/javahl/tests/org/apache/subversion/javahl/SVNReposTests.java
Sat Jul  4 09:16:47 2015
@@ -26,6 +26,7 @@ import org.apache.subversion.javahl.call
 import org.apache.subversion.javahl.types.*;
 
 import java.io.File;
+import java.io.FileWriter;
 import java.io.FileInputStream;
 import java.io.OutputStream;
 import java.io.InputStream;
@@ -99,12 +100,107 @@ public class SVNReposTests extends SVNTe
     public void testVerify()
         throws SubversionException, IOException
     {
-        OneTest thisTest = new OneTest(false);
+        OneTest thisTest = new OneTest(false, true);
         admin.verify(thisTest.getRepository(), Revision.getInstance(0),
                      Revision.HEAD, null);
     }
 
-    /* This test only tests the call down to the C++ layer. */
+    private class VerifyCallback implements ReposVerifyCallback
+    {
+        public int mderr = 0;
+        public int reverr = 0;
+        public boolean keepGoing = false;
+
+        public void onVerifyError(long revision, ClientException verifyError)
+            throws ClientException
+        {
+            if (revision == Revision.SVN_INVALID_REVNUM) {
+                ++mderr;
+            }
+            else {
+                ++reverr;
+            }
+            if (keepGoing) {
+                return;
+            }
+            else {
+                throw verifyError;
+            }
+        }
+
+    }
+
+    private boolean tryToBreakRepo(OneTest test) throws IOException
+    {
+        File repo = test.getRepository();
+
+        // Check for a sharded repo first
+        File rev1 = new File(repo, "db/revs/0/1");
+        if (!rev1.exists() || !rev1.setWritable(true))
+        {
+            // Try non-sharded
+            rev1 = new File(repo, "db/revs/1");
+        }
+        if (!rev1.exists() || !rev1.setWritable(true))
+            return false;
+
+        FileWriter fd = new FileWriter(rev1);
+        fd.write("inserting junk to corrupt the rev");
+        fd.close();
+        return true;
+    }
+
+    public void testVerifyBrokenRepo() throws Throwable
+    {
+        OneTest thisTest = new OneTest(false, true);
+
+        if (!tryToBreakRepo(thisTest)) {
+            // We don't support the repos format
+            System.err.print("Cannot break repository for verify test.");
+            return;
+        }
+
+        VerifyCallback cb = new VerifyCallback();
+        cb.keepGoing = false;
+
+        try {
+            admin.verify(thisTest.getRepository(),
+                         Revision.getInstance(0),
+                         Revision.HEAD,
+                         false, false, null, cb);
+        }
+        catch(ClientException ex) {
+            assertEquals(cb.mderr, 1);
+            assertEquals(cb.reverr, 0);
+            return;
+        }
+
+        assert("Verify did not catch repository corruption." == "");
+    }
+
+    public void testVerifyBrokenRepo_KeepGoing() throws Throwable
+    {
+        OneTest thisTest = new OneTest(false, true);
+
+        if (!tryToBreakRepo(thisTest)) {
+            // We don't support the repos format
+            System.err.print("Cannot break repository for verify test.");
+            return;
+        }
+
+        VerifyCallback cb = new VerifyCallback();
+        cb.keepGoing = true;
+
+        admin.verify(thisTest.getRepository(),
+                     Revision.getInstance(0),
+                     Revision.HEAD,
+                     false, false, null, cb);
+
+        assertEquals(cb.mderr, 1);
+        assertEquals(cb.reverr, 1);
+    }
+
+    /* this test only tests the call down to the C++ layer. */
     public void testUpgrade()
         throws SubversionException, IOException
     {

Modified: subversion/branches/move-tracking-2/subversion/include/svn_fs.h
URL: http://svn.apache.org/viewvc/subversion/branches/move-tracking-2/subversion/include/svn_fs.h?rev=1689125&r1=1689124&r2=1689125&view=diff
==============================================================================
--- subversion/branches/move-tracking-2/subversion/include/svn_fs.h (original)
+++ subversion/branches/move-tracking-2/subversion/include/svn_fs.h Sat Jul  4 09:16:47 2015
@@ -2959,7 +2959,13 @@ typedef enum svn_fs_pack_notify_action_t
 
   /** packing of the shard revprops has completed
       @since New in 1.7. */
-  svn_fs_pack_notify_end_revprop
+  svn_fs_pack_notify_end_revprop,
+
+  /** pack has been a no-op for this repository.  The next / future packable
+      shard will be given.  If the shard is -1, then the repository does not
+      support packing at all.
+      @since New in 1.10. */
+  svn_fs_pack_notify_noop
 
 } svn_fs_pack_notify_action_t;
 

Modified: subversion/branches/move-tracking-2/subversion/include/svn_repos.h
URL: http://svn.apache.org/viewvc/subversion/branches/move-tracking-2/subversion/include/svn_repos.h?rev=1689125&r1=1689124&r2=1689125&view=diff
==============================================================================
--- subversion/branches/move-tracking-2/subversion/include/svn_repos.h (original)
+++ subversion/branches/move-tracking-2/subversion/include/svn_repos.h Sat Jul  4 09:16:47
2015
@@ -244,7 +244,10 @@ typedef enum svn_repos_notify_action_t
   svn_repos_notify_format_bumped,
 
   /** A revision range was copied. @since New in 1.9. */
-  svn_repos_notify_hotcopy_rev_range
+  svn_repos_notify_hotcopy_rev_range,
+
+  /** The repository pack did not do anything. @since New in 1.10. */
+  svn_repos_notify_pack_noop
 } svn_repos_notify_action_t;
 
 /** The type of warning occurring.

Modified: subversion/branches/move-tracking-2/subversion/libsvn_client/merge.c
URL: http://svn.apache.org/viewvc/subversion/branches/move-tracking-2/subversion/libsvn_client/merge.c?rev=1689125&r1=1689124&r2=1689125&view=diff
==============================================================================
--- subversion/branches/move-tracking-2/subversion/libsvn_client/merge.c (original)
+++ subversion/branches/move-tracking-2/subversion/libsvn_client/merge.c Sat Jul  4 09:16:47
2015
@@ -2794,12 +2794,6 @@ merge_dir_opened(void **new_dir_baton,
 
               db->tree_conflict_reason = added ? svn_wc_conflict_reason_added
                                                : svn_wc_conflict_reason_obstructed;
-
-              if ((merge_b->merge_source.ancestral || merge_b->reintegrate_merge)
-                  && !(pdb && pdb->shadowed))
-                {
-                  store_path(merge_b->skipped_abspaths, local_abspath);
-                }
             }
         }
 
@@ -5398,14 +5392,6 @@ record_skips_in_mergeinfo(const char *me
           || obstruction_state == svn_wc_notify_state_missing)
         continue;
 
-      /* Make sure this is not a tree-conflicted path either. We don't
-       * want to add mergeinfo on such nodes since it causes problems down
-       * the line (see issue #4582, "reintegrate complains about missing
-       * ranges from node unrelated to branch") */
-      if (svn_hash_gets(merge_b->tree_conflicted_abspaths,
-                        skipped_abspath) != NULL)
-        continue;
-
       /* Add an empty range list for this path.
 
          ### TODO: This works fine for a file path skipped because it is

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=1689125&r1=1689124&r2=1689125&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 Jul  4 09:16:47
2015
@@ -1987,7 +1987,14 @@ pack_body(void *baton,
      we need to re-read the pack status. */
   SVN_ERR(get_pack_status(&fully_packed, pb->fs, pool));
   if (fully_packed)
-    return SVN_NO_ERROR;
+    {
+      if (pb->notify_func)
+        (*pb->notify_func)(pb->notify_baton,
+                           ffd->min_unpacked_rev / ffd->max_files_per_dir,
+                           svn_fs_pack_notify_noop, pool);
+
+      return SVN_NO_ERROR;
+    }
 
   completed_shards = (ffd->youngest_rev_cache + 1) / ffd->max_files_per_dir;
   pb->revs_dir = svn_dirent_join(pb->fs->path, PATH_REVS_DIR, pool);
@@ -2034,12 +2041,24 @@ svn_fs_fs__pack(svn_fs_t *fs,
 
   /* If we aren't using sharding, we can't do any packing, so quit. */
   if (!ffd->max_files_per_dir)
-    return SVN_NO_ERROR;
+    {
+      if (notify_func)
+        (*notify_func)(notify_baton, -1, svn_fs_pack_notify_noop, pool);
+
+      return SVN_NO_ERROR;
+    }
 
   /* Is there we even anything to do?. */
   SVN_ERR(get_pack_status(&fully_packed, fs, pool));
   if (fully_packed)
-    return SVN_NO_ERROR;
+    {
+      if (notify_func)
+        (*notify_func)(notify_baton,
+                       ffd->min_unpacked_rev / ffd->max_files_per_dir,
+                       svn_fs_pack_notify_noop, pool);
+
+      return SVN_NO_ERROR;
+    }
 
   /* Lock the repo and start the pack process. */
   pb.fs = fs;

Modified: subversion/branches/move-tracking-2/subversion/libsvn_fs_fs/transaction.c
URL: http://svn.apache.org/viewvc/subversion/branches/move-tracking-2/subversion/libsvn_fs_fs/transaction.c?rev=1689125&r1=1689124&r2=1689125&view=diff
==============================================================================
--- subversion/branches/move-tracking-2/subversion/libsvn_fs_fs/transaction.c (original)
+++ subversion/branches/move-tracking-2/subversion/libsvn_fs_fs/transaction.c Sat Jul  4 09:16:47
2015
@@ -1153,19 +1153,22 @@ set_txn_proplist(svn_fs_t *fs,
                  apr_hash_t *props,
                  apr_pool_t *pool)
 {
-  svn_stringbuf_t *buf;
-  svn_stream_t *stream;
+  svn_stream_t *tmp_stream;
+  const char *tmp_path;
+  const char *final_path = path_txn_props(fs, txn_id, pool);
 
-  /* Write out the new file contents to BUF. */
-  buf = svn_stringbuf_create_ensure(1024, pool);
-  stream = svn_stream_from_stringbuf(buf, pool);
-  SVN_ERR(svn_hash_write2(props, stream, SVN_HASH_TERMINATOR, pool));
-  SVN_ERR(svn_stream_close(stream));
+  /* Write the new contents into a temporary file. */
+  SVN_ERR(svn_stream_open_unique(&tmp_stream, &tmp_path,
+                                 svn_dirent_dirname(final_path, pool),
+                                 svn_io_file_del_none,
+                                 pool, pool));
+
+  /* Replace the old file with the new one. */
+  SVN_ERR(svn_hash_write2(props, tmp_stream, SVN_HASH_TERMINATOR, pool));
+  SVN_ERR(svn_stream_close(tmp_stream));
+
+  SVN_ERR(svn_io_file_rename(tmp_path, final_path, pool));
 
-  /* Open the transaction properties file and write new contents to it. */
-  SVN_ERR(svn_io_write_atomic(path_txn_props(fs, txn_id, pool),
-                              buf->data, buf->len,
-                              NULL /* copy_perms_path */, pool));
   return SVN_NO_ERROR;
 }
 

Modified: subversion/branches/move-tracking-2/subversion/libsvn_repos/fs-wrap.c
URL: http://svn.apache.org/viewvc/subversion/branches/move-tracking-2/subversion/libsvn_repos/fs-wrap.c?rev=1689125&r1=1689124&r2=1689125&view=diff
==============================================================================
--- subversion/branches/move-tracking-2/subversion/libsvn_repos/fs-wrap.c (original)
+++ subversion/branches/move-tracking-2/subversion/libsvn_repos/fs-wrap.c Sat Jul  4 09:16:47
2015
@@ -975,15 +975,18 @@ pack_notify_func(void *baton,
 {
   struct pack_notify_baton *pnb = baton;
   svn_repos_notify_t *notify;
+  svn_repos_notify_action_t repos_action;
 
   /* Simple conversion works for these values. */
   SVN_ERR_ASSERT(pack_action >= svn_fs_pack_notify_start
-                 && pack_action <= svn_fs_pack_notify_end_revprop);
+                 && pack_action <= svn_fs_pack_notify_noop);
 
-  notify = svn_repos_notify_create(pack_action
-                                   + svn_repos_notify_pack_shard_start
-                                   - svn_fs_pack_notify_start,
-                                   pool);
+  repos_action = pack_action == svn_fs_pack_notify_noop
+               ? svn_repos_notify_pack_noop
+               : pack_action + svn_repos_notify_pack_shard_start
+                             - svn_fs_pack_notify_start;
+
+  notify = svn_repos_notify_create(repos_action, pool);
   notify->shard = shard;
   pnb->notify_func(pnb->notify_baton, notify, pool);
 

Modified: subversion/branches/move-tracking-2/subversion/svnadmin/svnadmin.c
URL: http://svn.apache.org/viewvc/subversion/branches/move-tracking-2/subversion/svnadmin/svnadmin.c?rev=1689125&r1=1689124&r2=1689125&view=diff
==============================================================================
--- subversion/branches/move-tracking-2/subversion/svnadmin/svnadmin.c (original)
+++ subversion/branches/move-tracking-2/subversion/svnadmin/svnadmin.c Sat Jul  4 09:16:47
2015
@@ -1126,6 +1126,18 @@ repos_notify_handler(void *baton,
                                _("* Copied revisions from %ld to %ld.\n"),
                                notify->start_revision, notify->end_revision));
         }
+      return;
+
+    case svn_repos_notify_pack_noop:
+      /* For best backward compatibility, we keep silent if there were just
+         no more shards to pack. */
+      if (notify->shard == -1)
+        {
+          svn_error_clear(svn_stream_printf(feedback_stream, scratch_pool,
+                     _("svnadmin: Warning - this repository is not sharded."
+                       " Packing has no effect.\n")));
+        }
+      return;
 
     default:
       return;

Modified: subversion/branches/move-tracking-2/subversion/tests/cmdline/svnadmin_tests.py
URL: http://svn.apache.org/viewvc/subversion/branches/move-tracking-2/subversion/tests/cmdline/svnadmin_tests.py?rev=1689125&r1=1689124&r2=1689125&view=diff
==============================================================================
--- subversion/branches/move-tracking-2/subversion/tests/cmdline/svnadmin_tests.py (original)
+++ subversion/branches/move-tracking-2/subversion/tests/cmdline/svnadmin_tests.py Sat Jul
 4 09:16:47 2015
@@ -249,6 +249,18 @@ def patch_format(repo_dir, shard_size):
   os.chmod(format_path, 0666)
   open(format_path, 'wb').write(new_contents)
 
+def is_sharded(repo_dir):
+  """Return whether the FSFS repository REPO_DIR is sharded."""
+
+  format_path = os.path.join(repo_dir, "db", "format")
+  contents = open(format_path, 'rb').read()
+
+  for line in contents.split("\n"):
+    if line.startswith("layout sharded"):
+      return True
+
+  return False
+
 def load_and_verify_dumpstream(sbox, expected_stdout, expected_stderr,
                                revs, check_props, dump, *varargs):
   """Load the array of lines passed in DUMP into the current tests'
@@ -3066,6 +3078,25 @@ def hotcopy_read_only(sbox):
     logger.warn("Error: hotcopy failed")
     raise SVNUnexpectedStderr(errput)
 
+@SkipUnless(svntest.main.is_fs_type_fsfs)
+@SkipUnless(svntest.main.fs_has_pack)
+def fsfs_pack_non_sharded(sbox):
+  "'svnadmin pack' on a non-sharded repository"
+
+  # Configure two files per shard to trigger packing.
+  sbox.build(create_wc = False,
+             minor_version = min(svntest.main.options.server_minor_version,3))
+
+  # Skip for pre-cooked sharded repositories
+  if is_sharded(sbox.repo_dir):
+    raise svntest.Skip('sharded pre-cooked repository')
+
+  svntest.actions.run_and_verify_svnadmin(
+      None, [], "upgrade", sbox.repo_dir)
+  svntest.actions.run_and_verify_svnadmin(
+      ['svnadmin: Warning - this repository is not sharded. Packing has no effect.\n'],
+      [], "pack", sbox.repo_dir)
+
 ########################################################################
 # Run the tests
 
@@ -3123,6 +3154,7 @@ test_list = [ None,
               load_txdelta,
               load_no_svndate_r0,
               hotcopy_read_only,
+              fsfs_pack_non_sharded,
              ]
 
 if __name__ == '__main__':



Mime
View raw message