Index: /trunk/src/apps/svnsync-vbox/Makefile
===================================================================
--- /trunk/src/apps/svnsync-vbox/Makefile	(revision 58233)
+++ /trunk/src/apps/svnsync-vbox/Makefile	(revision 58234)
@@ -3,5 +3,5 @@
 #
 #
-# Copyright (C) 2006-2010 Oracle Corporation
+# Copyright (C) 2006-2015 Oracle Corporation
 #
 # This file is part of VirtualBox Open Source Edition (OSE), as
@@ -19,7 +19,8 @@
 DEFS = -DVBOX -D_FILE_OFFSET_BITS=64
 INCS = -I. -I/usr/include/subversion-1 -I/usr/include/apr-1.0
-LIBS = -lsvn_ra-1 -lsvn_ra_neon-1 -lsvn_ra_local-1 \
-  -lsvn_repos-1 -lsvn_fs-1 -lsvn_fs_base-1 -lsvn_fs_fs-1 -lsvn_delta-1 \
-  -lsvn_subr-1 -lneon -lapr-1 -laprutil-1
+LIBS = -lsvn_ra-1 -lsvn_ra_local-1 \
+  -lsvn_repos-1 -lsvn_fs-1 -lsvn_delta-1 \
+  -lsvn_subr-1 -lapr-1 -laprutil-1 \
+  -ldb
 
 all: svnsync-vbox
Index: /trunk/src/apps/svnsync-vbox/main.c
===================================================================
--- /trunk/src/apps/svnsync-vbox/main.c	(revision 58233)
+++ /trunk/src/apps/svnsync-vbox/main.c	(revision 58234)
@@ -20,4 +20,5 @@
 
 #ifdef VBOX
+#include <svn_version.h>
 #include <svn_cmdline.h>
 #include <svn_config.h>
@@ -278,6 +279,11 @@
   apr_hash_t *props;
   svn_string_t *value;
-
-  SVN_ERR(svn_ra_get_file(session, path, revision, NULL, NULL, &props, pool));
+  svn_node_kind_t nodekind;
+
+  SVN_ERR(svn_ra_check_path(session, path, revision, &nodekind, pool));
+  if (nodekind == svn_node_file)
+    SVN_ERR(svn_ra_get_file(session, path, revision, NULL, NULL, &props, pool));
+  else
+    SVN_ERR(svn_ra_get_dir2(session, NULL, NULL, &props, path, revision, 0, pool));
   value = apr_hash_get(props, SVNSYNC_PROP_PROCESS, APR_HASH_KEY_STRING);
   if (value)
@@ -372,6 +378,11 @@
       else
         {
+#ifdef VBOX
+          SVN_ERR(svn_ra_change_rev_prop2(session, 0, SVNSYNC_PROP_LOCK,
+                                          NULL, mylocktoken, subpool));
+#else /* !VBOX */
           SVN_ERR(svn_ra_change_rev_prop(session, 0, SVNSYNC_PROP_LOCK,
                                          mylocktoken, subpool));
+#endif /* !VBOX */
         }
     }
@@ -404,5 +415,9 @@
   err = func(session, baton, pool);
 
+#ifdef VBOX
+  err2 = svn_ra_change_rev_prop2(session, 0, SVNSYNC_PROP_LOCK, NULL, NULL, pool);
+#else /* !VBOX */
   err2 = svn_ra_change_rev_prop(session, 0, SVNSYNC_PROP_LOCK, NULL, pool);
