You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@subversion.apache.org by hw...@apache.org on 2012/06/06 15:03:50 UTC

svn commit: r1346869 [1/3] - in /subversion/branches/ev2-export: ./ build/generator/ notes/ notes/directory-index/ subversion/bindings/javahl/native/ subversion/include/private/ subversion/libsvn_auth_kwallet/ subversion/libsvn_client/ subversion/libsv...

Author: hwright
Date: Wed Jun  6 13:03:48 2012
New Revision: 1346869

URL: http://svn.apache.org/viewvc?rev=1346869&view=rev
Log:
On the ev2-export branch:
Bring up-to-date with trunk.

Modified:
    subversion/branches/ev2-export/   (props changed)
    subversion/branches/ev2-export/build/generator/gen_win.py
    subversion/branches/ev2-export/gen-make.py
    subversion/branches/ev2-export/notes/directory-index/dirindex.py   (props changed)
    subversion/branches/ev2-export/notes/directory-index/logimport.py   (props changed)
    subversion/branches/ev2-export/notes/ev2-callbacks-template.c   (props changed)
    subversion/branches/ev2-export/subversion/bindings/javahl/native/JNIStackElement.cpp
    subversion/branches/ev2-export/subversion/bindings/javahl/native/JNIUtil.h
    subversion/branches/ev2-export/subversion/include/private/svn_delta_private.h   (props changed)
    subversion/branches/ev2-export/subversion/libsvn_auth_kwallet/kwallet.cpp
    subversion/branches/ev2-export/subversion/libsvn_client/client.h
    subversion/branches/ev2-export/subversion/libsvn_client/export.c
    subversion/branches/ev2-export/subversion/libsvn_client/merge.c
    subversion/branches/ev2-export/subversion/libsvn_client/mergeinfo.c
    subversion/branches/ev2-export/subversion/libsvn_client/ra.c
    subversion/branches/ev2-export/subversion/libsvn_client/util.c
    subversion/branches/ev2-export/subversion/libsvn_delta/deprecated.c   (props changed)
    subversion/branches/ev2-export/subversion/libsvn_fs/editor.c   (contents, props changed)
    subversion/branches/ev2-export/subversion/libsvn_fs_fs/fs_fs.c
    subversion/branches/ev2-export/subversion/libsvn_fs_fs/lock.c
    subversion/branches/ev2-export/subversion/libsvn_ra/editor.c   (props changed)
    subversion/branches/ev2-export/subversion/libsvn_ra_serf/ra_serf.h
    subversion/branches/ev2-export/subversion/libsvn_ra_serf/util.c
    subversion/branches/ev2-export/subversion/libsvn_ra_svn/client.c
    subversion/branches/ev2-export/subversion/libsvn_ra_svn/editorp.c
    subversion/branches/ev2-export/subversion/libsvn_ra_svn/marshal.c
    subversion/branches/ev2-export/subversion/libsvn_subr/cache-membuffer.c
    subversion/branches/ev2-export/subversion/libsvn_subr/config_file.c
    subversion/branches/ev2-export/subversion/libsvn_subr/io.c
    subversion/branches/ev2-export/subversion/libsvn_subr/opt.c
    subversion/branches/ev2-export/subversion/libsvn_subr/string.c
    subversion/branches/ev2-export/subversion/libsvn_wc/adm_crawler.c
    subversion/branches/ev2-export/subversion/libsvn_wc/adm_ops.c
    subversion/branches/ev2-export/subversion/libsvn_wc/conflicts.c
    subversion/branches/ev2-export/subversion/libsvn_wc/copy.c
    subversion/branches/ev2-export/subversion/libsvn_wc/deprecated.c
    subversion/branches/ev2-export/subversion/libsvn_wc/diff_local.c
    subversion/branches/ev2-export/subversion/libsvn_wc/lock.c
    subversion/branches/ev2-export/subversion/libsvn_wc/node.c
    subversion/branches/ev2-export/subversion/libsvn_wc/props.c
    subversion/branches/ev2-export/subversion/libsvn_wc/status.c
    subversion/branches/ev2-export/subversion/libsvn_wc/tree_conflicts.c
    subversion/branches/ev2-export/subversion/libsvn_wc/update_editor.c
    subversion/branches/ev2-export/subversion/libsvn_wc/util.c
    subversion/branches/ev2-export/subversion/libsvn_wc/wc-queries.sql
    subversion/branches/ev2-export/subversion/libsvn_wc/wc_db.c
    subversion/branches/ev2-export/subversion/libsvn_wc/wc_db.h
    subversion/branches/ev2-export/subversion/libsvn_wc/wc_db_pristine.c
    subversion/branches/ev2-export/subversion/libsvn_wc/workqueue.c
    subversion/branches/ev2-export/subversion/libsvn_wc/workqueue.h
    subversion/branches/ev2-export/subversion/tests/cmdline/export_tests.py
    subversion/branches/ev2-export/subversion/tests/cmdline/merge_symmetric_tests.py
    subversion/branches/ev2-export/subversion/tests/cmdline/stat_tests.py
    subversion/branches/ev2-export/subversion/tests/cmdline/update_tests.py
    subversion/branches/ev2-export/subversion/tests/libsvn_subr/dirent_uri-test.c
    subversion/branches/ev2-export/tools/buildbot/slaves/win32-SharpSvn/svntest-test.cmd
    subversion/branches/ev2-export/tools/client-side/mergeinfo-sanitizer.py   (props changed)
    subversion/branches/ev2-export/tools/dev/gdb-py/svndbg/__init__.py   (props changed)
    subversion/branches/ev2-export/tools/dev/gdb-py/svndbg/printers.py   (props changed)
    subversion/branches/ev2-export/tools/dev/histogram.py   (props changed)
    subversion/branches/ev2-export/tools/dev/sbox-ospath.py   (props changed)
    subversion/branches/ev2-export/tools/server-side/svnpredumpfilter.py   (props changed)
    subversion/branches/ev2-export/tools/server-side/svnpubsub/commit-hook.py   (props changed)
    subversion/branches/ev2-export/tools/server-side/svnpubsub/daemonize.py   (props changed)
    subversion/branches/ev2-export/tools/server-side/svnpubsub/svnpubsub/__init__.py   (props changed)
    subversion/branches/ev2-export/tools/server-side/svnpubsub/svnpubsub/client.py   (props changed)
    subversion/branches/ev2-export/tools/server-side/svnpubsub/svnpubsub/server.py   (props changed)
    subversion/branches/ev2-export/tools/server-side/svnpubsub/svntweet.py   (props changed)
    subversion/branches/ev2-export/tools/server-side/svnpubsub/svnwcsub.py   (props changed)
    subversion/branches/ev2-export/tools/server-side/svnpubsub/testserver.py   (props changed)
    subversion/branches/ev2-export/tools/server-side/svnpubsub/watcher.py   (props changed)

Propchange: subversion/branches/ev2-export/
------------------------------------------------------------------------------
  Merged /subversion/branches/javahl-ra:r1344977
  Merged /subversion/trunk:r1344923-1346866