+#endif /* !VBOX */
   if (err2 && err)
     {
@@ -520,5 +535,5 @@
         if (strncmp(key, SVN_PROP_REVISION_AUTHOR,
                     sizeof(SVN_PROP_REVISION_AUTHOR) - 1))
-          SVN_ERR(svn_ra_change_rev_prop(to_session, rev_to, key, val, subpool));
+          SVN_ERR(svn_ra_change_rev_prop2(to_session, rev_to, key, NULL, val, subpool));
 #else /* !VBOX */
         SVN_ERR(svn_ra_change_rev_prop(to_session, rev, key, val, subpool));
@@ -542,6 +557,6 @@
 
 #ifdef VBOX
-          SVN_ERR(svn_ra_change_rev_prop(to_session, rev_to, name, NULL,
-                                         subpool));
+          SVN_ERR(svn_ra_change_rev_prop2(to_session, rev_to, name, NULL, NULL,
+                                          subpool));
 #else /* !VBOX */
           SVN_ERR(svn_ra_change_rev_prop(to_session, rev, name, NULL,
@@ -827,5 +842,5 @@
   DX(fprintf(stderr, "init change_file_prop %s\n", name);)
   DX(fprintf(stderr, "  %s\n", fb->process ? "EXPORT" : "IGNORE");)
-  if (svn_property_kind(NULL, name) != svn_prop_regular_kind)
+  if (svn_property_kind2(name) != svn_prop_regular_kind)
     return SVN_NO_ERROR;
   if (!strcmp(name, "cvs2svn:cvs-rev"))
@@ -862,5 +877,5 @@
   DX(fprintf(stderr, "init change_dir_prop %s\n", name);)
   DX(fprintf(stderr, "  %s\n", db->process ? "EXPORT" : "IGNORE");)
-  if (svn_property_kind(NULL, name) != svn_prop_regular_kind)
+  if (svn_property_kind2(name) != svn_prop_regular_kind)
     return SVN_NO_ERROR;
   if (!strcmp(name, "cvs2svn:cvs-rev"))
@@ -1026,5 +1041,5 @@
 
 #ifdef VBOX
-  SVN_ERR(svn_ra_open3(&from_session, baton->from_url, NULL, baton->callbacks,
+  SVN_ERR(svn_ra_open4(&from_session, NULL, baton->from_url, NULL, baton->callbacks,
                        baton, baton->config, pool));
 #else /* !VBOX */
@@ -1036,7 +1051,13 @@
                                             pool));
 
+#ifdef VBOX
+  SVN_ERR(svn_ra_change_rev_prop2(to_session, 0, SVNSYNC_PROP_FROM_URL, NULL,
+                                  svn_string_create(baton->from_url, pool),
+                                  pool));
+#else /* !VBOX */
   SVN_ERR(svn_ra_change_rev_prop(to_session, 0, SVNSYNC_PROP_FROM_URL,
                                  svn_string_create(baton->from_url, pool),
                                  pool));
+#endif /* !VBOX */
 
 #ifdef VBOX
@@ -1046,28 +1067,34 @@
 #endif /* !VBOX */
 
+#ifdef VBOX
+  SVN_ERR(svn_ra_change_rev_prop2(to_session, 0, SVNSYNC_PROP_FROM_UUID, NULL,
+                                 svn_string_create(uuid, pool), pool));
+#else /* !VBOX */
   SVN_ERR(svn_ra_change_rev_prop(to_session, 0, SVNSYNC_PROP_FROM_UUID,
                                  svn_string_create(uuid, pool), pool));
+#endif /* !VBOX */
 
 #ifdef VBOX
   start_rev_str = svn_string_create(apr_psprintf(pool, "%ld", baton->start_rev),
                                     pool);
-  SVN_ERR(svn_ra_change_rev_prop(to_session, 0, SVNSYNC_PROP_START_REV,
-                                 start_rev_str, pool));
-  SVN_ERR(svn_ra_change_rev_prop(to_session, 0, SVNSYNC_PROP_LAST_MERGED_REV,
-                                 start_rev_str, pool));
+  SVN_ERR(svn_ra_change_rev_prop2(to_session, 0, SVNSYNC_PROP_START_REV, NULL,
+                                  start_rev_str, pool));
+  SVN_ERR(svn_ra_change_rev_prop2(to_session, 0, SVNSYNC_PROP_LAST_MERGED_REV, NULL,
+                                  start_rev_str, pool));
   if (!baton->default_process)
     default_process = "export";
-  else default_process = baton->default_process;
-  SVN_ERR(svn_ra_change_rev_prop(to_session, 0, SVNSYNC_PROP_DEFAULT_PROCESS,
-                                 svn_string_create(default_process, pool),
-                                 pool));
+  else
+    default_process = baton->default_process;
+  SVN_ERR(svn_ra_change_rev_prop2(to_session, 0, SVNSYNC_PROP_DEFAULT_PROCESS, NULL,
+                                  svn_string_create(default_process, pool),
+                                  pool));
   if (baton->replace_externals)
-    SVN_ERR(svn_ra_change_rev_prop(to_session, 0,
-                                   SVNSYNC_PROP_REPLACE_EXTERNALS,
-                                   svn_string_create("", pool), pool));
+    SVN_ERR(svn_ra_change_rev_prop2(to_session, 0,
+                                    SVNSYNC_PROP_REPLACE_EXTERNALS, NULL,
+                                    svn_string_create("", pool), pool));
   if (baton->replace_license)
-    SVN_ERR(svn_ra_change_rev_prop(to_session, 0,
-                                   SVNSYNC_PROP_REPLACE_LICENSE,
-                                   svn_string_create("", pool), pool));
+    SVN_ERR(svn_ra_change_rev_prop2(to_session, 0,
+                                    SVNSYNC_PROP_REPLACE_LICENSE, NULL,
+                                    svn_string_create("", pool), pool));
 #else /* !VBOX */
   SVN_ERR(svn_ra_change_rev_prop(to_session, 0, SVNSYNC_PROP_LAST_MERGED_REV,
@@ -1112,5 +1139,5 @@
                                       NULL, FALSE, pool));
 
-    SVN_ERR(svn_ra_open3(&from_session_prop, baton->from_url, NULL,
+    SVN_ERR(svn_ra_open4(&from_session_prop, NULL, baton->from_url, NULL,
                          baton->callbacks, baton, baton->config, pool));
 
@@ -1126,7 +1153,7 @@
 
     /* Run it via an update reporter. */
-    SVN_ERR(svn_ra_do_update2(from_session, &reporter, &report_baton,
+    SVN_ERR(svn_ra_do_update3(from_session, &reporter, &report_baton,
                               baton->start_rev, "", svn_depth_infinity, FALSE,
-                              cancel_editor, cancel_baton, pool));
+                              FALSE, cancel_editor, cancel_baton, pool, pool));
     SVN_ERR(reporter->set_path(report_baton, "", baton->start_rev,
                                svn_depth_infinity, TRUE, NULL, pool));
@@ -1152,6 +1179,6 @@
   SVN_ERR(svn_opt_parse_num_args(&args, os, 2, pool));
 
-  to_url = svn_path_canonicalize(APR_ARRAY_IDX(args, 0, const char *), pool);
-  from_url = svn_path_canonicalize(APR_ARRAY_IDX(args, 1, const char *), pool);
+  to_url = svn_uri_canonicalize(APR_ARRAY_IDX(args, 0, const char *), pool);
+  from_url = svn_uri_canonicalize(APR_ARRAY_IDX(args, 1, const char *), pool);
 
   if (! svn_path_is_url(to_url))
@@ -1162,6 +1189,6 @@
                              _("Path '%s' is not a URL"), from_url);
 
-  baton.to_url = svn_path_canonicalize(to_url, pool);
-  baton.from_url = svn_path_canonicalize(from_url, pool);
+  baton.to_url = to_url;
+  baton.from_url = from_url;
   baton.config = opt_baton->config;
 #ifdef VBOX
@@ -1178,5 +1205,5 @@
 
 #ifdef VBOX
-  SVN_ERR(svn_ra_open3(&to_session, baton.to_url, NULL,
+  SVN_ERR(svn_ra_open4(&to_session, NULL, baton.to_url, NULL,
                        &callbacks, &baton, baton.config, pool));
 #else /* !VBOX */
@@ -1249,4 +1276,5 @@
 
 
+#ifdef VBOX
 static svn_revnum_t
 lookup_revnum(svn_ra_session_t *to_session,
@@ -1308,16 +1336,11 @@
   SVN_ERR(open_tmp_file(&tmpfile, NULL, subpool));
   filestream = svn_stream_from_aprfile2(tmpfile, FALSE, subpool);
-  /* svn_ra_get_file() insists on getting a file path without leading /,
-   * and there is a leading / in our input parameter when copying from a
-   * different branch. The assertion is annoying, as continuing would work. */
-  if (src_path[0] == '/')
-    src_path++;
-  SVN_ERR(svn_ra_get_file(from_session, src_path, src_rev, filestream, NULL,
-                          &fileprops, subpool));
+  SVN_ERR(svn_ra_get_file(from_session, STRIP_LEADING_SLASH(src_path), src_rev,
+                          filestream, NULL, &fileprops, subpool));
   SVN_ERR(svn_io_file_seek(tmpfile, APR_SET, &offset, subpool));
 
   SVN_ERR(apply_textdelta(file_baton, NULL, subpool, &window_handler,
                           &window_handler_baton));
-  svn_txdelta(&deltastream, emptystream, filestream, subpool);
+  svn_txdelta2(&deltastream, emptystream, filestream, FALSE, subpool);
   do
   {
@@ -1378,6 +1401,6 @@
     val_ent = (svn_dirent_t *)val;
     oppool = svn_pool_create(subpool);
-    from_path = svn_path_join(src_path, key, oppool);
-    to_path = svn_path_join(dst_path, key, oppool);
+    from_path = svn_relpath_join(src_path, key, oppool);
+    to_path = svn_relpath_join(dst_path, key, oppool);
     switch (val_ent->kind)
     {
@@ -1419,4 +1442,5 @@
   return SVN_NO_ERROR;
 }
+#endif /* VBOX */
 
 /*** Editor vtable functions ***/
@@ -2137,7 +2161,7 @@
 #endif /* VBOX */
   /* only regular properties can pass over libsvn_ra */
-  if (svn_property_kind(NULL, name) != svn_prop_regular_kind)
+#ifdef VBOX
+  if (svn_property_kind2(name) != svn_prop_regular_kind)
     return SVN_NO_ERROR;
-#ifdef VBOX
   if (!strcmp(name, "cvs2svn:cvs-rev"))
     return SVN_NO_ERROR;
@@ -2157,5 +2181,8 @@
     return SVN_NO_ERROR;
   eb->changeset_live = TRUE;
-#endif /* VBOX */
+#else /* !VBOX */
+  if (svn_property_kind(NULL, name) != svn_prop_regular_kind)
+    return SVN_NO_ERROR;
+#endif /* !VBOX */
 
   return eb->wrapped_editor->change_file_prop(fb->wrapped_node_baton,
@@ -2177,7 +2204,7 @@
 #endif /* VBOX */
   /* only regular properties can pass over libsvn_ra */
-  if (svn_property_kind(NULL, name) != svn_prop_regular_kind)
+#ifdef VBOX
+  if (svn_property_kind2(name) != svn_prop_regular_kind)
     return SVN_NO_ERROR;
-#ifdef VBOX
   if (!strcmp(name, "cvs2svn:cvs-rev"))
     return SVN_NO_ERROR;
@@ -2197,5 +2224,8 @@
     return SVN_NO_ERROR;
   eb->changeset_live = TRUE;
-#endif /* VBOX */
+#else /* !VBOX */
+  if (svn_property_kind(NULL, name) != svn_prop_regular_kind)
+    return SVN_NO_ERROR;
+#endif /* !VBOX */
 
   return eb->wrapped_editor->change_dir_prop(db->wrapped_node_baton,
@@ -2412,5 +2442,5 @@
 
 #ifdef VBOX
-  SVN_ERR(svn_ra_open3(from_session, from_url->data, NULL, callbacks, baton,
+  SVN_ERR(svn_ra_open4(from_session, NULL, from_url->data, NULL, callbacks, baton,
                        config, pool));
 #else /* !VBOX */
@@ -2484,7 +2514,7 @@
                           &replace_license_str, pool));
   replace_license = !!replace_license_str;
-  SVN_ERR(svn_ra_open3(&from_session_prop, from_url->data, NULL,
+  SVN_ERR(svn_ra_open4(&from_session_prop, NULL, from_url->data, NULL,
                        baton->callbacks, baton, baton->config, pool));
-  SVN_ERR(svn_ra_open3(&to_session_prop, baton->to_url, NULL,
+  SVN_ERR(svn_ra_open4(&to_session_prop, NULL, baton->to_url, NULL,
                        baton->callbacks, baton, baton->config, pool));
 #else /* !VBOX */
@@ -2570,4 +2600,12 @@
              (i.e. non-svnsync) commits to the dest repository. */
 
+#ifdef VBOX
+          SVN_ERR(svn_ra_change_rev_prop2(to_session, 0,
+                                          SVNSYNC_PROP_LAST_MERGED_REV, NULL,
+                                          last_merged_rev, pool));
+          SVN_ERR(svn_ra_change_rev_prop2(to_session, 0,
+                                          SVNSYNC_PROP_CURRENTLY_COPYING, NULL,
+                                          NULL, pool));
+#else /* !VBOX */
           SVN_ERR(svn_ra_change_rev_prop(to_session, 0,
                                          SVNSYNC_PROP_LAST_MERGED_REV,
@@ -2576,4 +2614,5 @@
                                          SVNSYNC_PROP_CURRENTLY_COPYING,
                                          NULL, pool));
+#endif /* !VBOX */
         }
       /* If copying > to_latest, then we just fall through to
@@ -2629,4 +2668,11 @@
          because ra_svn doesn't let you change rev props during a
          commit. */
+#ifdef VBOX
+      SVN_ERR(svn_ra_change_rev_prop2(to_session, 0,
+                                      SVNSYNC_PROP_CURRENTLY_COPYING, NULL,
+                                      svn_string_createf(subpool, "%ld",
+                                                         current),
+                                      subpool));
+#else /* !VBOX */
       SVN_ERR(svn_ra_change_rev_prop(to_session, 0,
                                      SVNSYNC_PROP_CURRENTLY_COPYING,
@@ -2634,4 +2680,5 @@
                                                         current),
                                      subpool));
+#endif /* !VBOX */
 
       /* The actual copy is just a replay hooked up to a commit. */
@@ -2723,13 +2770,13 @@
 
         /* Add a revision cross-reference revprop. */
-        SVN_ERR(svn_ra_change_rev_prop(to_session, 0,
-                                       apr_psprintf(subpool,
-                                                    SVNSYNC_PROP_REV__FMT,
-                                                    current),
-                                       svn_string_create(apr_psprintf(subpool,
-                                                                      "%ld",
-                                                                      baton->committed_rev),
-                                   subpool),
-                 subpool));
+        SVN_ERR(svn_ra_change_rev_prop2(to_session, 0,
+                                        apr_psprintf(subpool,
+                                                     SVNSYNC_PROP_REV__FMT,
+                                                     current), NULL,
+                                        svn_string_create(apr_psprintf(subpool,
+                                                                       "%ld",
+                                                                       baton->committed_rev),
+                                                          subpool),
+                                        subpool));
       }
       else
@@ -2740,13 +2787,13 @@
          * appears in the destination repository. */
         SVN_ERR(svn_ra_get_latest_revnum(to_session, &to_latest, subpool));
-        SVN_ERR(svn_ra_change_rev_prop(to_session, 0,
-                                       apr_psprintf(subpool,
-                                                    SVNSYNC_PROP_REV__FMT,
-                                                    current),
-                                       svn_string_create(apr_psprintf(subpool,
-                                                                      "%ld",
-                                                                      to_latest),
-                                   subpool),
-                 subpool));
+        SVN_ERR(svn_ra_change_rev_prop2(to_session, 0,
+                                        apr_psprintf(subpool,
+                                                     SVNSYNC_PROP_REV__FMT,
+                                                     current), NULL,
+                                        svn_string_create(apr_psprintf(subpool,
+                                                                       "%ld",
+                                                                       to_latest),
+                                                          subpool),
+                                        subpool));
       }
 #else /* !VBOX */
@@ -2756,4 +2803,13 @@
       /* Ok, we're done, bring the last-merged-rev property up to date. */
 
+#ifdef VBOX
+      SVN_ERR(svn_ra_change_rev_prop2
+              (to_session,
+               0,
+               SVNSYNC_PROP_LAST_MERGED_REV, NULL,
+               svn_string_create(apr_psprintf(subpool, "%ld", current),
+                                 subpool),
+               subpool));
+#else /* !VBOX */
       SVN_ERR(svn_ra_change_rev_prop
               (to_session,
@@ -2763,11 +2819,18 @@
                                  subpool),
                subpool));
+#endif /* !VBOX */
 
       /* And finally drop the currently copying prop, since we're done
          with this revision. */
 
+#ifdef VBOX
+      SVN_ERR(svn_ra_change_rev_prop2(to_session, 0,
+                                      SVNSYNC_PROP_CURRENTLY_COPYING, NULL,
+                                      NULL, subpool));
+#else /* !VBOX */
       SVN_ERR(svn_ra_change_rev_prop(to_session, 0,
                                      SVNSYNC_PROP_CURRENTLY_COPYING,
                                      NULL, subpool));
+#endif /* !VBOX */
     }
 
@@ -2789,5 +2852,5 @@
   SVN_ERR(svn_opt_parse_num_args(&args, os, 1, pool));
 
-  to_url = svn_path_canonicalize(APR_ARRAY_IDX(args, 0, const char *), pool);
+  to_url = svn_uri_canonicalize(APR_ARRAY_IDX(args, 0, const char *), pool);
 
   if (! svn_path_is_url(to_url))
@@ -2803,5 +2866,5 @@
 
 #ifdef VBOX
-  SVN_ERR(svn_ra_open3(&to_session, to_url, NULL,
+  SVN_ERR(svn_ra_open4(&to_session, NULL, to_url, NULL,
                        baton.callbacks, &baton, baton.config, pool));
 #else /* !VBOX */
@@ -2895,5 +2958,5 @@
   SVN_ERR(svn_opt_parse_num_args(&args, os, 2, pool));
 
-  to_url = svn_path_canonicalize(APR_ARRAY_IDX(args, 0, const char *), pool);
+  to_url = svn_uri_canonicalize(APR_ARRAY_IDX(args, 0, const char *), pool);
   revision = strtol(APR_ARRAY_IDX(args, 1, const char *), &digits_end, 10);
 
@@ -2914,5 +2977,5 @@
 
 #ifdef VBOX
-  SVN_ERR(svn_ra_open3(&to_session, to_url, NULL,
+  SVN_ERR(svn_ra_open4(&to_session, NULL, to_url, NULL,
                        baton.callbacks, &baton, baton.config, pool));
 #else /* !VBOX */
@@ -2960,7 +3023,7 @@
 
 #ifdef VBOX
-  SVN_ERR(svn_opt_print_help3(os, "svnsync",
+  SVN_ERR(svn_opt_print_help4(os, "svnsync",
                               opt_baton ? opt_baton->version : FALSE,
-                              FALSE, version_footer->data, header,
+                              FALSE, FALSE, version_footer->data, header,
                               svnsync_cmd_table, svnsync_options, NULL,
                               NULL, pool));
@@ -3030,7 +3093,13 @@
     }
 
-  err = svn_cmdline__getopt_init(&os, argc, argv, pool);
-  if (err)
-    return svn_cmdline_handle_exit_error(err, pool, "svnsync: ");
+  {
+    apr_status_t apr_err;
+    apr_err = apr_getopt_init(&os, pool, argc, argv);
+    if (apr_err)
+    {
+      err = svn_error_wrap_apr(apr_err, "Error initializing command line parsing");
+      return svn_cmdline_handle_exit_error(err, pool, "svnsync: ");
+    }
+  }
 
   os->interleave = 1;