Modified: subversion/branches/ev2-export/build/generator/gen_win.py
URL: http://svn.apache.org/viewvc/subversion/branches/ev2-export/build/generator/gen_win.py?rev=1346869&r1=1346868&r2=1346869&view=diff
==============================================================================
--- subversion/branches/ev2-export/build/generator/gen_win.py (original)
+++ subversion/branches/ev2-export/build/generator/gen_win.py Wed Jun  6 13:03:48 2012
@@ -188,8 +188,8 @@ class GeneratorBase(gen_base.GeneratorBa
           self.sln_version = '11.00'
           self.vcproj_version = '10.0'
           self.vcproj_extension = '.vcxproj'
-        elif val == '11':
-          self.vs_version = '11'
+        elif val == '2012' or val == '11':
+          self.vs_version = '2012'
           self.sln_version = '12.00'
           self.vcproj_version = '11.0'
           self.vcproj_extension = '.vcxproj'

Modified: subversion/branches/ev2-export/gen-make.py
URL: http://svn.apache.org/viewvc/subversion/branches/ev2-export/gen-make.py?rev=1346869&r1=1346868&r2=1346869&view=diff
==============================================================================
--- subversion/branches/ev2-export/gen-make.py (original)
+++ subversion/branches/ev2-export/gen-make.py Wed Jun  6 13:03:48 2012
@@ -211,7 +211,7 @@ def _usage_exit(err=None):
   print("           Use static apr and apr-util")
   print("")
   print("  --vsnet-version=VER")
-  print("           generate for VS.NET version VER (2002, 2003, 2005, 2008 or 2010)")
+  print("           generate for VS.NET version VER (2002, 2003, 2005, 2008, 2010 or 2012)")
   print("           [only valid in combination with '-t vcproj']")
   print("")
   print("  --with-apr_memcache=DIR")

Propchange: subversion/branches/ev2-export/notes/directory-index/dirindex.py
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: subversion/branches/ev2-export/notes/directory-index/logimport.py
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: subversion/branches/ev2-export/notes/ev2-callbacks-template.c
------------------------------------------------------------------------------
    svn:eol-style = native

Modified: subversion/branches/ev2-export/subversion/bindings/javahl/native/JNIStackElement.cpp
URL: http://svn.apache.org/viewvc/subversion/branches/ev2-export/subversion/bindings/javahl/native/JNIStackElement.cpp?rev=1346869&r1=1346868&r2=1346869&view=diff
==============================================================================
--- subversion/branches/ev2-export/subversion/bindings/javahl/native/JNIStackElement.cpp (original)
+++ subversion/branches/ev2-export/subversion/bindings/javahl/native/JNIStackElement.cpp Wed Jun  6 13:03:48 2012
@@ -58,20 +58,28 @@ JNIStackElement::JNIStackElement(JNIEnv 
             return;
         }
 
-      // This will call java.lang.Object.toString, even when it is
-      // overriden.
-      jobject oStr = env->CallNonvirtualObjectMethod(jthis, jlo, mid);
-      if (JNIUtil::isJavaExceptionThrown())
-        return;
-
-      // Copy the result to a buffer.
-      JNIStringHolder name(reinterpret_cast<jstring>(oStr));
       *m_objectID = 0;
-      strncat(m_objectID, name, JNIUtil::formatBufferSize -1);
+
+      if(jthis == NULL)
+        {
+          strcpy(m_objectID, "<static>");
+        }
+      else
+        {
+          // This will call java.lang.Object.toString, even when it is
+          // overriden.
+          jobject oStr = env->CallNonvirtualObjectMethod(jthis, jlo, mid);
+          if (JNIUtil::isJavaExceptionThrown())
+            return;
+
+          // Copy the result to a buffer.
+          JNIStringHolder name(reinterpret_cast<jstring>(oStr));
+          strncat(m_objectID, name, JNIUtil::formatBufferSize -1);
+          env->DeleteLocalRef(oStr);
+        }
 
       // Release the Java string.
       env->DeleteLocalRef(jlo);
-      env->DeleteLocalRef(oStr);
 
       // Remember the parameter for the exit of the method.
       m_clazz = clazz;

Modified: subversion/branches/ev2-export/subversion/bindings/javahl/native/JNIUtil.h
URL: http://svn.apache.org/viewvc/subversion/branches/ev2-export/subversion/bindings/javahl/native/JNIUtil.h?rev=1346869&r1=1346868&r2=1346869&view=diff
==============================================================================
--- subversion/branches/ev2-export/subversion/bindings/javahl/native/JNIUtil.h (original)
+++ subversion/branches/ev2-export/subversion/bindings/javahl/native/JNIUtil.h Wed Jun  6 13:03:48 2012
@@ -214,9 +214,9 @@ class JNIUtil
  */
 
 #define SVN_JNI_NULL_PTR_EX(expr, str, ret_val) \
-  if (expr == NULL) {                           \
+  if ((expr) == NULL) {                         \
     JNIUtil::throwNullPointerException(str);    \
-    return ret_val ;                            \
+    return ret_val;                             \
   }
 
 /**
@@ -235,7 +235,7 @@ class JNIUtil
     svn_error_t *svn_jni_err__temp = (expr);            \
     if (svn_jni_err__temp != SVN_NO_ERROR) {            \
       JNIUtil::handleSVNError(svn_jni_err__temp);       \
-      return ret_val ;                                  \
+      return ret_val;                                   \
     }                                                   \
   } while (0)
 
@@ -251,7 +251,7 @@ class JNIUtil
   do                                    \
     {                                   \
       env->PopLocalFrame(NULL);         \
-      return ret_val ;                  \
+      return ret_val;                   \
     }                                   \
   while (0)
 
@@ -272,4 +272,12 @@ class JNIUtil
  */
 #define POP_AND_RETURN_NULL             POP_AND_RETURN(NULL)
 
+#define CPPADDR_NULL_PTR(expr, ret_val)                 \
+  do {                                                  \
+    if ((expr) == NULL) {                               \
+      JNIUtil::throwError(_("bad C++ this"));           \
+      return ret_val;                                   \
+    }                                                   \
+  } while (0)
+
 #endif  // JNIUTIL_H

Propchange: subversion/branches/ev2-export/subversion/include/private/svn_delta_private.h
------------------------------------------------------------------------------
    svn:eol-style = native

Modified: subversion/branches/ev2-export/subversion/libsvn_auth_kwallet/kwallet.cpp
URL: http://svn.apache.org/viewvc/subversion/branches/ev2-export/subversion/libsvn_auth_kwallet/kwallet.cpp?rev=1346869&r1=1346868&r2=1346869&view=diff
==============================================================================
--- subversion/branches/ev2-export/subversion/libsvn_auth_kwallet/kwallet.cpp (original)
+++ subversion/branches/ev2-export/subversion/libsvn_auth_kwallet/kwallet.cpp Wed Jun  6 13:03:48 2012
@@ -60,6 +60,9 @@
 /* KWallet simple provider, puts passwords in KWallet                    */
 /*-----------------------------------------------------------------------*/
 
+static int q_argc = 1;
+static char q_argv0[] = "svn"; // Build non-const char * from string constant
+static char *q_argv[] = { q_argv0 };
 
 static const char *
 get_application_name(apr_hash_t *parameters,
@@ -212,12 +215,11 @@ kwallet_password_get(svn_boolean_t *done
   QCoreApplication *app;
   if (! qApp)
     {
-      int argc = 1;
-      app = new QCoreApplication(argc, (char *[1]) {(char *) "svn"});
+      int argc = q_argc;
+      app = new QCoreApplication(argc, q_argv);
     }
 
-  KCmdLineArgs::init(1,
-                     (char *[1]) {(char *) "svn"},
+  KCmdLineArgs::init(q_argc, q_argv,
                      get_application_name(parameters, pool),
                      "subversion",
                      ki18n(get_application_name(parameters, pool)),
@@ -289,12 +291,11 @@ kwallet_password_set(svn_boolean_t *done
   QCoreApplication *app;
   if (! qApp)
     {
-      int argc = 1;
-      app = new QCoreApplication(argc, (char *[1]) {(char *) "svn"});
+      int argc = q_argc;
+      app = new QCoreApplication(argc, q_argv);
     }
 
-  KCmdLineArgs::init(1,
-                     (char *[1]) {(char *) "svn"},
+  KCmdLineArgs::init(q_argc, q_argv,
                      get_application_name(parameters, pool),
                      "subversion",
                      ki18n(get_application_name(parameters, pool)),

Modified: subversion/branches/ev2-export/subversion/libsvn_client/client.h
URL: http://svn.apache.org/viewvc/subversion/branches/ev2-export/subversion/libsvn_client/client.h?rev=1346869&r1=1346868&r2=1346869&view=diff
==============================================================================
--- subversion/branches/ev2-export/subversion/libsvn_client/client.h (original)
+++ subversion/branches/ev2-export/subversion/libsvn_client/client.h Wed Jun  6 13:03:48 2012
@@ -276,40 +276,6 @@ svn_client__ensure_ra_session_url(const 
                                   const char *session_url,
                                   apr_pool_t *pool);
 
-/* Return the path of ABSPATH_OR_URL relative to the repository root
-   in REL_PATH (URI-decoded), allocated in RESULT_POOL.
-   If INCLUDE_LEADING_SLASH is set, the returned result will have a leading
-   slash; otherwise, it will not.
-
-   REPOS_ROOT and RA_SESSION may be NULL if ABSPATH_OR_URL is a WC path,
-   otherwise at least one of them must be non-null.
-
-   CAUTION:  While having a leading slash on a so-called relative path
-   might work out well for functionality that interacts with
-   mergeinfo, it results in a relative path that cannot be naively
-   svn_path_join()'d with a repository root URL to provide a full URL.
-
-   Use SCRATCH_POOL for temporary allocations.
-*/
-svn_error_t *
-svn_client__path_relative_to_root(const char **rel_path,
-                                  svn_wc_context_t *wc_ctx,
-                                  const char *abspath_or_url,
-                                  const char *repos_root,
-                                  svn_boolean_t include_leading_slash,
-                                  svn_ra_session_t *ra_session,
-                                  apr_pool_t *result_pool,
-                                  apr_pool_t *scratch_pool);
-
-/* A default error handler for use with svn_wc_walk_entries3().  Returns
-   ERR in all cases. */
-svn_error_t *
-svn_client__default_walker_error_handler(const char *path,
-                                         svn_error_t *err,
-                                         void *walk_baton,
-                                         apr_pool_t *pool);
-
-
 /* ---------------------------------------------------------------- */
 
 /*** RA callbacks ***/

Modified: subversion/branches/ev2-export/subversion/libsvn_client/export.c
URL: http://svn.apache.org/viewvc/subversion/branches/ev2-export/subversion/libsvn_client/export.c?rev=1346869&r1=1346868&r2=1346869&view=diff
==============================================================================
--- subversion/branches/ev2-export/subversion/libsvn_client/export.c (original)
+++ subversion/branches/ev2-export/subversion/libsvn_client/export.c Wed Jun  6 13:03:48 2012
@@ -152,15 +152,31 @@ append_basename_if_dir(const char **appe
  * Set the destination file's 'executable' flag according to the source
  * file's 'svn:executable' property.
  */
+
+/* baton for export_node */
+struct export_info_baton
+{
+  const char *to_path;
+  const svn_opt_revision_t *revision;
+  svn_boolean_t ignore_keywords;
+  svn_boolean_t overwrite;
+  svn_wc_context_t *wc_ctx;
+  const char *native_eol;
+  svn_wc_notify_func2_t notify_func;
+  void *notify_baton;
+  const char *origin_abspath;
+  svn_boolean_t exported;
+};
+
+/* Export a file or directory. Implements svn_wc_status_func4_t */
 static svn_error_t *
-copy_one_versioned_file(const char *from_abspath,
-                        const char *to_abspath,
-                        svn_client_ctx_t *ctx,
-                        const svn_opt_revision_t *revision,
-                        const char *native_eol,
-                        svn_boolean_t ignore_keywords,
-                        apr_pool_t *scratch_pool)
+export_node(void *baton,
+            const char *local_abspath,
+            const svn_wc_status3_t *status,
+            apr_pool_t *scratch_pool)
 {
+  struct export_info_baton *eib = baton;
+  svn_wc_context_t *wc_ctx = eib->wc_ctx;
   apr_hash_t *kw = NULL;
   svn_subst_eol_style_t style;
   apr_hash_t *props;
@@ -172,19 +188,106 @@ copy_one_versioned_file(const char *from
   svn_stream_t *dst_stream;
   const char *dst_tmp;
   svn_error_t *err;
-  svn_boolean_t is_deleted;
-  svn_wc_context_t *wc_ctx = ctx->wc_ctx;
+  
+  const char *to_abspath = svn_dirent_join(
+                                eib->to_path,
+                                svn_dirent_skip_ancestor(eib->origin_abspath,
+                                                         local_abspath),
+                                scratch_pool);
 
-  SVN_ERR(svn_wc__node_is_status_deleted(&is_deleted, wc_ctx, from_abspath,
-                                         scratch_pool));
+  eib->exported = TRUE;
 
   /* Don't export 'deleted' files and directories unless it's a
      revision other than WORKING.  These files and directories
      don't really exist in WORKING. */
-  if (revision->kind == svn_opt_revision_working && is_deleted)
+  if (eib->revision->kind == svn_opt_revision_working
+      && status->node_status == svn_wc_status_deleted)
+    return SVN_NO_ERROR;
+
+  if (status->kind == svn_node_dir)
+    {
+      apr_fileperms_t perm = APR_OS_DEFAULT;
+
+      /* Try to make the new directory.  If this fails because the
+         directory already exists, check our FORCE flag to see if we
+         care. */
+
+      /* Keep the source directory's permissions if applicable.
+         Skip retrieving the umask on windows. Apr does not implement setting
+         filesystem privileges on Windows.
+         Retrieving the file permissions with APR_FINFO_PROT | APR_FINFO_OWNER
+         is documented to be 'incredibly expensive' */
+#ifndef WIN32
+      if (eib->revision->kind == svn_opt_revision_working)
+        {
+          apr_finfo_t finfo;
+          SVN_ERR(svn_io_stat(&finfo, local_abspath, APR_FINFO_PROT,
+                              scratch_pool));
+          perm = finfo.protection;
+        }
+#endif
+      err = svn_io_dir_make(to_abspath, perm, scratch_pool);
+      if (err)
+        {
+          if (! APR_STATUS_IS_EEXIST(err->apr_err))
+            return svn_error_trace(err);
+          if (! eib->overwrite)
+            SVN_ERR_W(err, _("Destination directory exists, and will not be "
+                             "overwritten unless forced"));
+          else
+            svn_error_clear(err);
+        }
+
+      if (eib->notify_func
+          && (strcmp(eib->origin_abspath, local_abspath) != 0))
+        {
+          svn_wc_notify_t *notify =
+              svn_wc_create_notify(to_abspath,
+                                   svn_wc_notify_update_add, scratch_pool);
+
+          notify->kind = svn_node_dir;
+          (eib->notify_func)(eib->notify_baton, notify, scratch_pool);
+        }
+
+      return SVN_NO_ERROR;
+    }
+  else if (status->kind != svn_node_file)
+    {
+      if (strcmp(eib->origin_abspath, local_abspath) != 0)
+        return SVN_NO_ERROR;
+
+      return svn_error_createf(SVN_ERR_WC_PATH_NOT_FOUND, NULL,
+                               _("The node '%s' was not found."),
+                               svn_dirent_local_style(local_abspath,
+                                                      scratch_pool));
+    }
+
+  if (status->file_external)
     return SVN_NO_ERROR;
 
-  if (revision->kind != svn_opt_revision_working)
+  /* Produce overwrite errors for the export root */
+  if (strcmp(local_abspath, eib->origin_abspath) == 0)
+    {
+      svn_node_kind_t to_kind;
+
+      SVN_ERR(svn_io_check_path(to_abspath, &to_kind, scratch_pool));
+
+      if ((to_kind == svn_node_file || to_kind == svn_node_unknown)
+          && !eib->overwrite)
+        return svn_error_createf(SVN_ERR_ILLEGAL_TARGET, NULL,
+                                 _("Destination file '%s' exists, and "
+                                   "will not be overwritten unless forced"),
+                                 svn_dirent_local_style(to_abspath,
+                                                        scratch_pool));
+      else if (to_kind == svn_node_dir)
+        return svn_error_createf(SVN_ERR_ILLEGAL_TARGET, NULL,
+                                 _("Destination '%s' exists. Cannot "
+                                   "overwrite directory with non-directory"),
+                                 svn_dirent_local_style(to_abspath,
+                                                        scratch_pool));
+    }
+
+  if (eib->revision->kind != svn_opt_revision_working)
     {
       /* Only export 'added' files when the revision is WORKING. This is not
          WORKING, so skip the 'added' files, since they didn't exist
@@ -209,28 +312,24 @@ copy_one_versioned_file(const char *from
 
          We get all this for free from evaluating SOURCE == NULL:
        */
-      SVN_ERR(svn_wc_get_pristine_contents2(&source, wc_ctx, from_abspath,
+      SVN_ERR(svn_wc_get_pristine_contents2(&source, wc_ctx, local_abspath,
                                             scratch_pool, scratch_pool));
       if (source == NULL)
         return SVN_NO_ERROR;
 
-      SVN_ERR(svn_wc_get_pristine_props(&props, wc_ctx, from_abspath,
+      SVN_ERR(svn_wc_get_pristine_props(&props, wc_ctx, local_abspath,
                                         scratch_pool, scratch_pool));
     }
   else
     {
-      svn_wc_status3_t *status;
-
       /* ### hmm. this isn't always a specialfile. this will simply open
          ### the file readonly if it is a regular file. */
-      SVN_ERR(svn_subst_read_specialfile(&source, from_abspath, scratch_pool,
+      SVN_ERR(svn_subst_read_specialfile(&source, local_abspath, scratch_pool,
                                          scratch_pool));
 
-      SVN_ERR(svn_wc_prop_list2(&props, wc_ctx, from_abspath, scratch_pool,
+      SVN_ERR(svn_wc_prop_list2(&props, wc_ctx, local_abspath, scratch_pool,
                                 scratch_pool));
-      SVN_ERR(svn_wc_status3(&status, wc_ctx, from_abspath, scratch_pool,
-                             scratch_pool));
-      if (status->text_status != svn_wc_status_normal)
+      if (status->node_status != svn_wc_status_normal)
         local_mod = TRUE;
     }
 
@@ -241,6 +340,7 @@ copy_one_versioned_file(const char *from
     {
       /* Create the destination as a special file, and copy the source
          details into the destination stream. */
+      /* ### And forget the notification */
       SVN_ERR(svn_subst_create_specialfile(&dst_stream, to_abspath,
                                            scratch_pool, scratch_pool));
       return svn_error_trace(
@@ -256,32 +356,27 @@ copy_one_versioned_file(const char *from
                             APR_HASH_KEY_STRING);
 
   if (eol_style)
-    SVN_ERR(get_eol_style(&style, &eol, eol_style->data, native_eol));
+    SVN_ERR(get_eol_style(&style, &eol, eol_style->data, eib->native_eol));
 
   if (local_mod)
     {
       /* Use the modified time from the working copy of
          the file */
-      SVN_ERR(svn_io_file_affected_time(&tm, from_abspath, scratch_pool));
+      SVN_ERR(svn_io_file_affected_time(&tm, local_abspath, scratch_pool));
     }
   else
     {
-      SVN_ERR(svn_wc__node_get_changed_info(NULL, &tm, NULL, wc_ctx,
-                                            from_abspath, scratch_pool,
-                                            scratch_pool));
+      tm = status->changed_date;
     }
 
   if (keywords)
     {
-      svn_revnum_t changed_rev;
+      svn_revnum_t changed_rev = status->changed_rev;
       const char *suffix;
-      const char *url;
-      const char *author;
-
-      SVN_ERR(svn_wc__node_get_changed_info(&changed_rev, NULL, &author,
-                                            wc_ctx, from_abspath, scratch_pool,
-                                            scratch_pool));
-
+      const char *url = svn_path_url_add_component2(status->repos_root_url,
+                                                    status->repos_relpath,
+                                                    scratch_pool);
+      const char *author = status->changed_author;
       if (local_mod)
         {
           /* For locally modified files, we'll append an 'M'
@@ -296,9 +391,6 @@ copy_one_versioned_file(const char *from
           suffix = "";
         }
 
-      SVN_ERR(svn_wc__node_get_url(&url, wc_ctx, from_abspath,
-                                   scratch_pool, scratch_pool));
-
       SVN_ERR(svn_subst_build_keywords2
               (&kw, keywords->data,
                apr_psprintf(scratch_pool, "%ld%s", changed_rev, suffix),
@@ -319,7 +411,7 @@ copy_one_versioned_file(const char *from
                                              eol,
                                              FALSE /* repair */,
                                              kw,
-                                             ! ignore_keywords /* expand */,
+                                             ! eib->ignore_keywords /* expand */,
                                              scratch_pool);
 
   /* ###: use cancel func/baton in place of NULL/NULL below. */
@@ -338,273 +430,17 @@ copy_one_versioned_file(const char *from
   /* Now that dst_tmp contains the translated data, do the atomic rename. */
   SVN_ERR(svn_io_file_rename(dst_tmp, to_abspath, scratch_pool));
 
-  if (ctx->notify_func2)
+  if (eib->notify_func)
     {
       svn_wc_notify_t *notify = svn_wc_create_notify(to_abspath,
                                       svn_wc_notify_update_add, scratch_pool);
       notify->kind = svn_node_file;
-      (*ctx->notify_func2)(ctx->notify_baton2, notify, scratch_pool);
+      (eib->notify_func)(eib->notify_baton, notify, scratch_pool);
     }
 
   return SVN_NO_ERROR;
 }
 
-/* Make an unversioned copy of the versioned file or directory tree at the
- * source path FROM_ABSPATH.  Copy it to the destination path TO_ABSPATH.
- *
- * If REVISION is svn_opt_revision_working, copy the working version,
- * otherwise copy the base version.
- *
- * See copy_one_versioned_file() for details of file copying behaviour,
- * including IGNORE_KEYWORDS and NATIVE_EOL.
- *
- * Include externals unless IGNORE_EXTERNALS is true.
- *
- * Recurse according to DEPTH.
- *
-
- */
-static svn_error_t *
-copy_versioned_files(const char *from_abspath,
-                     const char *to_abspath,
-                     const svn_opt_revision_t *revision,
-                     svn_boolean_t force,
-                     svn_boolean_t ignore_externals,
-                     svn_boolean_t ignore_keywords,
-                     svn_depth_t depth,
-                     const char *native_eol,
-                     svn_client_ctx_t *ctx,
-                     apr_pool_t *pool)
-{
-  svn_error_t *err;
-  apr_pool_t *iterpool;
-  const apr_array_header_t *children;
-  svn_node_kind_t from_kind;
-  svn_depth_t node_depth;
-
-  SVN_ERR_ASSERT(svn_dirent_is_absolute(from_abspath));
-  SVN_ERR_ASSERT(svn_dirent_is_absolute(to_abspath));
-
-  /* Only export 'added' and 'replaced' files when the revision is WORKING;
-     when the revision is BASE (i.e. != WORKING), only export 'added' and
-     'replaced' files when they are part of a copy-/move-here. Otherwise, skip
-     them, since they don't have an associated text-base. This condition for
-     added/replaced simply is an optimization. Added and replaced files would
-     be handled similarly by svn_wc_get_pristine_contents2(), which would
-     return NULL if they have no base associated.
-     TODO: We may prefer not to duplicate this condition and rather use
-     svn_wc_get_pristine_contents2() or a dedicated new function instead.
-
-     Don't export 'deleted' files and directories unless it's a
-     revision other than WORKING.  These files and directories
-     don't really exist in WORKING. */
-  if (revision->kind != svn_opt_revision_working)
-    {
-      svn_boolean_t is_added;
-      const char *repos_relpath;
-
-      SVN_ERR(svn_wc__node_get_origin(&is_added, NULL, &repos_relpath,
-                                      NULL, NULL, NULL,
-                                      ctx->wc_ctx, from_abspath, FALSE,
-                                      pool, pool));
-
-      if (is_added && !repos_relpath)
-        return SVN_NO_ERROR; /* Local addition */
-    }
-  else
-    {
-      svn_boolean_t is_deleted;
-
-      SVN_ERR(svn_wc__node_is_status_deleted(&is_deleted, ctx->wc_ctx,
-                                             from_abspath, pool));
-      if (is_deleted)
-        return SVN_NO_ERROR;
-    }
-
-  SVN_ERR(svn_wc_read_kind(&from_kind, ctx->wc_ctx, from_abspath, FALSE,
-                           pool));
-
-  if (from_kind == svn_node_dir)
-    {
-      apr_fileperms_t perm = APR_OS_DEFAULT;
-      int j;
-
-      /* Try to make the new directory.  If this fails because the
-         directory already exists, check our FORCE flag to see if we
-         care. */
-
-      /* Keep the source directory's permissions if applicable.
-         Skip retrieving the umask on windows. Apr does not implement setting
-         filesystem privileges on Windows.
-         Retrieving the file permissions with APR_FINFO_PROT | APR_FINFO_OWNER
-         is documented to be 'incredibly expensive' */
-#ifndef WIN32
-      if (revision->kind == svn_opt_revision_working)
-        {
-          apr_finfo_t finfo;
-          SVN_ERR(svn_io_stat(&finfo, from_abspath, APR_FINFO_PROT, pool));
-          perm = finfo.protection;
-        }
-#endif
-      err = svn_io_dir_make(to_abspath, perm, pool);
-      if (err)
-        {
-          if (! APR_STATUS_IS_EEXIST(err->apr_err))
-            return svn_error_trace(err);
-          if (! force)
-            SVN_ERR_W(err, _("Destination directory exists, and will not be "
-                             "overwritten unless forced"));
-          else
-            svn_error_clear(err);
-        }
-
-      SVN_ERR(svn_wc__node_get_children(&children, ctx->wc_ctx, from_abspath,
-                                        FALSE, pool, pool));
-
-      iterpool = svn_pool_create(pool);
-      for (j = 0; j < children->nelts; j++)
-        {
-          const char *child_abspath = APR_ARRAY_IDX(children, j, const char *);
-          const char *child_name = svn_dirent_basename(child_abspath, NULL);
-          const char *target_abspath;
-          svn_node_kind_t child_kind;
-
-          svn_pool_clear(iterpool);
-
-          if (ctx->cancel_func)
-            SVN_ERR(ctx->cancel_func(ctx->cancel_baton));
-
-          target_abspath = svn_dirent_join(to_abspath, child_name, iterpool);
-
-          SVN_ERR(svn_wc_read_kind(&child_kind, ctx->wc_ctx, child_abspath,
-                                   FALSE, iterpool));
-
-          if (child_kind == svn_node_dir)
-            {
-              if (depth == svn_depth_infinity
-                  || depth == svn_depth_immediates)
-                {
-                  if (ctx->notify_func2)
-                    {
-                      svn_wc_notify_t *notify =
-                          svn_wc_create_notify(target_abspath,
-                                               svn_wc_notify_update_add, pool);
-                      notify->kind = svn_node_dir;
-                      (*ctx->notify_func2)(ctx->notify_baton2, notify, pool);
-                    }
-
-                  if (depth == svn_depth_infinity)
-                    SVN_ERR(copy_versioned_files(child_abspath, target_abspath,
-                                                 revision, force,
-                                                 ignore_externals,
-                                                 ignore_keywords, depth,
-                                                 native_eol, ctx, iterpool));
-                  else
-                    SVN_ERR(svn_io_make_dir_recursively(target_abspath,
-                                                        iterpool));
-                }
-            }
-          else if (child_kind == svn_node_file
-                   && depth >= svn_depth_files)
-            {
-              svn_node_kind_t external_kind;
-
-              SVN_ERR(svn_wc__read_external_info(&external_kind,
-                                                 NULL, NULL, NULL,
-                                                 NULL, ctx->wc_ctx,
-                                                 child_abspath,
-                                                 child_abspath, TRUE,
-                                                 pool, pool));
-
-              if (external_kind != svn_node_file)
-                SVN_ERR(copy_one_versioned_file(child_abspath, target_abspath,
-                                                ctx, revision,
-                                                native_eol, ignore_keywords,
-                                                iterpool));
-            }
-        }
-
-      SVN_ERR(svn_wc__node_get_depth(&node_depth, ctx->wc_ctx,
-                                     from_abspath, pool));
-
-      /* Handle externals. */
-      if (! ignore_externals && depth == svn_depth_infinity
-          && node_depth == svn_depth_infinity)
-        {
-          apr_array_header_t *ext_items;
-          const svn_string_t *prop_val;
-
-          SVN_ERR(svn_wc_prop_get2(&prop_val, ctx->wc_ctx, from_abspath,
-                                   SVN_PROP_EXTERNALS, pool, pool));
-          if (prop_val != NULL)
-            {
-              int i;
-
-              SVN_ERR(svn_wc_parse_externals_description3(&ext_items,
-                                                          from_abspath,
-                                                          prop_val->data,
-                                                          FALSE, pool));
-              for (i = 0; i < ext_items->nelts; ++i)
-                {
-                  svn_wc_external_item2_t *ext_item;
-                  const char *new_from, *new_to;
-
-                  svn_pool_clear(iterpool);
-
-                  ext_item = APR_ARRAY_IDX(ext_items, i,
-                                           svn_wc_external_item2_t *);
-                  new_from = svn_dirent_join(from_abspath,
-                                             ext_item->target_dir,
-                                             iterpool);
-                  new_to = svn_dirent_join(to_abspath, ext_item->target_dir,
-                                           iterpool);
-
-                   /* The target dir might have parents that don't exist.
-                      Guarantee the path upto the last component. */
-                  if (!svn_dirent_is_root(ext_item->target_dir,
-                                          strlen(ext_item->target_dir)))
-                    {
-                      const char *parent = svn_dirent_dirname(new_to, iterpool);
-                      SVN_ERR(svn_io_make_dir_recursively(parent, iterpool));
-                    }
-
-                  SVN_ERR(copy_versioned_files(new_from, new_to,
-                                               revision, force, FALSE,
-                                               ignore_keywords,
-                                               svn_depth_infinity, native_eol,
-                                               ctx, iterpool));
-                }
-            }
-        }
-
-      svn_pool_destroy(iterpool);
-    }
-  else if (from_kind == svn_node_file)
-    {
-      svn_node_kind_t to_kind;
-
-      SVN_ERR(svn_io_check_path(to_abspath, &to_kind, pool));
-
-      if ((to_kind == svn_node_file || to_kind == svn_node_unknown) && ! force)
-        return svn_error_createf(SVN_ERR_ILLEGAL_TARGET, NULL,
-                                 _("Destination file '%s' exists, and "
-                                   "will not be overwritten unless forced"),
-                                 svn_dirent_local_style(to_abspath, pool));
-      else if (to_kind == svn_node_dir)
-        return svn_error_createf(SVN_ERR_ILLEGAL_TARGET, NULL,
-                                 _("Destination '%s' exists. Cannot "
-                                   "overwrite directory with non-directory"),
-                                 svn_dirent_local_style(to_abspath, pool));
-
-      SVN_ERR(copy_one_versioned_file(from_abspath, to_abspath, ctx,
-                                      revision, native_eol, ignore_keywords,
-                                      pool));
-    }
-
-  return SVN_NO_ERROR;
-}
-
-
 /* Abstraction of open_root.
  *
  * Create PATH if it does not exist and is not obstructed, and invoke
@@ -1097,7 +933,10 @@ svn_client_export5(svn_revnum_t *result_
     }
   else
     {
+      struct export_info_baton eib;
       svn_node_kind_t kind;
+      apr_hash_t *externals = NULL;
+
       /* This is a working copy export. */
       /* just copy the contents of the working copy into the target path. */
       SVN_ERR(svn_dirent_get_absolute(&from_path_or_url, from_path_or_url,
@@ -1141,14 +980,80 @@ svn_client_export5(svn_revnum_t *result_
        * For a start, to detect the source kind, it looks at what is on disk
        * rather than the versioned working or base node.
        */
-
       if (kind == svn_node_file)
         SVN_ERR(append_basename_if_dir(&to_path, from_path_or_url, FALSE,
                                        pool));
 
-      SVN_ERR(copy_versioned_files(from_path_or_url, to_path, revision,
-                                   overwrite, ignore_externals, ignore_keywords,
-                                   depth, native_eol, ctx, pool));
+      eib.to_path = to_path;
+      eib.revision = revision;
+      eib.overwrite = overwrite;
+      eib.ignore_keywords = ignore_keywords;
+      eib.wc_ctx = ctx->wc_ctx;
+      eib.native_eol = native_eol;
+      eib.notify_func = ctx->notify_func2;;
+      eib.notify_baton = ctx->notify_baton2;
+      eib.origin_abspath = from_path_or_url;
+      eib.exported = FALSE;
+
+      SVN_ERR(svn_wc_walk_status(ctx->wc_ctx, from_path_or_url, depth,
+                                 TRUE /* get_all */,
+                                 TRUE /* no_ignore */,
+                                 FALSE /* ignore_text_mods */,
+                                 NULL,
+                                 export_node, &eib,
+                                 ctx->cancel_func, ctx->cancel_baton,
+                                 pool));
+
+      if (!eib.exported)
+        return svn_error_createf(SVN_ERR_WC_PATH_NOT_FOUND, NULL,
+                                 _("The node '%s' was not found."),
+                                 svn_dirent_local_style(from_path_or_url,
+                                                        pool));
+
+      if (!ignore_externals)
+        SVN_ERR(svn_wc__externals_defined_below(&externals, ctx->wc_ctx,
+                                                from_path_or_url,
+                                                pool, pool));
+
+      if (externals && apr_hash_count(externals))
+        {
+          apr_pool_t *iterpool = svn_pool_create(pool);
+          apr_hash_index_t *hi;
+
+          for (hi = apr_hash_first(pool, externals);
+               hi;
+               hi = apr_hash_next(hi))
+            {
+              const char *external_abspath = svn__apr_hash_index_key(hi);
+              const char *relpath;
+              const char *target_abspath;
+
+              svn_pool_clear(iterpool);
+
+              relpath = svn_dirent_skip_ancestor(from_path_or_url,
+                                                 external_abspath);
+
+              target_abspath = svn_dirent_join(to_path, relpath,
+                                                         iterpool);
+
+              /* Ensure that the parent directory exists */
+              SVN_ERR(svn_io_make_dir_recursively(
+                            svn_dirent_dirname(target_abspath, iterpool),
+                            iterpool));
+
+              SVN_ERR(svn_client_export5(NULL,
+                                         svn_dirent_join(from_path_or_url,
+                                                         relpath,
+                                                         iterpool),
+                                         target_abspath,
+                                         peg_revision, revision,
+                                         TRUE, ignore_externals,
+                                         ignore_keywords, depth, native_eol,
+                                         ctx, iterpool));
+            }
+
+          svn_pool_destroy(iterpool);
+        }
     }
 
 

Modified: subversion/branches/ev2-export/subversion/libsvn_client/merge.c
URL: http://svn.apache.org/viewvc/subversion/branches/ev2-export/subversion/libsvn_client/merge.c?rev=1346869&r1=1346868&r2=1346869&view=diff
==============================================================================
--- subversion/branches/ev2-export/subversion/libsvn_client/merge.c (original)
+++ subversion/branches/ev2-export/subversion/libsvn_client/merge.c Wed Jun  6 13:03:48 2012
@@ -1776,6 +1776,7 @@ merge_file_added(svn_wc_notify_state_t *
   merge_cmd_baton_t *merge_b = baton;
   const char *mine_abspath = svn_dirent_join(merge_b->target->abspath,
                                              mine_relpath, scratch_pool);
+  svn_node_kind_t wc_kind;
   svn_node_kind_t kind;
   int i;
   apr_hash_t *file_props;
@@ -1834,7 +1835,7 @@ merge_file_added(svn_wc_notify_state_t *
     svn_wc_notify_state_t obstr_state;
 
     SVN_ERR(perform_obstruction_check(&obstr_state, NULL, NULL,
-                                      &kind,
+                                      &wc_kind,
                                       merge_b, mine_abspath, svn_node_unknown,
                                       scratch_pool));
 
@@ -1967,10 +1968,6 @@ merge_file_added(svn_wc_notify_state_t *
       if (content_state)
         {
           /* directory already exists, is it under version control? */
-          svn_node_kind_t wc_kind;
-          SVN_ERR(svn_wc_read_kind(&wc_kind, merge_b->ctx->wc_ctx,
-                                   mine_abspath, FALSE, scratch_pool));
-
           if ((wc_kind != svn_node_none)
               && dry_run_deleted_p(merge_b, mine_abspath))
             *content_state = svn_wc_notify_state_changed;
@@ -8856,7 +8853,7 @@ do_directory_merge(svn_mergeinfo_catalog
  * repository, or by allocating a new *RA_SESSION in POOL.
  * (RA_SESSION itself cannot be null, of course.)
  *
- * CTX is used as for svn_client__open_ra_session_internal().
+ * CTX is used as for svn_client_open_ra_session().
  */
 static svn_error_t *
 ensure_ra_session_url(svn_ra_session_t **ra_session,
@@ -8876,8 +8873,7 @@ ensure_ra_session_url(svn_ra_session_t *
   if (! *ra_session || (err && err->apr_err == SVN_ERR_RA_ILLEGAL_URL))
     {
       svn_error_clear(err);
-      err = svn_client__open_ra_session_internal(ra_session, NULL, url, NULL,
-                                                 NULL, FALSE, TRUE, ctx, pool);
+      err = svn_client_open_ra_session(ra_session, url, ctx, pool);
     }
   SVN_ERR(err);
 
@@ -8944,6 +8940,7 @@ do_merge(apr_hash_t **modified_subtrees,
          svn_mergeinfo_catalog_t result_catalog,
          const apr_array_header_t *merge_sources,
          const merge_target_t *target,
+         svn_ra_session_t *src_session,
          svn_boolean_t sources_related,
          svn_boolean_t same_repos,
          svn_boolean_t ignore_ancestry,
@@ -8967,6 +8964,7 @@ do_merge(apr_hash_t **modified_subtrees,
   int i;
   svn_boolean_t checked_mergeinfo_capability = FALSE;
   svn_ra_session_t *ra_session1 = NULL, *ra_session2 = NULL;
+  const char *old_src_session_url = NULL;
   apr_pool_t *iterpool;
 
   SVN_ERR_ASSERT(svn_dirent_is_absolute(target->abspath));
@@ -9059,6 +9057,13 @@ do_merge(apr_hash_t **modified_subtrees,
   notify_baton.merge_b = &merge_cmd_baton;
   notify_baton.pool = result_pool;
 
+  if (src_session)
+    {
+      SVN_ERR(svn_ra_get_session_url(src_session, &old_src_session_url,
+                                     scratch_pool));
+      ra_session1 = src_session;
+    }
+
   for (i = 0; i < merge_sources->nelts; i++)
     {
       merge_source_t *source =
@@ -9162,6 +9167,9 @@ do_merge(apr_hash_t **modified_subtrees,
   /* Let everyone know we're finished here. */
   notify_merge_completed(target->abspath, ctx, iterpool);
 
+  if (src_session)
+    SVN_ERR(svn_ra_reparent(src_session, old_src_session_url, iterpool));
+
   svn_pool_destroy(iterpool);
   return SVN_NO_ERROR;
 }
@@ -9233,7 +9241,7 @@ merge_cousins_and_supplement_mergeinfo(c
       modified_subtrees = apr_hash_make(scratch_pool);
       APR_ARRAY_PUSH(faux_sources, const merge_source_t *) = source;
       SVN_ERR(do_merge(&modified_subtrees, NULL, faux_sources, target,
-                       TRUE, same_repos,
+                       URL1_ra_session, TRUE, same_repos,
                        ignore_ancestry, force, dry_run, FALSE, NULL, TRUE,
                        FALSE, depth, merge_options, use_sleep, ctx,
                        scratch_pool, subpool));
@@ -9265,14 +9273,14 @@ merge_cousins_and_supplement_mergeinfo(c
       notify_mergeinfo_recording(target->abspath, NULL, ctx, scratch_pool);
       svn_pool_clear(subpool);
       SVN_ERR(do_merge(NULL, add_result_catalog, add_sources, target,
-                       TRUE, same_repos,
+                       URL1_ra_session, TRUE, same_repos,
                        ignore_ancestry, force, dry_run, TRUE,
                        modified_subtrees, TRUE,
                        TRUE, depth, merge_options, use_sleep, ctx,
                        scratch_pool, subpool));
       svn_pool_clear(subpool);
       SVN_ERR(do_merge(NULL, remove_result_catalog, remove_sources, target,
-                       TRUE, same_repos,
+                       URL1_ra_session, TRUE, same_repos,
                        ignore_ancestry, force, dry_run, TRUE,
                        modified_subtrees, TRUE,
                        TRUE, depth, merge_options, use_sleep, ctx,
@@ -9641,7 +9649,7 @@ merge_locked(const char *source1,
     }
 
   err = do_merge(NULL, NULL, merge_sources, target,
-                 related, same_repos,
+                 ra_session1, related, same_repos,
                  ignore_ancestry, force, dry_run,
                  record_only, NULL, FALSE, FALSE, depth, merge_options,
                  &use_sleep, ctx, scratch_pool, scratch_pool);
@@ -10435,23 +10443,21 @@ calculate_left_hand_side(svn_client__pat
        hi;
        hi = apr_hash_next(hi))
     {
-      const char *absolute_path = svn__apr_hash_index_key(hi);
+      const char *local_abspath = svn__apr_hash_index_key(hi);
       svn_client__pathrev_t *target_child;
-      const char *path_rel_to_root;
+      const char *repos_relpath;
       svn_mergeinfo_t target_history_as_mergeinfo;
 
       svn_pool_clear(iterpool);
 
       /* Convert the absolute path with mergeinfo on it to a path relative
          to the session root. */
-      SVN_ERR(svn_client__path_relative_to_root(&path_rel_to_root,
-                                                ctx->wc_ctx, absolute_path,
-                                                NULL, FALSE,
-                                                NULL, scratch_pool,
-                                                iterpool));
+      SVN_ERR(svn_wc__node_get_repos_relpath(&repos_relpath,
+                                             ctx->wc_ctx, local_abspath,
+                                             scratch_pool, iterpool));
       target_child = svn_client__pathrev_create_with_relpath(
                        target->loc.repos_root_url, target->loc.repos_uuid,
-                       target->loc.rev, path_rel_to_root, iterpool);
+                       target->loc.rev, repos_relpath, iterpool);
       SVN_ERR(svn_client__get_history_as_mergeinfo(&target_history_as_mergeinfo,
                                                    NULL /* has_rev_zero_hist */,
                                                    target_child,
@@ -10460,8 +10466,7 @@ calculate_left_hand_side(svn_client__pat
                                                    target_ra_session,
                                                    ctx, scratch_pool));
 
-      apr_hash_set(target_history_hash,
-                   apr_pstrdup(scratch_pool, path_rel_to_root),
+      apr_hash_set(target_history_hash, repos_relpath,
                    APR_HASH_KEY_STRING, target_history_as_mergeinfo);
     }
 
@@ -10730,10 +10735,9 @@ open_reintegrate_source_and_target(svn_r
   SVN_ERR(open_target_wc(&target, target_abspath,
                          FALSE, FALSE, FALSE,
                          ctx, scratch_pool, scratch_pool));
-  SVN_ERR(svn_client__open_ra_session_internal(target_ra_session_p, NULL,
-                                               target->loc.url,
-                                               NULL, NULL, FALSE, FALSE,
-                                               ctx, scratch_pool));
+  SVN_ERR(svn_client_open_ra_session(target_ra_session_p,
+                                     target->loc.url,
+                                     ctx, scratch_pool));
   if (! target->loc.url)
     return svn_error_createf(SVN_ERR_CLIENT_UNRELATED_RESOURCES, NULL,
                              _("Can't reintegrate into '%s' because it is "
@@ -10926,42 +10930,41 @@ merge_peg_locked(const char *source_path
 
   SVN_ERR_ASSERT(svn_dirent_is_absolute(target_abspath));
 
+  /* Create a short lived session pool */
+  sesspool = svn_pool_create(scratch_pool);
+
   SVN_ERR(open_target_wc(&target, target_abspath,
                          allow_mixed_rev, TRUE, TRUE,
-                         ctx, scratch_pool, scratch_pool));
+                         ctx, sesspool, sesspool));
 
   /* Open an RA session to our source URL, and determine its root URL. */
-  sesspool = svn_pool_create(scratch_pool);
   SVN_ERR(open_source_session(&source_loc, &ra_session,
                               source_path_or_url, source_peg_revision,
-                              ctx, sesspool, scratch_pool));
+                              ctx, sesspool, sesspool));
 
   /* Normalize our merge sources. */
   SVN_ERR(normalize_merge_sources(&merge_sources, source_path_or_url,
                                   source_loc,
                                   ranges_to_merge, ra_session, ctx,
-                                  scratch_pool, scratch_pool));
+                                  sesspool, sesspool));
 
   /* Check for same_repos. */
   same_repos = is_same_repos(&target->loc, source_loc, TRUE /* strict_urls */);
 
-  /* We're done with our little RA session. */
-  svn_pool_destroy(sesspool);
-
   /* Do the real merge!  (We say with confidence that our merge
      sources are both ancestral and related.) */
-  err = do_merge(NULL, NULL, merge_sources, target,
+  err = do_merge(NULL, NULL, merge_sources, target, ra_session,
                  TRUE, same_repos, ignore_ancestry, force, dry_run,
                  record_only, NULL, FALSE, FALSE, depth, merge_options,
-                 &use_sleep, ctx, scratch_pool, scratch_pool);
+                 &use_sleep, ctx, sesspool, sesspool);
 
   if (use_sleep)
-    svn_io_sleep_for_timestamps(target_abspath, scratch_pool);
+    svn_io_sleep_for_timestamps(target_abspath, sesspool);
 
-  if (err)
-    return svn_error_trace(err);
+  /* We're done with our RA session. */
+  svn_pool_destroy(sesspool);
 
-  return SVN_NO_ERROR;
+  return svn_error_trace(err);
 }
 
 svn_error_t *
@@ -11596,7 +11599,7 @@ do_symmetric_merge_locked(const svn_clie
       merge_sources = apr_array_make(scratch_pool, 1, sizeof(merge_source_t *));
       APR_ARRAY_PUSH(merge_sources, const merge_source_t *) = &source;
 
-      err = do_merge(NULL, NULL, merge_sources, target,
+      err = do_merge(NULL, NULL, merge_sources, target, NULL,
                      TRUE /*related*/,
                      TRUE /*same_repos*/, ignore_ancestry, force, dry_run,
                      record_only, NULL, FALSE, FALSE, depth, merge_options,

Modified: subversion/branches/ev2-export/subversion/libsvn_client/mergeinfo.c
URL: http://svn.apache.org/viewvc/subversion/branches/ev2-export/subversion/libsvn_client/mergeinfo.c?rev=1346869&r1=1346868&r2=1346869&view=diff
==============================================================================
--- subversion/branches/ev2-export/subversion/libsvn_client/mergeinfo.c (original)
+++ subversion/branches/ev2-export/subversion/libsvn_client/mergeinfo.c Wed Jun  6 13:03:48 2012
@@ -373,7 +373,6 @@ svn_client__get_wc_mergeinfo_catalog(svn
   const char *target_repos_rel_path;
   svn_mergeinfo_t mergeinfo;
   const char *repos_root;
-  svn_node_kind_t kind;
 
   SVN_ERR_ASSERT(svn_dirent_is_absolute(local_abspath));
   *mergeinfo_cat = NULL;
@@ -389,12 +388,9 @@ svn_client__get_wc_mergeinfo_catalog(svn
       return SVN_NO_ERROR;
     }
 
-  SVN_ERR(svn_client__path_relative_to_root(&target_repos_rel_path,
-                                            ctx->wc_ctx,
-                                            local_abspath,
-                                            NULL, FALSE,
-                                            NULL, scratch_pool,
-                                            scratch_pool));
+  SVN_ERR(svn_wc__node_get_repos_relpath(&target_repos_rel_path,
+                                         ctx->wc_ctx, local_abspath,
+                                         scratch_pool, scratch_pool));
 
   /* Get the mergeinfo for the LOCAL_ABSPATH target and set *INHERITED and
      *WALKED_PATH. */
@@ -414,38 +410,37 @@ svn_client__get_wc_mergeinfo_catalog(svn
     }
 
   /* If LOCAL_ABSPATH is a directory and we want the subtree mergeinfo too,
-     then get it. */
-  SVN_ERR(svn_wc_read_kind(&kind, ctx->wc_ctx, local_abspath, FALSE,
-                           scratch_pool));
-  if (kind == svn_node_dir && include_descendants)
+     then get it.
+
+     With WC-NG it is cheaper to do a single db transaction, than first
+     looking if we really have a directory. */
+  if (include_descendants)
     {
       apr_hash_t *mergeinfo_props;
       apr_hash_index_t *hi;
-      svn_opt_revision_t opt;
-
-      opt.kind = svn_opt_revision_unspecified;
 
-      SVN_ERR(svn_client_propget4(&mergeinfo_props,
-                                  SVN_PROP_MERGEINFO,
-                                  local_abspath,
-                                  &opt, &opt,
-                                  NULL, svn_depth_infinity, NULL,
-                                  ctx, scratch_pool, scratch_pool));
+      SVN_ERR(svn_wc__prop_retrieve_recursive(&mergeinfo_props,
+                                              ctx->wc_ctx, local_abspath,
+                                              SVN_PROP_MERGEINFO,
+                                              scratch_pool, scratch_pool));
 
       /* Convert *mergeinfo_props into a proper svn_mergeinfo_catalog_t */
       for (hi = apr_hash_first(scratch_pool, mergeinfo_props);
            hi;
            hi = apr_hash_next(hi))
         {
-          const char *key_path = svn__apr_hash_index_key(hi);
+          const char *node_abspath = svn__apr_hash_index_key(hi);
           svn_string_t *propval = svn__apr_hash_index_val(hi);
           svn_mergeinfo_t subtree_mergeinfo;
+          const char *repos_relpath;
+
+          if (strcmp(node_abspath, local_abspath) == 0)
+            continue; /* Already parsed in svn_client__get_wc_mergeinfo */
+
+          SVN_ERR(svn_wc__node_get_repos_relpath(&repos_relpath,
+                                                 ctx->wc_ctx, node_abspath,
+                                                 result_pool, scratch_pool));
 
-          SVN_ERR(svn_client__path_relative_to_root(&key_path, ctx->wc_ctx,
-                                                    key_path,
-                                                    NULL, FALSE,
-                                                    NULL, result_pool,
-                                                    scratch_pool));
           SVN_ERR(svn_mergeinfo_parse(&subtree_mergeinfo, propval->data,
                                       result_pool));
 
@@ -455,7 +450,7 @@ svn_client__get_wc_mergeinfo_catalog(svn
           if (*mergeinfo_cat == NULL)
             *mergeinfo_cat = apr_hash_make(result_pool);
 
-          apr_hash_set(*mergeinfo_cat, key_path,
+          apr_hash_set(*mergeinfo_cat, repos_relpath,
                        APR_HASH_KEY_STRING, subtree_mergeinfo);
         }
     }
@@ -1596,17 +1591,23 @@ svn_client_mergeinfo_get_merged(apr_hash
                         peg_revision, FALSE, FALSE, ctx, pool, pool));
   if (mergeinfo_cat)
     {
-      const char *path_or_url_repos_rel;
+      const char *repos_relpath;
+
+      if (! svn_path_is_url(path_or_url))
+        {
+          SVN_ERR(svn_dirent_get_absolute(&path_or_url, path_or_url, pool));
+          SVN_ERR(svn_wc__node_get_repos_relpath(&repos_relpath,
+                                                 ctx->wc_ctx, path_or_url,
+                                                 pool, pool));
+        }
+      else
+        {
+          repos_relpath = svn_uri_skip_ancestor(repos_root, path_or_url, pool);
 
-      if (! svn_path_is_url(path_or_url)
-          && ! svn_dirent_is_absolute(path_or_url))
-        SVN_ERR(svn_dirent_get_absolute(&path_or_url, path_or_url, pool));
-
-      SVN_ERR(svn_client__path_relative_to_root(&path_or_url_repos_rel,
-                                                ctx->wc_ctx, path_or_url,
-                                                repos_root, FALSE, NULL,
-                                                pool, pool));
-      mergeinfo = apr_hash_get(mergeinfo_cat, path_or_url_repos_rel,
+          SVN_ERR_ASSERT(repos_relpath != NULL); /* Or get_mergeinfo failed */
+        }
+
+      mergeinfo = apr_hash_get(mergeinfo_cat, repos_relpath,
                                APR_HASH_KEY_STRING);
     }
   else
@@ -1673,15 +1674,19 @@ svn_client_mergeinfo_log(svn_boolean_t f
                         ctx, scratch_pool, scratch_pool));
 
   if (!svn_path_is_url(target_path_or_url))
-    SVN_ERR(svn_dirent_get_absolute(&target_path_or_url, target_path_or_url, scratch_pool));
+    {
+      SVN_ERR(svn_dirent_get_absolute(&target_path_or_url, target_path_or_url, scratch_pool));
+      SVN_ERR(svn_wc__node_get_repos_relpath(&target_repos_rel,
+                                             ctx->wc_ctx, target_path_or_url,
+                                             scratch_pool, scratch_pool));
+    }
+  else
+    {
+      target_repos_rel = svn_uri_skip_ancestor(repos_root, target_path_or_url,
+                                               scratch_pool);
 
-  SVN_ERR(svn_client__path_relative_to_root(&target_repos_rel,
-                                            ctx->wc_ctx,
-                                            target_path_or_url,
-                                            repos_root,
-                                            FALSE /* leading_slash */, NULL,
-                                            scratch_pool,
-                                            scratch_pool));
+      SVN_ERR_ASSERT(target_repos_rel != NULL); /* Or get_mergeinfo should have failed */
+    }
 
   if (!target_mergeinfo_cat)
     {

Modified: subversion/branches/ev2-export/subversion/libsvn_client/ra.c
URL: http://svn.apache.org/viewvc/subversion/branches/ev2-export/subversion/libsvn_client/ra.c?rev=1346869&r1=1346868&r2=1346869&view=diff
==============================================================================
--- subversion/branches/ev2-export/subversion/libsvn_client/ra.c (original)
+++ subversion/branches/ev2-export/subversion/libsvn_client/ra.c Wed Jun  6 13:03:48 2012
@@ -492,7 +492,8 @@ svn_client__ra_session_from_path2(svn_ra
                                                initial_url,
                                                base_dir_abspath, NULL,
                                                base_dir_abspath != NULL,
-                                               FALSE, ctx, pool));
+                                               base_dir_abspath == NULL,
+                                               ctx, pool));
 
   /* If we got a CORRECTED_URL, we'll want to refer to that as the
      URL-ized form of PATH_OR_URL from now on. */

Modified: subversion/branches/ev2-export/subversion/libsvn_client/util.c
URL: http://svn.apache.org/viewvc/subversion/branches/ev2-export/subversion/libsvn_client/util.c?rev=1346869&r1=1346868&r2=1346869&view=diff
==============================================================================
--- subversion/branches/ev2-export/subversion/libsvn_client/util.c (original)
+++ subversion/branches/ev2-export/subversion/libsvn_client/util.c Wed Jun  6 13:03:48 2012
@@ -169,69 +169,6 @@ svn_client_commit_item3_dup(const svn_cl
 }
 
 svn_error_t *
-svn_client__path_relative_to_root(const char **rel_path,
-                                  svn_wc_context_t *wc_ctx,
-                                  const char *abspath_or_url,
-                                  const char *repos_root,
-                                  svn_boolean_t include_leading_slash,
-                                  svn_ra_session_t *ra_session,
-                                  apr_pool_t *result_pool,
-                                  apr_pool_t *scratch_pool)
-{
-  const char *repos_relpath;
-
-  /* If we have a WC path... */
-  if (! svn_path_is_url(abspath_or_url))
-    {
-      /* ... query it directly. */
-      SVN_ERR(svn_wc__node_get_repos_relpath(&repos_relpath,
-                                             wc_ctx,
-                                             abspath_or_url,
-                                             result_pool,
-                                             scratch_pool));
-
-      SVN_ERR_ASSERT(repos_relpath != NULL);
-    }
-  else if (repos_root != NULL)
-    {
-      repos_relpath = svn_uri_skip_ancestor(repos_root, abspath_or_url,
-                                            result_pool);
-      if (!repos_relpath)
-        return svn_error_createf(SVN_ERR_CLIENT_UNRELATED_RESOURCES, NULL,
-                                 _("URL '%s' is not a child of repository "
-                                   "root URL '%s'"),
-                                 abspath_or_url, repos_root);
-    }
-  else
-    {
-      svn_error_t *err;
-
-      SVN_ERR_ASSERT(ra_session != NULL);
-
-      /* Ask the RA layer to create a relative path for us */
-      err = svn_ra_get_path_relative_to_root(ra_session, &repos_relpath,
-                                             abspath_or_url, scratch_pool);
-
-      if (err)
-        {
-          if (err->apr_err == SVN_ERR_RA_ILLEGAL_URL)
-            return svn_error_createf(SVN_ERR_CLIENT_UNRELATED_RESOURCES, err,
-                                     _("URL '%s' is not inside repository"),
-                                     abspath_or_url);
-
-          return svn_error_trace(err);
-        }
-    }
-
-  if (include_leading_slash)
-    *rel_path = apr_pstrcat(result_pool, "/", repos_relpath, NULL);
-  else
-    *rel_path = repos_relpath;
-
-   return SVN_NO_ERROR;
-}
-
-svn_error_t *
 svn_client__wc_node_get_base(svn_client__pathrev_t **base_p,
                                const char *wc_abspath,
                                svn_client_ctx_t *ctx,
@@ -325,17 +262,6 @@ svn_client_get_repos_root(const char **r
   return SVN_NO_ERROR;
 }
 
-
-svn_error_t *
-svn_client__default_walker_error_handler(const char *path,
-                                         svn_error_t *err,
-                                         void *walk_baton,
-                                         apr_pool_t *pool)
-{
-  return svn_error_trace(err);
-}
-
-
 const svn_opt_revision_t *
 svn_cl__rev_default_to_head_or_base(const svn_opt_revision_t *revision,
                                     const char *path_or_url)

Propchange: subversion/branches/ev2-export/subversion/libsvn_delta/deprecated.c
------------------------------------------------------------------------------
    svn:eol-style = native

Modified: subversion/branches/ev2-export/subversion/libsvn_fs/editor.c
URL: http://svn.apache.org/viewvc/subversion/branches/ev2-export/subversion/libsvn_fs/editor.c?rev=1346869&r1=1346868&r2=1346869&view=diff
==============================================================================
--- subversion/branches/ev2-export/subversion/libsvn_fs/editor.c (original)
+++ subversion/branches/ev2-export/subversion/libsvn_fs/editor.c Wed Jun  6 13:03:48 2012
@@ -214,7 +214,7 @@ can_modify(svn_fs_root_t *txn_root,
   if (!SVN_IS_VALID_REVNUM(revision))
     /* ### use a custom error code?  */
     return svn_error_createf(SVN_ERR_INCORRECT_PARAMS, NULL,
-                             N_("Revision for modifying '%s' is required"),
+                             _("Revision for modifying '%s' is required"),
                              fspath);
 #endif
 
@@ -451,7 +451,7 @@ add_absent_cb(void *baton,
   /* ### use a custom error code  */
   return svn_error_create(
            SVN_ERR_UNSUPPORTED_FEATURE, NULL,
-           N_("The filesystem does not support 'absent' nodes"));
+           _("The filesystem does not support 'absent' nodes"));
 }
 
 

Propchange: subversion/branches/ev2-export/subversion/libsvn_fs/editor.c
------------------------------------------------------------------------------
    svn:eol-style = native

Modified: subversion/branches/ev2-export/subversion/libsvn_fs_fs/fs_fs.c
URL: http://svn.apache.org/viewvc/subversion/branches/ev2-export/subversion/libsvn_fs_fs/fs_fs.c?rev=1346869&r1=1346868&r2=1346869&view=diff
==============================================================================
--- subversion/branches/ev2-export/subversion/libsvn_fs_fs/fs_fs.c (original)
+++ subversion/branches/ev2-export/subversion/libsvn_fs_fs/fs_fs.c Wed Jun  6 13:03:48 2012
@@ -935,12 +935,12 @@ read_format(int *pformat, int *max_files
             const char *path, apr_pool_t *pool)
 {
   svn_error_t *err;
-  apr_file_t *file;
-  char buf[80];
-  apr_size_t len;
+  svn_stream_t *stream;
+  svn_stringbuf_t *content;
+  svn_stringbuf_t *buf;
+  svn_boolean_t eos = FALSE;
 
-  err = svn_io_file_open(&file, path, APR_READ | APR_BUFFERED,
-                         APR_OS_DEFAULT, pool);
+  err = svn_stringbuf_from_file2(&content, path, pool);
   if (err && APR_STATUS_IS_ENOENT(err->apr_err))
     {
       /* Treat an absent format file as format 1.  Do not try to
@@ -958,62 +958,54 @@ read_format(int *pformat, int *max_files
     }
   SVN_ERR(err);
 
-  len = sizeof(buf);
-  err = svn_io_read_length_line(file, buf, &len, pool);
-  if (err && APR_STATUS_IS_EOF(err->apr_err))
+  stream = svn_stream_from_stringbuf(content, pool);
+  SVN_ERR(svn_stream_readline(stream, &buf, "\n", &eos, pool));
+  if (buf->len == 0 && eos)
     {
       /* Return a more useful error message. */
-      svn_error_clear(err);
       return svn_error_createf(SVN_ERR_BAD_VERSION_FILE_FORMAT, NULL,
                                _("Can't read first line of format file '%s'"),
                                svn_dirent_local_style(path, pool));
     }
-  SVN_ERR(err);
 
   /* Check that the first line contains only digits. */
-  SVN_ERR(check_format_file_buffer_numeric(buf, 0, path, pool));
-  SVN_ERR(svn_cstring_atoi(pformat, buf));
+  SVN_ERR(check_format_file_buffer_numeric(buf->data, 0, path, pool));
+  SVN_ERR(svn_cstring_atoi(pformat, buf->data));
 
   /* Set the default values for anything that can be set via an option. */
   *max_files_per_dir = 0;
 
   /* Read any options. */
-  while (1)
+  while (!eos)
     {
-      len = sizeof(buf);
-      err = svn_io_read_length_line(file, buf, &len, pool);
-      if (err && APR_STATUS_IS_EOF(err->apr_err))
-        {
-          /* No more options; that's okay. */
-          svn_error_clear(err);
-          break;
-        }
-      SVN_ERR(err);
+      SVN_ERR(svn_stream_readline(stream, &buf, "\n", &eos, pool));
+      if (buf->len == 0)
+        break;
 
       if (*pformat >= SVN_FS_FS__MIN_LAYOUT_FORMAT_OPTION_FORMAT &&
-          strncmp(buf, "layout ", 7) == 0)
+          strncmp(buf->data, "layout ", 7) == 0)
         {
-          if (strcmp(buf+7, "linear") == 0)
+          if (strcmp(buf->data + 7, "linear") == 0)
             {
               *max_files_per_dir = 0;
               continue;
             }
 
-          if (strncmp(buf+7, "sharded ", 8) == 0)
+          if (strncmp(buf->data + 7, "sharded ", 8) == 0)
             {
               /* Check that the argument is numeric. */
-              SVN_ERR(check_format_file_buffer_numeric(buf, 15, path, pool));
-              SVN_ERR(svn_cstring_atoi(max_files_per_dir, buf + 15));
+              SVN_ERR(check_format_file_buffer_numeric(buf->data, 15, path, pool));
+              SVN_ERR(svn_cstring_atoi(max_files_per_dir, buf->data + 15));
               continue;
             }
         }
 
       return svn_error_createf(SVN_ERR_BAD_VERSION_FILE_FORMAT, NULL,
          _("'%s' contains invalid filesystem format option '%s'"),
-         svn_dirent_local_style(path, pool), buf);
+         svn_dirent_local_style(path, pool), buf->data);
     }
 
-  return svn_io_file_close(file, pool);
+  return SVN_NO_ERROR;
 }
 
 /* Write the format number and maximum number of files per directory
@@ -2810,6 +2802,9 @@ svn_fs_fs__rev_get_root(svn_fs_id_t **ro
 
 /* Revprop caching management.
  *
+ * Mechanism:
+ * ----------
+ * 
  * Revprop caching needs to be activated and will be deactivated for the
  * respective FS instance if the necessary infrastructure could not be
  * initialized.  In deactivated mode, there is almost no runtime overhead
@@ -2835,6 +2830,27 @@ svn_fs_fs__rev_get_root(svn_fs_id_t **ro
  *
  * The overhead for the second and following accesses to revprops is
  * almost zero on most systems.
+ *
+ *
+ * Tech aspects:
+ * -------------
+ *
+ * A problem is that we need to provide a globally available file name to
+ * back the SHM implementation on OSes that need it.  We can only assume
+ * write access to some file within the respective repositories.  Because
+ * a given server process may access thousands of repositories during its
+ * lifetime, keeping the SHM data alive for all of them is also not an
+ * option.
+ *
+ * So, we store the new revprop generation on disk as part of each
+ * setrevprop call, i.e. this write will be serialized and the write order
+ * be guaranteed by the repository write lock.
+ *
+ * The only racy situation occurs when the data is being read again by two
+ * processes concurrently but in that situation, the first process to
+ * finish that procedure is guaranteed to be the only one that initializes
+ * the SHM data.  Since even writers will first go through that
+ * initialization phase, they will never operate on stale data.
  */
 
 /* Read revprop generation as stored on disk for repository FS. The result
@@ -4160,7 +4176,14 @@ unparse_dir_entries(apr_hash_t **str_ent
 {
   apr_hash_index_t *hi;
 
-  *str_entries_p = apr_hash_make(pool);
+  /* For now, we use a our own hash function to ensure that we get a
+   * (largely) stable order when serializing the data.  It also gives
+   * us some performance improvement.
+   *
+   * ### TODO ###
+   * Use some sorted or other fixed order data container.
+   */
+  *str_entries_p = svn_hash__make(pool);
 
   for (hi = apr_hash_first(pool, entries); hi; hi = apr_hash_next(hi))
     {
@@ -6177,7 +6200,7 @@ write_hash_handler(void *baton,
    well as SHA1 in REP.   If rep sharing has been enabled and REPS_HASH
    is not NULL, it will be used in addition to the on-disk cache to find
    earlier reps with the same content.  When such existing reps can be
-   found,  we will truncate the one just written from the file and return
+   found, we will truncate the one just written from the file and return
    the existing rep.  Perform temporary allocations in POOL. */
 static svn_error_t *
 write_hash_rep(representation_t *rep,

Modified: subversion/branches/ev2-export/subversion/libsvn_fs_fs/lock.c
URL: http://svn.apache.org/viewvc/subversion/branches/ev2-export/subversion/libsvn_fs_fs/lock.c?rev=1346869&r1=1346868&r2=1346869&view=diff
==============================================================================
--- subversion/branches/ev2-export/subversion/libsvn_fs_fs/lock.c (original)
+++ subversion/branches/ev2-export/subversion/libsvn_fs_fs/lock.c Wed Jun  6 13:03:48 2012
@@ -477,23 +477,31 @@ delete_lock(svn_fs_t *fs,
 
 /* Set *LOCK_P to the lock for PATH in FS.  HAVE_WRITE_LOCK should be
    TRUE if the caller (or one of its callers) has taken out the
-   repository-wide write lock, FALSE otherwise.  Use POOL for
-   allocations. */
+   repository-wide write lock, FALSE otherwise.  If MUST_EXIST is
+   not set, the function will simply return NULL in *LOCK_P instead
+   of creating an SVN_FS__ERR_NO_SUCH_LOCK error in case the lock
+   was not found (much faster).  Use POOL for allocations. */
 static svn_error_t *
 get_lock(svn_lock_t **lock_p,
          svn_fs_t *fs,
          const char *path,
          svn_boolean_t have_write_lock,
+         svn_boolean_t must_exist,
          apr_pool_t *pool)
 {
-  svn_lock_t *lock;
+  svn_lock_t *lock = NULL;
   const char *digest_path;
+  svn_node_kind_t kind;
 
   SVN_ERR(digest_path_from_path(&digest_path, fs->path, path, pool));
+  SVN_ERR(svn_io_check_path(digest_path, &kind, pool));
+
+  *lock_p = NULL;
+  if (kind != svn_node_none)
+    SVN_ERR(read_digest_file(NULL, &lock, fs->path, digest_path, pool));
 
-  SVN_ERR(read_digest_file(NULL, &lock, fs->path, digest_path, pool));
   if (! lock)
-    return SVN_FS__ERR_NO_SUCH_LOCK(fs, path);
+    return must_exist ? SVN_FS__ERR_NO_SUCH_LOCK(fs, path) : SVN_NO_ERROR;
 
   /* Don't return an expired lock. */
   if (lock->expiration_date && (apr_time_now() > lock->expiration_date))
@@ -502,7 +510,6 @@ get_lock(svn_lock_t **lock_p,
          Read operations shouldn't change the filesystem. */
       if (have_write_lock)
         SVN_ERR(delete_lock(fs, lock, pool));
-      *lock_p = NULL;
       return SVN_FS__ERR_LOCK_EXPIRED(fs, lock->token);
     }
 
@@ -525,7 +532,7 @@ get_lock_helper(svn_fs_t *fs,
   svn_lock_t *lock;
   svn_error_t *err;
 
-  err = get_lock(&lock, fs, path, have_write_lock, pool);
+  err = get_lock(&lock, fs, path, have_write_lock, FALSE, pool);
 
   /* We've deliberately decided that this function doesn't tell the
      caller *why* the lock is unavailable.  */
@@ -881,7 +888,7 @@ unlock_body(void *baton, apr_pool_t *poo
   svn_lock_t *lock;
 
   /* This could return SVN_ERR_FS_BAD_LOCK_TOKEN or SVN_ERR_FS_LOCK_EXPIRED. */
-  SVN_ERR(get_lock(&lock, ub->fs, ub->path, TRUE, pool));
+  SVN_ERR(get_lock(&lock, ub->fs, ub->path, TRUE, TRUE, pool));
 
   /* Unless breaking the lock, we do some checks. */
   if (! ub->break_lock)

Propchange: subversion/branches/ev2-export/subversion/libsvn_ra/editor.c
------------------------------------------------------------------------------
    svn:eol-style = native

Modified: subversion/branches/ev2-export/subversion/libsvn_ra_serf/ra_serf.h
URL: http://svn.apache.org/viewvc/subversion/branches/ev2-export/subversion/libsvn_ra_serf/ra_serf.h?rev=1346869&r1=1346868&r2=1346869&view=diff
==============================================================================
--- subversion/branches/ev2-export/subversion/libsvn_ra_serf/ra_serf.h (original)
+++ subversion/branches/ev2-export/subversion/libsvn_ra_serf/ra_serf.h Wed Jun  6 13:03:48 2012
@@ -769,12 +769,6 @@ struct svn_ra_serf__server_error_t {
   /* Our local representation of the error. */
   svn_error_t *error;
 
-  /* Have we checked to see if there's an XML error in this response? */
-  svn_boolean_t init;
-
-  /* Was there an XML error response? */
-  svn_boolean_t has_xml_response;
-
   /* Are we done with the response? */
   svn_boolean_t done;
 

Modified: subversion/branches/ev2-export/subversion/libsvn_ra_serf/util.c
URL: http://svn.apache.org/viewvc/subversion/branches/ev2-export/subversion/libsvn_ra_serf/util.c?rev=1346869&r1=1346868&r2=1346869&view=diff
==============================================================================
--- subversion/branches/ev2-export/subversion/libsvn_ra_serf/util.c (original)
+++ subversion/branches/ev2-export/subversion/libsvn_ra_serf/util.c Wed Jun  6 13:03:48 2012
@@ -902,9 +902,7 @@ begin_error_parsing(svn_ra_serf__xml_sta
   svn_ra_serf__server_error_t *server_err;
 
   server_err = apr_pcalloc(result_pool, sizeof(*server_err));
-  server_err->init = TRUE;
   server_err->error = svn_error_create(APR_SUCCESS, NULL, NULL);
-  server_err->has_xml_response = TRUE;
   server_err->contains_precondition_error = FALSE;
   server_err->cdata = svn_stringbuf_create_empty(server_err->error->pool);
   server_err->collect_cdata = FALSE;
@@ -926,59 +924,6 @@ svn_ra_serf__handle_discard_body(serf_re
                                  apr_pool_t *pool)
 {
   apr_status_t status;
-  svn_ra_serf__server_error_t *server_err = baton;
-
-  if (server_err)
-    {
-      if (!server_err->init)
-        {
-          serf_bucket_t *hdrs;
-          const char *val;
-
-          server_err->init = TRUE;
-          hdrs = serf_bucket_response_get_headers(response);
-          val = serf_bucket_headers_get(hdrs, "Content-Type");
-          if (val && strncasecmp(val, "text/xml", sizeof("text/xml") - 1) == 0)
-            {
-              /* ### we should figure out how to reuse begin_error_parsing  */
-
-              server_err->error = svn_error_create(APR_SUCCESS, NULL, NULL);
-              server_err->has_xml_response = TRUE;
-              server_err->contains_precondition_error = FALSE;
-              server_err->cdata = svn_stringbuf_create_empty(pool);
-              server_err->collect_cdata = FALSE;
-              server_err->parser.pool = server_err->error->pool;
-              server_err->parser.user_data = server_err;
-              server_err->parser.start = start_error;
-              server_err->parser.end = end_error;
-              server_err->parser.cdata = cdata_error;
-              server_err->parser.done = &server_err->done;
-              server_err->parser.ignore_errors = TRUE;
-            }
-          else
-            {
-              server_err->error = SVN_NO_ERROR;
-            }
-        }
-
-      if (server_err->has_xml_response)
-        {
-          svn_error_t *err = svn_ra_serf__handle_xml_parser(
-                                                        request,
-                                                        response,
-                                                        &server_err->parser,
-                                                        pool);
-
-          if (server_err->done && server_err->error->apr_err == APR_SUCCESS)
-            {
-              svn_error_clear(server_err->error);
-              server_err->error = SVN_NO_ERROR;
-            }
-
-          return svn_error_trace(err);
-        }
-
-    }
 
   status = drain_bucket(response);
   if (status)
@@ -1457,11 +1402,51 @@ handle_server_error(serf_request_t *requ
                     apr_pool_t *scratch_pool)
 {
   svn_ra_serf__server_error_t server_err = { 0 };
+  serf_bucket_t *hdrs;
+  const char *val;
 
-  svn_error_clear(svn_ra_serf__handle_discard_body(request, response,
-                                                   &server_err, scratch_pool));
+  hdrs = serf_bucket_response_get_headers(response);
+  val = serf_bucket_headers_get(hdrs, "Content-Type");
+  if (val && strncasecmp(val, "text/xml", sizeof("text/xml") - 1) == 0)
+    {
+      /* ### we should figure out how to reuse begin_error_parsing  */
 
-  return server_err.error;
+      server_err.error = svn_error_create(APR_SUCCESS, NULL, NULL);
+      server_err.contains_precondition_error = FALSE;
+      server_err.cdata = svn_stringbuf_create_empty(scratch_pool);
+      server_err.collect_cdata = FALSE;
+      server_err.parser.pool = server_err.error->pool;
+      server_err.parser.user_data = &server_err;
+      server_err.parser.start = start_error;
+      server_err.parser.end = end_error;
+      server_err.parser.cdata = cdata_error;
+      server_err.parser.done = &server_err.done;
+      server_err.parser.ignore_errors = TRUE;
+
+      /* We don't care about any errors except for SERVER_ERR.ERROR  */
+      svn_error_clear(svn_ra_serf__handle_xml_parser(request,
+                                                     response,
+                                                     &server_err.parser,
+                                                     scratch_pool));
+
+      /* ### checking DONE is silly. the above only parses whatever has
+         ### been received at the network interface. totally wrong. but
+         ### it is what we have for now (maintaining historical code),
+         ### until we fully migrate.  */
+      if (server_err.done && server_err.error->apr_err == APR_SUCCESS)
+        {
+          svn_error_clear(server_err.error);
+          server_err.error = SVN_NO_ERROR;
+        }
+
+      return svn_error_trace(server_err.error);
+    }
+
+  /* The only error that we will return is from the XML response body.
+     Otherwise, ignore the entire body and return success.  */
+  (void) drain_bucket(response);
+
+  return SVN_NO_ERROR;
 }
 
 
@@ -1491,10 +1476,14 @@ svn_ra_serf__handle_xml_parser(serf_requ
 
       err = handle_server_error(request, response, pool);
 
-      SVN_ERR(svn_error_compose_create(
-        svn_ra_serf__handle_discard_body(request, response, NULL, pool),
-        err));
-      return SVN_NO_ERROR;
+      /* ### the above call should have drained the entire response. this
+         ### call is historical, and probably not required. but during
+         ### the rework of this core handling... let's keep it for now.  */
+      status = drain_bucket(response);
+      if (status)
+        err = svn_error_compose_create(svn_error_wrap_apr(status, NULL),
+                                       err);
+      return svn_error_trace(err);
     }
 
   if (ctx->headers_baton == NULL)