subversion-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From hwri...@apache.org
Subject svn commit: r1044548 [32/39] - in /subversion/branches/ignore-mergeinfo: ./ build/ build/ac-macros/ build/generator/ build/generator/templates/ build/win32/ contrib/client-side/ contrib/hook-scripts/ contrib/server-side/ notes/api-errata/ notes/api-err...
Date Sat, 11 Dec 2010 00:16:08 GMT
Modified: subversion/branches/ignore-mergeinfo/subversion/svn/notify.c
URL: http://svn.apache.org/viewvc/subversion/branches/ignore-mergeinfo/subversion/svn/notify.c?rev=1044548&r1=1044547&r2=1044548&view=diff
==============================================================================
--- subversion/branches/ignore-mergeinfo/subversion/svn/notify.c (original)
+++ subversion/branches/ignore-mergeinfo/subversion/svn/notify.c Sat Dec 11 00:15:55 2010
@@ -46,7 +46,7 @@ struct notify_baton
   svn_boolean_t received_some_change;
   svn_boolean_t is_checkout;
   svn_boolean_t is_export;
-  svn_boolean_t suppress_final_line;
+  svn_boolean_t suppress_summary_lines;
   svn_boolean_t sent_first_txdelta;
   svn_boolean_t in_external;
   svn_boolean_t had_print_error; /* Used to not keep printing error messages
@@ -324,7 +324,7 @@ notify(void *baton, const svn_wc_notify_
                                            apr_pstrcat(pool, s,
                                                        "%"APR_UINT64_T_FMT
                                                        " and fuzz %d (%s)\n",
-                                                       NULL),
+                                                       (char *)NULL),
                                            n->hunk_original_start,
                                            n->hunk_original_length,
                                            n->hunk_modified_start,
@@ -341,7 +341,7 @@ notify(void *baton, const svn_wc_notify_
                                            apr_pstrcat(pool, s,
                                                        "%"APR_UINT64_T_FMT
                                                        " and fuzz %d\n",
-                                                       NULL),
+                                                       (char *)NULL),
                                            n->hunk_original_start,
                                            n->hunk_original_length,
                                            n->hunk_modified_start,
@@ -362,7 +362,7 @@ notify(void *baton, const svn_wc_notify_
                   err = svn_cmdline_printf(pool,
                                             apr_pstrcat(pool, s,
                                                         "%"APR_UINT64_T_FMT" (%s)\n",
-                                                        NULL),
+                                                        (char *)NULL),
                                             n->hunk_original_start,
                                             n->hunk_original_length,
                                             n->hunk_modified_start,
@@ -376,7 +376,7 @@ notify(void *baton, const svn_wc_notify_
                   err = svn_cmdline_printf(pool,
                                            apr_pstrcat(pool, s,
                                                        "%"APR_UINT64_T_FMT"\n",
-                                                       NULL),
+                                                       (char *)NULL),
                                            n->hunk_original_start,
                                            n->hunk_original_length,
                                            n->hunk_modified_start,
@@ -547,9 +547,21 @@ notify(void *baton, const svn_wc_notify_
         }
       break;
 
+    case svn_wc_notify_update_started:
+      if (! (nb->suppress_summary_lines || 
+             nb->in_external ||
+             nb->is_checkout ||
+             nb->is_export))
+        {
+          if ((err = svn_cmdline_printf(pool, _("Updating '%s' ...\n"),
+                                        path_local)))
+            goto print_error;
+        }
+      break;
+
     case svn_wc_notify_update_completed:
       {
-        if (! nb->suppress_final_line)
+        if (! nb->suppress_summary_lines)
           {
             if (SVN_IS_VALID_REVNUM(n->revision))
               {
@@ -575,6 +587,7 @@ notify(void *baton, const svn_wc_notify_
                   {
                     if (nb->received_some_change)
                       {
+                        nb->received_some_change = FALSE;
                         if ((err = svn_cmdline_printf
                              (pool, nb->in_external
                               ? _("Updated external to revision %ld.\n")
@@ -912,7 +925,7 @@ notify(void *baton, const svn_wc_notify_
 svn_error_t *
 svn_cl__get_notifier(svn_wc_notify_func2_t *notify_func_p,
                      void **notify_baton_p,
-                     svn_boolean_t suppress_final_line,
+                     svn_boolean_t suppress_summary_lines,
                      apr_pool_t *pool)
 {
   struct notify_baton *nb = apr_palloc(pool, sizeof(*nb));
@@ -921,7 +934,7 @@ svn_cl__get_notifier(svn_wc_notify_func2
   nb->sent_first_txdelta = FALSE;
   nb->is_checkout = FALSE;
   nb->is_export = FALSE;
-  nb->suppress_final_line = suppress_final_line;
+  nb->suppress_summary_lines = suppress_summary_lines;
   nb->in_external = FALSE;
   nb->had_print_error = FALSE;
   nb->text_conflicts = 0;
@@ -952,3 +965,18 @@ svn_cl__notifier_mark_export(void *baton
   nb->is_export = TRUE;
   return SVN_NO_ERROR;
 }
+
+void
+svn_cl__check_externals_failed_notify_wrapper(void *baton,
+                                              const svn_wc_notify_t *n,
+                                              apr_pool_t *pool)
+{
+  struct svn_cl__check_externals_failed_notify_baton *nwb = baton;
+
+  if (n->action == svn_wc_notify_failed_external)
+    nwb->had_externals_error = TRUE;
+
+  if (nwb->wrapped_func)
+    nwb->wrapped_func(nwb->wrapped_baton, n, pool);
+}
+

Modified: subversion/branches/ignore-mergeinfo/subversion/svn/patch-cmd.c
URL: http://svn.apache.org/viewvc/subversion/branches/ignore-mergeinfo/subversion/svn/patch-cmd.c?rev=1044548&r1=1044547&r2=1044548&view=diff
==============================================================================
--- subversion/branches/ignore-mergeinfo/subversion/svn/patch-cmd.c (original)
+++ subversion/branches/ignore-mergeinfo/subversion/svn/patch-cmd.c Sat Dec 11 00:15:55 2010
@@ -48,33 +48,45 @@ svn_cl__patch(apr_getopt_t *os,
 {
   svn_cl__opt_state_t *opt_state;
   svn_client_ctx_t *ctx;
-  apr_array_header_t *args;
   apr_array_header_t *targets;
   const char *abs_patch_path;
+  const char *patch_path;
   const char *abs_target_path;
+  const char *target_path;
 
   opt_state = ((svn_cl__cmd_baton_t *)baton)->opt_state;
   ctx = ((svn_cl__cmd_baton_t *)baton)->ctx;
 
-  SVN_ERR(svn_opt_parse_num_args(&args, os, 1, pool));
-  SVN_ERR(svn_dirent_get_absolute(&abs_patch_path,
-                                  APR_ARRAY_IDX(args, 0, const char *),
-                                  pool));
-
-  SVN_ERR(svn_client_args_to_target_array(&targets, os, opt_state->targets,
-                                          ctx, pool));
-  if (targets->nelts > 1)
+  SVN_ERR(svn_cl__args_to_target_array_print_reserved(&targets, os,
+                                                      opt_state->targets,
+                                                      ctx, pool));
+  SVN_ERR(svn_cl__eat_peg_revisions(&targets, targets, pool));
+
+  if (targets->nelts > 2)
     return svn_error_create(SVN_ERR_CL_ARG_PARSING_ERROR, 0, NULL);
 
-  svn_opt_push_implicit_dot_target(targets, pool);
-  SVN_ERR(svn_cl__eat_peg_revisions(&targets, targets, pool));
-  SVN_ERR(svn_dirent_get_absolute(&abs_target_path,
-                                  APR_ARRAY_IDX(targets, 0, const char *),
-                                  pool));
+  patch_path = APR_ARRAY_IDX(targets, 0, const char *);
+
+  if (svn_path_is_url(patch_path))
+    return svn_error_createf(SVN_ERR_CL_ARG_PARSING_ERROR, NULL,
+                             _("'%s' is not a local path"), patch_path);
+
+  SVN_ERR(svn_dirent_get_absolute(&abs_patch_path, patch_path, pool));
+
+  if (targets->nelts == 1)
+    target_path = ""; /* "" is the canonical form of "." */
+  else
+    {
+      target_path = APR_ARRAY_IDX(targets, 1, const char *);
+
+      if (svn_path_is_url(target_path))
+        return svn_error_createf(SVN_ERR_CL_ARG_PARSING_ERROR, NULL,
+                                 _("'%s' is not a local path"), target_path);
+    }
+  SVN_ERR(svn_dirent_get_absolute(&abs_target_path, target_path, pool));
 
   SVN_ERR(svn_client_patch(abs_patch_path, abs_target_path,
-                           opt_state->dry_run, opt_state->strip_count,
-                           opt_state->old_patch_target_names,
+                           opt_state->dry_run, opt_state->strip,
                            opt_state->reverse_diff,
                            opt_state->ignore_whitespace,
                            TRUE, NULL, NULL, ctx, pool, pool));

Modified: subversion/branches/ignore-mergeinfo/subversion/svn/propdel-cmd.c
URL: http://svn.apache.org/viewvc/subversion/branches/ignore-mergeinfo/subversion/svn/propdel-cmd.c?rev=1044548&r1=1044547&r2=1044548&view=diff
==============================================================================
--- subversion/branches/ignore-mergeinfo/subversion/svn/propdel-cmd.c (original)
+++ subversion/branches/ignore-mergeinfo/subversion/svn/propdel-cmd.c Sat Dec 11 00:15:55 2010
@@ -71,7 +71,6 @@ svn_cl__propdel(apr_getopt_t *os,
   const char *pname, *pname_utf8;
   apr_array_header_t *args, *targets;
   struct notify_wrapper_baton nwb = { 0 };
-  int i;
 
   /* Get the property's name (and a UTF-8 version of that name). */
   SVN_ERR(svn_opt_parse_num_args(&args, os, 1, pool));
@@ -121,6 +120,7 @@ svn_cl__propdel(apr_getopt_t *os,
   else  /* operate on a normal, versioned property (not a revprop) */
     {
       apr_pool_t *subpool = svn_pool_create(pool);
+      int i;
 
       if (opt_state->depth == svn_depth_unknown)
         opt_state->depth = svn_depth_empty;

Modified: subversion/branches/ignore-mergeinfo/subversion/svn/propedit-cmd.c
URL: http://svn.apache.org/viewvc/subversion/branches/ignore-mergeinfo/subversion/svn/propedit-cmd.c?rev=1044548&r1=1044547&r2=1044548&view=diff
==============================================================================
--- subversion/branches/ignore-mergeinfo/subversion/svn/propedit-cmd.c (original)
+++ subversion/branches/ignore-mergeinfo/subversion/svn/propedit-cmd.c Sat Dec 11 00:15:55 2010
@@ -76,7 +76,6 @@ svn_cl__propedit(apr_getopt_t *os,
   svn_client_ctx_t *ctx = ((svn_cl__cmd_baton_t *) baton)->ctx;
   const char *pname, *pname_utf8;
   apr_array_header_t *args, *targets;
-  int i;
 
   /* Validate the input and get the property's name (and a UTF-8
      version of that name). */
@@ -177,6 +176,7 @@ svn_cl__propedit(apr_getopt_t *os,
     {
       apr_pool_t *subpool = svn_pool_create(pool);
       struct commit_info_baton cib;
+      int i;
 
       /* The customary implicit dot rule has been prone to user error
        * here.  For example, Jon Trowbridge <trow@gnu.og> did

Modified: subversion/branches/ignore-mergeinfo/subversion/svn/propget-cmd.c
URL: http://svn.apache.org/viewvc/subversion/branches/ignore-mergeinfo/subversion/svn/propget-cmd.c?rev=1044548&r1=1044547&r2=1044548&view=diff
==============================================================================
--- subversion/branches/ignore-mergeinfo/subversion/svn/propget-cmd.c (original)
+++ subversion/branches/ignore-mergeinfo/subversion/svn/propget-cmd.c Sat Dec 11 00:15:55 2010
@@ -140,6 +140,12 @@ print_properties(svn_stream_t *out,
                                 ? _("Properties on '%s':\n")
                                 : "%s - ", filename);
           SVN_ERR(svn_cmdline_cstring_from_utf8(&header, header, iterpool));
+          SVN_ERR(svn_subst_translate_cstring2(header, &header,
+                                               APR_EOL_STR,  /* 'native' eol */
+                                               FALSE, /* no repair */
+                                               NULL,  /* no keywords */
+                                               FALSE, /* no expansion */
+                                               iterpool));
           SVN_ERR(stream_write(out, header, strlen(header)));
         }
 
@@ -149,7 +155,7 @@ print_properties(svn_stream_t *out,
           apr_hash_t *hash = apr_hash_make(iterpool);
 
           apr_hash_set(hash, pname_utf8, APR_HASH_KEY_STRING, propval);
-          svn_cl__print_prop_hash(hash, FALSE, iterpool);
+          SVN_ERR(svn_cl__print_prop_hash(out, hash, FALSE, iterpool));
         }
       else
         {
@@ -184,7 +190,6 @@ svn_cl__propget(apr_getopt_t *os,
   const char *pname, *pname_utf8;
   apr_array_header_t *args, *targets;
   svn_stream_t *out;
-  int i;
 
   if (opt_state->verbose && (opt_state->revprop || opt_state->strict
                              || opt_state->xml))
@@ -267,6 +272,7 @@ svn_cl__propget(apr_getopt_t *os,
   else  /* operate on a normal, versioned property (not a revprop) */
     {
       apr_pool_t *subpool = svn_pool_create(pool);
+      int i;
 
       if (opt_state->xml)
         SVN_ERR(svn_cl__xml_print_header("properties", subpool));

Modified: subversion/branches/ignore-mergeinfo/subversion/svn/proplist-cmd.c
URL: http://svn.apache.org/viewvc/subversion/branches/ignore-mergeinfo/subversion/svn/proplist-cmd.c?rev=1044548&r1=1044547&r2=1044548&view=diff
==============================================================================
--- subversion/branches/ignore-mergeinfo/subversion/svn/proplist-cmd.c (original)
+++ subversion/branches/ignore-mergeinfo/subversion/svn/proplist-cmd.c Sat Dec 11 00:15:55 2010
@@ -98,7 +98,8 @@ proplist_receiver(void *baton,
 
   if (!opt_state->quiet)
     SVN_ERR(svn_cmdline_printf(pool, _("Properties on '%s':\n"), name_local));
-  return svn_cl__print_prop_hash(prop_hash, (! opt_state->verbose), pool);
+  return svn_cl__print_prop_hash(NULL, prop_hash, (! opt_state->verbose),
+                                 pool);
 }
 
 
@@ -111,7 +112,6 @@ svn_cl__proplist(apr_getopt_t *os,
   svn_cl__opt_state_t *opt_state = ((svn_cl__cmd_baton_t *) baton)->opt_state;
   svn_client_ctx_t *ctx = ((svn_cl__cmd_baton_t *) baton)->ctx;
   apr_array_header_t *targets;
-  int i;
 
   SVN_ERR(svn_cl__args_to_target_array_print_reserved(&targets, os,
                                                       opt_state->targets,
@@ -159,11 +159,12 @@ svn_cl__proplist(apr_getopt_t *os,
                                 rev));
 
           SVN_ERR(svn_cl__print_prop_hash
-                  (proplist, (! opt_state->verbose), scratch_pool));
+                  (NULL, proplist, (! opt_state->verbose), scratch_pool));
         }
     }
   else  /* operate on normal, versioned properties (not revprops) */
     {
+      int i;
       apr_pool_t *iterpool;
       svn_proplist_receiver_t pl_receiver;
 

Modified: subversion/branches/ignore-mergeinfo/subversion/svn/props.c
URL: http://svn.apache.org/viewvc/subversion/branches/ignore-mergeinfo/subversion/svn/props.c?rev=1044548&r1=1044547&r2=1044548&view=diff
==============================================================================
--- subversion/branches/ignore-mergeinfo/subversion/svn/props.c (original)
+++ subversion/branches/ignore-mergeinfo/subversion/svn/props.c Sat Dec 11 00:15:55 2010
@@ -82,7 +82,8 @@ svn_cl__revprop_prepare(const svn_opt_re
 
 
 svn_error_t *
-svn_cl__print_prop_hash(apr_hash_t *prop_hash,
+svn_cl__print_prop_hash(svn_stream_t *out,
+                        apr_hash_t *prop_hash,
                         svn_boolean_t names_only,
                         apr_pool_t *pool)
 {
@@ -93,6 +94,7 @@ svn_cl__print_prop_hash(apr_hash_t *prop
       const char *pname = svn__apr_hash_index_key(hi);
       svn_string_t *propval = svn__apr_hash_index_val(hi);
       const char *pname_stdout;
+      apr_size_t len;
 
       if (svn_prop_needs_translation(pname))
         SVN_ERR(svn_subst_detranslate_string(&propval, propval,
@@ -100,18 +102,45 @@ svn_cl__print_prop_hash(apr_hash_t *prop
 
       SVN_ERR(svn_cmdline_cstring_from_utf8(&pname_stdout, pname, pool));
 
-      /* ### We leave these printfs for now, since if propval wasn't translated
-       * above, we don't know anything about its encoding.  In fact, it
-       * might be binary data... */
-      printf("  %s\n", pname_stdout);
+      if (out)
+        {
+          pname_stdout = apr_psprintf(pool, "  %s\n", pname_stdout); 
+          SVN_ERR(svn_subst_translate_cstring2(pname_stdout, &pname_stdout,
+                                              APR_EOL_STR,  /* 'native' eol */
+                                              FALSE, /* no repair */
+                                              NULL,  /* no keywords */
+                                              FALSE, /* no expansion */
+                                              pool));
+
+          len = strlen(pname_stdout);
+          SVN_ERR(svn_stream_write(out, pname_stdout, &len));
+        }
+      else
+        {
+          /* ### We leave these printfs for now, since if propval wasn't
+             translated above, we don't know anything about its encoding.
+             In fact, it might be binary data... */
+          printf("  %s\n", pname_stdout);
+        }
+
       if (!names_only)
         {
           /* Add an extra newline to the value before indenting, so that
            * every line of output has the indentation whether the value
            * already ended in a newline or not. */
           const char *newval = apr_psprintf(pool, "%s\n", propval->data);
-
-          printf("%s", svn_cl__indent_string(newval, "    ", pool));
+          const char *indented_newval = svn_cl__indent_string(newval,
+                                                              "    ",
+                                                              pool);
+          if (out)
+            {
+              len = strlen(indented_newval);
+              SVN_ERR(svn_stream_write(out, indented_newval, &len));
+            }
+          else
+            {
+              printf("%s", indented_newval);
+            }
         }
     }
 

Modified: subversion/branches/ignore-mergeinfo/subversion/svn/propset-cmd.c
URL: http://svn.apache.org/viewvc/subversion/branches/ignore-mergeinfo/subversion/svn/propset-cmd.c?rev=1044548&r1=1044547&r2=1044548&view=diff
==============================================================================
--- subversion/branches/ignore-mergeinfo/subversion/svn/propset-cmd.c (original)
+++ subversion/branches/ignore-mergeinfo/subversion/svn/propset-cmd.c Sat Dec 11 00:15:55 2010
@@ -55,7 +55,6 @@ svn_cl__propset(apr_getopt_t *os,
   svn_string_t *propval = NULL;
   svn_boolean_t propval_came_from_cmdline;
   apr_array_header_t *args, *targets;
-  int i;
 
   /* PNAME and PROPVAL expected as first 2 arguments if filedata was
      NULL, else PNAME alone will precede the targets.  Get a UTF-8
@@ -131,6 +130,7 @@ svn_cl__propset(apr_getopt_t *os,
   else  /* operate on a normal, versioned property (not a revprop) */
     {
       apr_pool_t *iterpool;
+      int i;
 
       if (opt_state->depth == svn_depth_unknown)
         opt_state->depth = svn_depth_empty;

Modified: subversion/branches/ignore-mergeinfo/subversion/svn/resolve-cmd.c
URL: http://svn.apache.org/viewvc/subversion/branches/ignore-mergeinfo/subversion/svn/resolve-cmd.c?rev=1044548&r1=1044547&r2=1044548&view=diff
==============================================================================
--- subversion/branches/ignore-mergeinfo/subversion/svn/resolve-cmd.c (original)
+++ subversion/branches/ignore-mergeinfo/subversion/svn/resolve-cmd.c Sat Dec 11 00:15:55 2010
@@ -29,6 +29,7 @@
 #define APR_WANT_STDIO
 #include <apr_want.h>
 
+#include "svn_path.h"
 #include "svn_client.h"
 #include "svn_error.h"
 #include "svn_pools.h"
@@ -93,6 +94,17 @@ svn_cl__resolve(apr_getopt_t *os,
 
   SVN_ERR(svn_cl__eat_peg_revisions(&targets, targets, scratch_pool));
 
+  /* Don't even attempt to modify the working copy if any of the
+   * targets look like URLs. URLs are invalid input. */
+  for (i = 0; i < targets->nelts; i++)
+    {
+      const char *target = APR_ARRAY_IDX(targets, i, const char *);
+
+      if (svn_path_is_url(target))
+        return svn_error_createf(SVN_ERR_CL_ARG_PARSING_ERROR, NULL,
+                                 _("'%s' is not a local path"), target);
+    }
+  
   iterpool = svn_pool_create(scratch_pool);
   for (i = 0; i < targets->nelts; i++)
     {

Modified: subversion/branches/ignore-mergeinfo/subversion/svn/resolved-cmd.c
URL: http://svn.apache.org/viewvc/subversion/branches/ignore-mergeinfo/subversion/svn/resolved-cmd.c?rev=1044548&r1=1044547&r2=1044548&view=diff
==============================================================================
--- subversion/branches/ignore-mergeinfo/subversion/svn/resolved-cmd.c (original)
+++ subversion/branches/ignore-mergeinfo/subversion/svn/resolved-cmd.c Sat Dec 11 00:15:55 2010
@@ -29,6 +29,7 @@
 #define APR_WANT_STDIO
 #include <apr_want.h>
 
+#include "svn_path.h"
 #include "svn_client.h"
 #include "svn_error.h"
 #include "svn_pools.h"
@@ -64,6 +65,16 @@ svn_cl__resolved(apr_getopt_t *os,
 
   SVN_ERR(svn_cl__eat_peg_revisions(&targets, targets, scratch_pool));
 
+  /* URLs are invalid input. */
+  for (i = 0; i < targets->nelts; i++)
+    {
+      const char *target = APR_ARRAY_IDX(targets, i, const char *);
+
+      if (svn_path_is_url(target))
+        return svn_error_createf(SVN_ERR_CL_ARG_PARSING_ERROR, NULL,
+                                 _("'%s' is not a local path"), target);
+    }
+  
   iterpool = svn_pool_create(scratch_pool);
   for (i = 0; i < targets->nelts; i++)
     {

Modified: subversion/branches/ignore-mergeinfo/subversion/svn/revert-cmd.c
URL: http://svn.apache.org/viewvc/subversion/branches/ignore-mergeinfo/subversion/svn/revert-cmd.c?rev=1044548&r1=1044547&r2=1044548&view=diff
==============================================================================
--- subversion/branches/ignore-mergeinfo/subversion/svn/revert-cmd.c (original)
+++ subversion/branches/ignore-mergeinfo/subversion/svn/revert-cmd.c Sat Dec 11 00:15:55 2010
@@ -27,6 +27,7 @@
 
 /*** Includes. ***/
 
+#include "svn_path.h"
 #include "svn_client.h"
 #include "svn_error_codes.h"
 #include "svn_error.h"
@@ -47,6 +48,7 @@ svn_cl__revert(apr_getopt_t *os,
   svn_client_ctx_t *ctx = ((svn_cl__cmd_baton_t *) baton)->ctx;
   apr_array_header_t *targets = NULL;
   svn_error_t *err;
+  int i;
 
   SVN_ERR(svn_cl__args_to_target_array_print_reserved(&targets, os,
                                                       opt_state->targets,
@@ -63,9 +65,19 @@ svn_cl__revert(apr_getopt_t *os,
 
   SVN_ERR(svn_cl__eat_peg_revisions(&targets, targets, scratch_pool));
 
+  /* Don't even attempt to modify the working copy if any of the
+   * targets look like URLs. URLs are invalid input. */
+  for (i = 0; i < targets->nelts; i++)
+    {
+      const char *target = APR_ARRAY_IDX(targets, i, const char *);
+
+      if (svn_path_is_url(target))
+        return svn_error_createf(SVN_ERR_CL_ARG_PARSING_ERROR, NULL,
+                                 _("'%s' is not a local path"), target);
+    }
+
   err = svn_client_revert2(targets, opt_state->depth,
                            opt_state->changelists, ctx, scratch_pool);
-
   if (err
       && (err->apr_err == SVN_ERR_WC_INVALID_OPERATION_DEPTH)
       && (! SVN_DEPTH_IS_RECURSIVE(opt_state->depth)))

Modified: subversion/branches/ignore-mergeinfo/subversion/svn/schema/info.rnc
URL: http://svn.apache.org/viewvc/subversion/branches/ignore-mergeinfo/subversion/svn/schema/info.rnc?rev=1044548&r1=1044547&r2=1044548&view=diff
==============================================================================
--- subversion/branches/ignore-mergeinfo/subversion/svn/schema/info.rnc (original)
+++ subversion/branches/ignore-mergeinfo/subversion/svn/schema/info.rnc Sat Dec 11 00:15:55 2010
@@ -53,6 +53,7 @@ uuid = element uuid { uuid.type }
 ## Info in the working copy entry.
 wc-info =
   element wc-info {
+    wcroot-abspath?,
     schedule?,
     changelist?,
     copy-from-url?,
@@ -63,6 +64,8 @@ wc-info =
     checksum?
   }
 
+wcroot-abspath = element wcroot-abspath { string }
+
 schedule =
   element schedule { "normal" | "add" | "delete" | "replace" | "none" }
 

Modified: subversion/branches/ignore-mergeinfo/subversion/svn/status-cmd.c
URL: http://svn.apache.org/viewvc/subversion/branches/ignore-mergeinfo/subversion/svn/status-cmd.c?rev=1044548&r1=1044547&r2=1044548&view=diff
==============================================================================
--- subversion/branches/ignore-mergeinfo/subversion/svn/status-cmd.c (original)
+++ subversion/branches/ignore-mergeinfo/subversion/svn/status-cmd.c Sat Dec 11 00:15:55 2010
@@ -171,14 +171,7 @@ print_status(void *baton,
              apr_pool_t *pool)
 {
   struct status_baton *sb = baton;
-
-  svn_revnum_t revision;
-  svn_revnum_t changed_rev;
-  apr_time_t changed_date;
-  const char *changed_author;
-  const char *local_abspath;
-
-  local_abspath = status->local_abspath;
+  const char *local_abspath = status->local_abspath;
 
   /* ### The revision information with associates are based on what
    * ### _read_info() returns. The svn_wc_status_func4_t callback is
@@ -194,16 +187,13 @@ print_status(void *baton,
                  = svn_client_status_dup(status, sb->cl_pool);
 
       /* Retrieve some data from the original version of the replaced node */
-      SVN_ERR(svn_wc__node_get_working_rev_info(&revision, &changed_rev,
-                                                &changed_date,
-                                                &changed_author,
+      SVN_ERR(svn_wc__node_get_working_rev_info(&tweaked_status->revision,
+                                                &tweaked_status->changed_rev,
+                                                &tweaked_status->changed_date,
+                                                &tweaked_status->changed_author,
                                                 sb->ctx->wc_ctx,
                                                 local_abspath, sb->cl_pool,
                                                 pool));
-      tweaked_status->revision = revision;
-      tweaked_status->changed_rev = changed_rev;
-      tweaked_status->changed_date = changed_date;
-      tweaked_status->changed_author = changed_author;
 
       status = tweaked_status;
     }
@@ -259,6 +249,16 @@ svn_cl__status(apr_getopt_t *os,
   /* Add "." if user passed 0 arguments */
   svn_opt_push_implicit_dot_target(targets, scratch_pool);
 
+  /* URLs are invalid input. */
+  for (i = 0; i < targets->nelts; i++)
+    {
+      const char *target = APR_ARRAY_IDX(targets, i, const char *);
+
+      if (svn_path_is_url(target))
+        return svn_error_createf(SVN_ERR_CL_ARG_PARSING_ERROR, NULL,
+                                 _("'%s' is not a local path"), target);
+    }
+
   /* We want our -u statuses to be against HEAD. */
   rev.kind = svn_opt_revision_head;
 

Modified: subversion/branches/ignore-mergeinfo/subversion/svn/status.c
URL: http://svn.apache.org/viewvc/subversion/branches/ignore-mergeinfo/subversion/svn/status.c?rev=1044548&r1=1044547&r2=1044548&view=diff
==============================================================================
--- subversion/branches/ignore-mergeinfo/subversion/svn/status.c (original)
+++ subversion/branches/ignore-mergeinfo/subversion/svn/status.c Sat Dec 11 00:15:55 2010
@@ -163,11 +163,14 @@ print_status(const char *path,
           svn_wc_conflict_description_t *old_tree_conflict;
           SVN_ERR(svn_wc__get_tree_conflict(&tree_conflict, ctx->wc_ctx,
                                             local_abspath, pool, pool));
+          SVN_ERR_ASSERT(tree_conflict != NULL);
           old_tree_conflict = svn_wc__cd2_to_cd(tree_conflict, pool);
 
           tree_status_code = 'C';
-          svn_cl__get_human_readable_tree_conflict_description(
-            &desc, old_tree_conflict, pool);
+          SVN_ERR(svn_cl__get_human_readable_tree_conflict_description(
+                            &desc,
+                            old_tree_conflict,
+                            pool));
           tree_desc_line = apr_psprintf(pool, "\n      >   %s", desc);
           (*tree_conflicts)++;
         }

Modified: subversion/branches/ignore-mergeinfo/subversion/svn/switch-cmd.c
URL: http://svn.apache.org/viewvc/subversion/branches/ignore-mergeinfo/subversion/svn/switch-cmd.c?rev=1044548&r1=1044547&r2=1044548&view=diff
==============================================================================
--- subversion/branches/ignore-mergeinfo/subversion/svn/switch-cmd.c (original)
+++ subversion/branches/ignore-mergeinfo/subversion/svn/switch-cmd.c Sat Dec 11 00:15:55 2010
@@ -41,13 +41,13 @@
 
 static svn_error_t *
 rewrite_urls(const apr_array_header_t *targets,
+             svn_boolean_t ignore_externals,
              svn_client_ctx_t *ctx,
              apr_pool_t *pool)
 {
   apr_pool_t *subpool;
   const char *from;
   const char *to;
-  int i;
 
   if (targets->nelts < 2)
     return svn_error_create(SVN_ERR_CL_INSUFFICIENT_ARGS, 0, NULL);
@@ -66,15 +66,19 @@ rewrite_urls(const apr_array_header_t *t
 
   if (targets->nelts == 2)
     {
-      SVN_ERR(svn_client_relocate2("", from, to, ctx, pool));
+      SVN_ERR(svn_client_relocate2("", from, to, ignore_externals,
+                                   ctx, pool));
     }
   else
     {
+      int i;
+
       for (i = 2; i < targets->nelts; i++)
         {
           const char *target = APR_ARRAY_IDX(targets, i, const char *);
           svn_pool_clear(subpool);
-          SVN_ERR(svn_client_relocate2(target, from, to, ctx, subpool));
+          SVN_ERR(svn_client_relocate2(target, from, to,
+                                       ignore_externals, ctx, subpool));
         }
     }
 
@@ -97,6 +101,7 @@ svn_cl__switch(apr_getopt_t *os,
   svn_opt_revision_t peg_revision;
   svn_depth_t depth;
   svn_boolean_t depth_is_sticky;
+  struct svn_cl__check_externals_failed_notify_baton nwb;
 
   /* This command should discover (or derive) exactly two cmdline
      arguments: a local path to update ("target"), and a new url to
@@ -107,7 +112,8 @@ svn_cl__switch(apr_getopt_t *os,
 
   /* handle only-rewrite case specially */
   if (opt_state->relocate)
-    return rewrite_urls(targets, ctx, scratch_pool);
+    return rewrite_urls(targets, opt_state->ignore_externals,
+                        ctx, scratch_pool);
 
   if (targets->nelts < 1)
     return svn_error_create(SVN_ERR_CL_INSUFFICIENT_ARGS, 0, NULL);
@@ -138,6 +144,12 @@ svn_cl__switch(apr_getopt_t *os,
       (SVN_ERR_BAD_URL, NULL,
        _("'%s' does not appear to be a URL"), switch_url);
 
+  /* Target path cannot be URL */
+  if (svn_path_is_url(target))
+    return svn_error_createf(SVN_ERR_CL_ARG_PARSING_ERROR, NULL,
+                             _("'%s' is not a local path"),
+                             target);
+
   /* Canonicalize the URL. */
   switch_url = svn_uri_canonicalize(switch_url, scratch_pool);
 
@@ -153,6 +165,12 @@ svn_cl__switch(apr_getopt_t *os,
       depth_is_sticky = FALSE;
     }
 
+  nwb.wrapped_func = ctx->notify_func2;
+  nwb.wrapped_baton = ctx->notify_baton2;
+  nwb.had_externals_error = FALSE;
+  ctx->notify_func2 = svn_cl__check_externals_failed_notify_wrapper;
+  ctx->notify_baton2 = &nwb;
+
   /* Do the 'switch' update. */
   SVN_ERR(svn_client_switch2(NULL, target, switch_url, &peg_revision,
                              &(opt_state->start_revision), depth,
@@ -160,7 +178,12 @@ svn_cl__switch(apr_getopt_t *os,
                              opt_state->force, ctx, scratch_pool));
 
   if (! opt_state->quiet)
-    SVN_ERR(svn_cl__print_conflict_stats(ctx->notify_baton2, scratch_pool));
+    SVN_ERR(svn_cl__print_conflict_stats(nwb.wrapped_baton, scratch_pool));
+
+  if (nwb.had_externals_error)
+    return svn_error_create(SVN_ERR_CL_ERROR_PROCESSING_EXTERNALS, NULL,
+                            _("Failure occurred processing one or more "
+                              "externals definitions"));
 
   return SVN_NO_ERROR;
 }

Modified: subversion/branches/ignore-mergeinfo/subversion/svn/unlock-cmd.c
URL: http://svn.apache.org/viewvc/subversion/branches/ignore-mergeinfo/subversion/svn/unlock-cmd.c?rev=1044548&r1=1044547&r2=1044548&view=diff
==============================================================================
--- subversion/branches/ignore-mergeinfo/subversion/svn/unlock-cmd.c (original)
+++ subversion/branches/ignore-mergeinfo/subversion/svn/unlock-cmd.c Sat Dec 11 00:15:55 2010
@@ -27,6 +27,7 @@
 
 /*** Includes. ***/
 
+#include "svn_path.h"
 #include "svn_pools.h"
 #include "svn_client.h"
 #include "svn_error_codes.h"
@@ -59,6 +60,8 @@ svn_cl__unlock(apr_getopt_t *os,
 
   SVN_ERR(svn_cl__eat_peg_revisions(&targets, targets, scratch_pool));
 
+  SVN_ERR(svn_cl__assert_homogeneous_target_type(targets));
+
   return svn_error_return(
     svn_client_unlock(targets, opt_state->force, ctx, scratch_pool));
 }

Modified: subversion/branches/ignore-mergeinfo/subversion/svn/update-cmd.c
URL: http://svn.apache.org/viewvc/subversion/branches/ignore-mergeinfo/subversion/svn/update-cmd.c?rev=1044548&r1=1044547&r2=1044548&view=diff
==============================================================================
--- subversion/branches/ignore-mergeinfo/subversion/svn/update-cmd.c (original)
+++ subversion/branches/ignore-mergeinfo/subversion/svn/update-cmd.c Sat Dec 11 00:15:55 2010
@@ -39,6 +39,64 @@
 
 /*** Code. ***/
 
+/* Print an update summary when there's more than one target to report
+   about.  Each (const char *) path in TARGETS is an absolute or relative
+   dirent, and each (svn_revnum_t) entry in RESULT_REVS is the corresponding
+   updated revision, or SVN_INVALID_REVNUM if not a valid target. */
+static svn_error_t *
+print_update_summary(apr_array_header_t *targets,
+                     apr_array_header_t *result_revs,
+                     apr_pool_t *scratch_pool)
+{
+  int i;
+  const char *path_prefix;
+  apr_pool_t *iter_pool;
+
+  if (targets->nelts < 2)
+    return SVN_NO_ERROR;
+
+  SVN_ERR(svn_dirent_get_absolute(&path_prefix, "", scratch_pool));
+  SVN_ERR(svn_cmdline_printf(scratch_pool, _("Summary of updates:\n")));
+
+  iter_pool = svn_pool_create(scratch_pool);
+
+  for (i = 0; i < targets->nelts; i++)
+    {
+      const char *path = APR_ARRAY_IDX(targets, i, const char *);
+      svn_revnum_t rev = SVN_INVALID_REVNUM;
+
+      svn_pool_clear(iter_pool);
+
+      /* PATH shouldn't be a URL. */
+      SVN_ERR_ASSERT(! svn_path_is_url(path));
+
+      /* Grab the result revision from the corresponding slot in our
+         RESULT_REVS array. */
+      if (i < result_revs->nelts)
+        rev = APR_ARRAY_IDX(result_revs, i, svn_revnum_t);
+
+      /* No result rev?  We must have skipped this path.  At any rate,
+         nothing to report here. */
+      if (! SVN_IS_VALID_REVNUM(rev))
+        continue;
+
+      /* Convert to an absolute path if it's not already. */
+      if (! svn_dirent_is_absolute(path))
+        SVN_ERR(svn_dirent_get_absolute(&path, path, iter_pool));
+      path = svn_dirent_local_style(svn_dirent_skip_ancestor(path_prefix,
+                                                             path), iter_pool);
+
+      /* Print an update summary for this target, removing the current
+         working directory prefix from PATH (if PATH is at or under
+         $CWD), and converting the path to local style for display. */
+      SVN_ERR(svn_cmdline_printf(iter_pool, _("  Updated '%s' to r%ld.\n"),
+                                 path, rev));
+    }
+
+  svn_pool_destroy(iter_pool);
+  return SVN_NO_ERROR;
+}
+
 /* This implements the `svn_opt_subcommand_t' interface. */
 svn_error_t *
 svn_cl__update(apr_getopt_t *os,
@@ -50,6 +108,9 @@ svn_cl__update(apr_getopt_t *os,
   apr_array_header_t *targets;
   svn_depth_t depth;
   svn_boolean_t depth_is_sticky;
+  struct svn_cl__check_externals_failed_notify_baton nwb;
+  apr_array_header_t *result_revs;
+  int i;
 
   SVN_ERR(svn_cl__args_to_target_array_print_reserved(&targets, os,
                                                       opt_state->targets,
@@ -60,6 +121,16 @@ svn_cl__update(apr_getopt_t *os,
 
   SVN_ERR(svn_cl__eat_peg_revisions(&targets, targets, scratch_pool));
 
+  /* If any targets are URLs, display error message and exit. */
+  for (i = 0; i < targets->nelts; i++)
+    {
+      const char *target = APR_ARRAY_IDX(targets, i, const char *);
+
+      if (svn_path_is_url(target))
+        return svn_error_createf(SVN_ERR_CL_ARG_PARSING_ERROR, NULL,
+                                 _("'%s' is not a local path"), target);
+    }
+
   /* If using changelists, convert targets into a set of paths that
      match the specified changelist(s). */
   if (opt_state->changelists)
@@ -85,15 +156,33 @@ svn_cl__update(apr_getopt_t *os,
       depth_is_sticky = FALSE;
     }
 
-  SVN_ERR(svn_client_update3(NULL, targets,
+  nwb.wrapped_func = ctx->notify_func2;
+  nwb.wrapped_baton = ctx->notify_baton2;
+  nwb.had_externals_error = FALSE;
+  ctx->notify_func2 = svn_cl__check_externals_failed_notify_wrapper;
+  ctx->notify_baton2 = &nwb;
+  
+  SVN_ERR(svn_client_update4(&result_revs, targets,
                              &(opt_state->start_revision),
                              depth, depth_is_sticky,
                              opt_state->ignore_externals,
-                             opt_state->force,
+                             opt_state->force, opt_state->parents,
                              ctx, scratch_pool));
 
   if (! opt_state->quiet)
-    SVN_ERR(svn_cl__print_conflict_stats(ctx->notify_baton2, scratch_pool));
+    {
+      SVN_ERR(print_update_summary(targets, result_revs, scratch_pool));
+
+      /* ### Layering problem: This call assumes that the baton we're
+       * passing is the one that was originally provided by
+       * svn_cl__get_notifier(), but that isn't promised. */
+      SVN_ERR(svn_cl__print_conflict_stats(nwb.wrapped_baton, scratch_pool));
+    }
+
+  if (nwb.had_externals_error)
+    return svn_error_create(SVN_ERR_CL_ERROR_PROCESSING_EXTERNALS, NULL,
+                            _("Failure occurred processing one or more "
+                              "externals definitions"));
 
   return SVN_NO_ERROR;
 }

Modified: subversion/branches/ignore-mergeinfo/subversion/svn/upgrade-cmd.c
URL: http://svn.apache.org/viewvc/subversion/branches/ignore-mergeinfo/subversion/svn/upgrade-cmd.c?rev=1044548&r1=1044547&r2=1044548&view=diff
==============================================================================
--- subversion/branches/ignore-mergeinfo/subversion/svn/upgrade-cmd.c (original)
+++ subversion/branches/ignore-mergeinfo/subversion/svn/upgrade-cmd.c Sat Dec 11 00:15:55 2010
@@ -67,10 +67,8 @@ svn_cl__upgrade(apr_getopt_t *os,
       const char *target = APR_ARRAY_IDX(targets, i, const char *);
 
       if (svn_path_is_url(target))
-        return svn_error_return(svn_error_createf(SVN_ERR_CL_ARG_PARSING_ERROR,
-                                                  NULL,
-                                                  _("'%s' is not a local path"),
-                                                  target));
+        return svn_error_createf(SVN_ERR_CL_ARG_PARSING_ERROR, NULL,
+                                 _("'%s' is not a local path"), target);
     }
 
   iterpool = svn_pool_create(scratch_pool);

Modified: subversion/branches/ignore-mergeinfo/subversion/svn/util.c
URL: http://svn.apache.org/viewvc/subversion/branches/ignore-mergeinfo/subversion/svn/util.c?rev=1044548&r1=1044547&r2=1044548&view=diff
==============================================================================
--- subversion/branches/ignore-mergeinfo/subversion/svn/util.c (original)
+++ subversion/branches/ignore-mergeinfo/subversion/svn/util.c Sat Dec 11 00:15:55 2010
@@ -61,6 +61,7 @@
 
 #include "private/svn_token.h"
 #include "private/svn_opt_private.h"
+#include "private/svn_client_private.h"
 
 
 
@@ -71,8 +72,13 @@ svn_cl__print_commit_info(const svn_comm
                           apr_pool_t *pool)
 {
   if (SVN_IS_VALID_REVNUM(commit_info->revision))
-    SVN_ERR(svn_cmdline_printf(pool, _("\nCommitted revision %ld.\n"),
-                               commit_info->revision));
+    SVN_ERR(svn_cmdline_printf(pool, _("\nCommitted revision %ld%s.\n"),
+                               commit_info->revision,
+                               commit_info->revision == 42 &&
+                               getenv("SVN_I_LOVE_PANGALACTIC_GARGLE_BLASTERS")
+                                 ?  _(" (the answer to life, the universe, "
+                                      "and everything)")
+                                 : ""));
 
   /* Writing to stdout, as there maybe systems that consider the
    * presence of stderr as an indication of commit failure.
@@ -826,14 +832,14 @@ svn_cl__get_log_message(const char **log
              white space as we will consider white space only as empty */
           apr_size_t len;
 
-          for (len = message->len - 1; len >= 0; len--)
+          for (len = 0; len < message->len; len++)
             {
               /* FIXME: should really use an UTF-8 whitespace test
                  rather than svn_ctype_isspace, which is ASCII only */
               if (! svn_ctype_isspace(message->data[len]))
                 break;
             }
-          if (len < 0)
+          if (len == message->len)
             message = NULL;
         }
 
@@ -906,9 +912,6 @@ svn_cl__may_need_force(svn_error_t *err)
 svn_error_t *
 svn_cl__error_checked_fputs(const char *string, FILE* stream)
 {
-  /* This function is equal to svn_cmdline_fputs() minus
-     the utf8->local encoding translation */
-
   /* On POSIX systems, errno will be set on an error in fputs, but this might
      not be the case on other platforms.  We reset errno and only
      use it if it was set by the below fputs call.  Else, we just return
@@ -1327,3 +1330,32 @@ svn_cl__eat_peg_revisions(apr_array_head
 
   return SVN_NO_ERROR;
 }
+
+svn_error_t *
+svn_cl__opt_parse_path(svn_opt_revision_t *rev,
+                       const char **truepath,
+                       const char *path /* UTF-8! */,
+                       apr_pool_t *pool)
+{
+  SVN_ERR(svn_opt_parse_path(rev, truepath, path, pool));
+  
+  if (svn_path_is_url(*truepath))
+    *truepath = svn_uri_canonicalize(*truepath, pool);
+  else
+    *truepath = svn_dirent_canonicalize(*truepath, pool);
+
+  return SVN_NO_ERROR;
+}
+
+svn_error_t *
+svn_cl__assert_homogeneous_target_type(const apr_array_header_t *targets)
+{
+  svn_error_t *err;
+
+  err = svn_client__assert_homogeneous_target_type(targets);
+  if (err && err->apr_err == SVN_ERR_ILLEGAL_TARGET)
+    return svn_error_createf(SVN_ERR_CL_ARG_PARSING_ERROR, err,
+                             _("Cannot mix repository and working copy "
+                               "targets"));
+  return err;
+}

Modified: subversion/branches/ignore-mergeinfo/subversion/svnadmin/main.c
URL: http://svn.apache.org/viewvc/subversion/branches/ignore-mergeinfo/subversion/svnadmin/main.c?rev=1044548&r1=1044547&r2=1044548&view=diff
==============================================================================
--- subversion/branches/ignore-mergeinfo/subversion/svnadmin/main.c (original)
+++ subversion/branches/ignore-mergeinfo/subversion/svnadmin/main.c Sat Dec 11 00:15:55 2010
@@ -1594,7 +1594,7 @@ main(int argc, const char *argv[])
 
   if (argc <= 1)
     {
-      subcommand_help(NULL, NULL, pool);
+      SVN_INT_ERR(subcommand_help(NULL, NULL, pool));
       svn_pool_destroy(pool);
       return EXIT_FAILURE;
     }
@@ -1621,7 +1621,7 @@ main(int argc, const char *argv[])
         break;
       else if (apr_err)
         {
-          subcommand_help(NULL, NULL, pool);
+          SVN_INT_ERR(subcommand_help(NULL, NULL, pool));
           svn_pool_destroy(pool);
           return EXIT_FAILURE;
         }
@@ -1734,7 +1734,7 @@ main(int argc, const char *argv[])
         break;
       default:
         {
-          subcommand_help(NULL, NULL, pool);
+          SVN_INT_ERR(subcommand_help(NULL, NULL, pool));
           svn_pool_destroy(pool);
           return EXIT_FAILURE;
         }
@@ -1768,7 +1768,7 @@ main(int argc, const char *argv[])
             {
               svn_error_clear(svn_cmdline_fprintf(stderr, pool,
                                         _("subcommand argument required\n")));
-              subcommand_help(NULL, NULL, pool);
+              SVN_INT_ERR(subcommand_help(NULL, NULL, pool));
               svn_pool_destroy(pool);
               return EXIT_FAILURE;
             }
@@ -1786,7 +1786,7 @@ main(int argc, const char *argv[])
               svn_error_clear(svn_cmdline_fprintf(stderr, pool,
                                                   _("Unknown command: '%s'\n"),
                                                   first_arg_utf8));
-              subcommand_help(NULL, NULL, pool);
+              SVN_INT_ERR(subcommand_help(NULL, NULL, pool));
               svn_pool_destroy(pool);
               return EXIT_FAILURE;
             }
@@ -1837,7 +1837,7 @@ main(int argc, const char *argv[])
                                           pool);
           svn_opt_format_option(&optstr, badopt, FALSE, pool);
           if (subcommand->name[0] == '-')
-            subcommand_help(NULL, NULL, pool);
+            SVN_INT_ERR(subcommand_help(NULL, NULL, pool));
           else
             svn_error_clear(svn_cmdline_fprintf(stderr, pool
                             , _("Subcommand '%s' doesn't accept option '%s'\n"

Modified: subversion/branches/ignore-mergeinfo/subversion/svndumpfilter/main.c
URL: http://svn.apache.org/viewvc/subversion/branches/ignore-mergeinfo/subversion/svndumpfilter/main.c?rev=1044548&r1=1044547&r2=1044548&view=diff
==============================================================================
--- subversion/branches/ignore-mergeinfo/subversion/svndumpfilter/main.c (original)
+++ subversion/branches/ignore-mergeinfo/subversion/svndumpfilter/main.c Sat Dec 11 00:15:55 2010
@@ -485,9 +485,10 @@ new_node_record(void **node_baton,
                                APR_HASH_KEY_STRING);
 
   /* Ensure that paths start with a leading '/'. */
-  node_path = svn_uri_join("/", node_path, pool);
-  if (copyfrom_path)
-    copyfrom_path = svn_uri_join("/", copyfrom_path, pool);
+  if (node_path[0] != '/')
+    node_path = apr_pstrcat(pool, "/", node_path, (char *)NULL);
+  if (copyfrom_path && copyfrom_path[0] != '/')
+    copyfrom_path = apr_pstrcat(pool, "/", copyfrom_path, (char *)NULL);
 
   nb->do_skip = skip_path(node_path, pb->prefixes,
                           pb->do_exclude, pb->glob);
@@ -702,7 +703,6 @@ adjust_mergeinfo(svn_string_t **final_va
       const char *merge_source = svn__apr_hash_index_key(hi);
       apr_array_header_t *rangelist = svn__apr_hash_index_val(hi);
       struct parse_baton_t *pb = rb->pb;
-      int i;
 
       /* Determine whether the merge_source is a part of the prefix. */
       if (skip_path(merge_source, pb->prefixes, pb->do_exclude, pb->glob))
@@ -719,6 +719,8 @@ adjust_mergeinfo(svn_string_t **final_va
       /* Possibly renumber revisions in merge source's rangelist. */
       if (pb->do_renumber_revs)
         {
+          int i;
+
           for (i = 0; i < rangelist->nelts; i++)
             {
               struct revmap_t *revmap_start;
@@ -1292,7 +1294,7 @@ main(int argc, const char *argv[])
 
   if (argc <= 1)
     {
-      subcommand_help(NULL, NULL, pool);
+      SVN_INT_ERR(subcommand_help(NULL, NULL, pool));
       svn_pool_destroy(pool);
       return EXIT_FAILURE;
     }
@@ -1318,7 +1320,7 @@ main(int argc, const char *argv[])
         break;
       else if (apr_err)
         {
-          subcommand_help(NULL, NULL, pool);
+          SVN_INT_ERR(subcommand_help(NULL, NULL, pool));
           svn_pool_destroy(pool);
           return EXIT_FAILURE;
         }
@@ -1357,7 +1359,7 @@ main(int argc, const char *argv[])
           break;
         default:
           {
-            subcommand_help(NULL, NULL, pool);
+            SVN_INT_ERR(subcommand_help(NULL, NULL, pool));
             svn_pool_destroy(pool);
             return EXIT_FAILURE;
           }
@@ -1392,7 +1394,7 @@ main(int argc, const char *argv[])
               svn_error_clear(svn_cmdline_fprintf
                               (stderr, pool,
                                _("Subcommand argument required\n")));
-              subcommand_help(NULL, NULL, pool);
+              SVN_INT_ERR(subcommand_help(NULL, NULL, pool));
               svn_pool_destroy(pool);
               return EXIT_FAILURE;
             }
@@ -1412,7 +1414,7 @@ main(int argc, const char *argv[])
               svn_error_clear(svn_cmdline_fprintf(stderr, pool,
                                                   _("Unknown command: '%s'\n"),
                                                   first_arg_utf8));
-              subcommand_help(NULL, NULL, pool);
+              SVN_INT_ERR(subcommand_help(NULL, NULL, pool));
               svn_pool_destroy(pool);
               return EXIT_FAILURE;
             }
@@ -1436,7 +1438,8 @@ main(int argc, const char *argv[])
              style, and absolute. */
           SVN_INT_ERR(svn_utf_cstring_to_utf8(&prefix, os->argv[i], pool));
           prefix = svn_relpath_internal_style(prefix, pool);
-          prefix = svn_uri_join("/", prefix, pool);
+          if (prefix[0] != '/')
+            prefix = apr_pstrcat(pool, "/", prefix, (char *)NULL);
           APR_ARRAY_PUSH(opt_state.prefixes, const char *) = prefix;
         }
 
@@ -1493,7 +1496,7 @@ main(int argc, const char *argv[])
                                           pool);
           svn_opt_format_option(&optstr, badopt, FALSE, pool);
           if (subcommand->name[0] == '-')
-            subcommand_help(NULL, NULL, pool);
+            SVN_INT_ERR(subcommand_help(NULL, NULL, pool));
           else
             svn_error_clear(svn_cmdline_fprintf
                             (stderr, pool,

Modified: subversion/branches/ignore-mergeinfo/subversion/svnlook/main.c
URL: http://svn.apache.org/viewvc/subversion/branches/ignore-mergeinfo/subversion/svnlook/main.c?rev=1044548&r1=1044547&r2=1044548&view=diff
==============================================================================
--- subversion/branches/ignore-mergeinfo/subversion/svnlook/main.c (original)
+++ subversion/branches/ignore-mergeinfo/subversion/svnlook/main.c Sat Dec 11 00:15:55 2010
@@ -1186,7 +1186,6 @@ print_tree(svn_fs_root_t *root,
            apr_pool_t *pool)
 {
   apr_pool_t *subpool;
-  int i;
   apr_hash_t *entries;
   apr_hash_index_t *hi;
   const char* name;
@@ -1195,16 +1194,19 @@ print_tree(svn_fs_root_t *root,
 
   /* Print the indentation. */
   if (!full_paths)
-    for (i = 0; i < indentation; i++)
-      SVN_ERR(svn_cmdline_fputs(" ", stdout, pool));
+    {
+      int i;
+      for (i = 0; i < indentation; i++)
+        SVN_ERR(svn_cmdline_fputs(" ", stdout, pool));
+    }
 
   /* ### The path format is inconsistent.. needs fix */
   if (full_paths)
     name = path;
   else if (*path == '/')
-    name = svn_uri_basename(path, pool);
+    name = svn_fspath__basename(path, pool);
   else
-    name = svn_relpath_basename(path, pool);
+    name = svn_relpath_basename(path, NULL);
 
   if (svn_path_is_empty(name))
     name = "/"; /* basename of '/' is "" */
@@ -1242,7 +1244,7 @@ print_tree(svn_fs_root_t *root,
           svn_pool_clear(subpool);
           SVN_ERR(print_tree(root,
                              (*path == '/')
-                                 ? svn_uri_join(path, entry->name, pool)
+                                 ? svn_fspath__join(path, entry->name, pool)
                                  : svn_relpath_join(path, entry->name, pool),
                              entry->id, (entry->kind == svn_node_dir),
                              indentation + 1, show_ids, full_paths,
@@ -1839,6 +1841,24 @@ warning_func(void *baton,
 }
 
 
+/* Return an error if the number of arguments (excluding the repository
+ * argument) is not NUM_ARGS.  NUM_ARGS must be 0 or 1.  The arguments
+ * are assumed to be found in OPT_STATE->arg1 and OPT_STATE->arg2. */
+static svn_error_t *
+check_number_of_args(struct svnlook_opt_state *opt_state,
+                     int num_args)
+{
+  if ((num_args == 0 && opt_state->arg1 != NULL)
+      || (num_args == 1 && opt_state->arg2 != NULL))
+    return svn_error_create(SVN_ERR_CL_ARG_PARSING_ERROR, NULL,
+                            _("Too many arguments given"));
+  if ((num_args == 1 && opt_state->arg1 == NULL))
+    return svn_error_create(SVN_ERR_CL_INSUFFICIENT_ARGS, NULL,
+                            _("Missing repository path argument"));
+  return SVN_NO_ERROR;
+}
+
+
 /* Factory function for the context baton. */
 static svn_error_t *
 get_ctxt_baton(svnlook_ctxt_t **baton_p,
@@ -1885,6 +1905,8 @@ subcommand_author(apr_getopt_t *os, void
   struct svnlook_opt_state *opt_state = baton;
   svnlook_ctxt_t *c;
 
+  SVN_ERR(check_number_of_args(opt_state, 0));
+
   SVN_ERR(get_ctxt_baton(&c, opt_state, pool));
   SVN_ERR(do_author(c, pool));
   return SVN_NO_ERROR;
@@ -1897,10 +1919,7 @@ subcommand_cat(apr_getopt_t *os, void *b
   struct svnlook_opt_state *opt_state = baton;
   svnlook_ctxt_t *c;
 
-  if (opt_state->arg1 == NULL)
-    return svn_error_createf
-      (SVN_ERR_CL_INSUFFICIENT_ARGS, NULL,
-       _("Missing repository path argument"));
+  SVN_ERR(check_number_of_args(opt_state, 1));
 
   SVN_ERR(get_ctxt_baton(&c, opt_state, pool));
   SVN_ERR(do_cat(c, opt_state->arg1, pool));
@@ -1914,6 +1933,8 @@ subcommand_changed(apr_getopt_t *os, voi
   struct svnlook_opt_state *opt_state = baton;
   svnlook_ctxt_t *c;
 
+  SVN_ERR(check_number_of_args(opt_state, 0));
+
   SVN_ERR(get_ctxt_baton(&c, opt_state, pool));
   SVN_ERR(do_changed(c, pool));
   return SVN_NO_ERROR;
@@ -1926,6 +1947,8 @@ subcommand_date(apr_getopt_t *os, void *
   struct svnlook_opt_state *opt_state = baton;
   svnlook_ctxt_t *c;
 
+  SVN_ERR(check_number_of_args(opt_state, 0));
+
   SVN_ERR(get_ctxt_baton(&c, opt_state, pool));
   SVN_ERR(do_date(c, pool));
   return SVN_NO_ERROR;
@@ -1938,6 +1961,8 @@ subcommand_diff(apr_getopt_t *os, void *
   struct svnlook_opt_state *opt_state = baton;
   svnlook_ctxt_t *c;
 
+  SVN_ERR(check_number_of_args(opt_state, 0));
+
   SVN_ERR(get_ctxt_baton(&c, opt_state, pool));
   SVN_ERR(do_diff(c, pool));
   return SVN_NO_ERROR;
@@ -1950,6 +1975,8 @@ subcommand_dirschanged(apr_getopt_t *os,
   struct svnlook_opt_state *opt_state = baton;
   svnlook_ctxt_t *c;
 
+  SVN_ERR(check_number_of_args(opt_state, 0));
+
   SVN_ERR(get_ctxt_baton(&c, opt_state, pool));
   SVN_ERR(do_dirs_changed(c, pool));
   return SVN_NO_ERROR;
@@ -1962,10 +1989,7 @@ subcommand_filesize(apr_getopt_t *os, vo
   struct svnlook_opt_state *opt_state = baton;
   svnlook_ctxt_t *c;
 
-  if (opt_state->arg1 == NULL)
-    return svn_error_createf
-      (SVN_ERR_CL_INSUFFICIENT_ARGS, NULL,
-       _("Missing repository path argument"));
+  SVN_ERR(check_number_of_args(opt_state, 1));
 
   SVN_ERR(get_ctxt_baton(&c, opt_state, pool));
   SVN_ERR(do_filesize(c, opt_state->arg1, pool));
@@ -2010,10 +2034,11 @@ subcommand_history(apr_getopt_t *os, voi
 {
   struct svnlook_opt_state *opt_state = baton;
   svnlook_ctxt_t *c;
-  const char *path = "/";
+  const char *path = (opt_state->arg1 ? opt_state->arg1 : "/");
 
-  if (opt_state->arg1)
-    path = opt_state->arg1;
+  if (opt_state->arg2 != NULL)
+    return svn_error_create(SVN_ERR_CL_ARG_PARSING_ERROR, NULL,
+                            _("Too many arguments given"));
 
   SVN_ERR(get_ctxt_baton(&c, opt_state, pool));
   SVN_ERR(do_history(c, path, pool));
@@ -2027,18 +2052,13 @@ subcommand_lock(apr_getopt_t *os, void *
 {
   struct svnlook_opt_state *opt_state = baton;
   svnlook_ctxt_t *c;
-  const char *path;
   svn_lock_t *lock;
 
-  if (opt_state->arg1)
-    path = opt_state->arg1;
-  else
-    return svn_error_create(SVN_ERR_CL_INSUFFICIENT_ARGS, NULL,
-                            _("Missing path argument"));
+  SVN_ERR(check_number_of_args(opt_state, 1));
 
   SVN_ERR(get_ctxt_baton(&c, opt_state, pool));
 
-  SVN_ERR(svn_fs_get_lock(&lock, c->fs, path, pool));
+  SVN_ERR(svn_fs_get_lock(&lock, c->fs, opt_state->arg1, pool));
 
   if (lock)
     {
@@ -2076,6 +2096,8 @@ subcommand_info(apr_getopt_t *os, void *
   struct svnlook_opt_state *opt_state = baton;
   svnlook_ctxt_t *c;
 
+  SVN_ERR(check_number_of_args(opt_state, 0));
+
   SVN_ERR(get_ctxt_baton(&c, opt_state, pool));
   SVN_ERR(do_author(c, pool));
   SVN_ERR(do_date(c, pool));
@@ -2090,6 +2112,8 @@ subcommand_log(apr_getopt_t *os, void *b
   struct svnlook_opt_state *opt_state = baton;
   svnlook_ctxt_t *c;
 
+  SVN_ERR(check_number_of_args(opt_state, 0));
+
   SVN_ERR(get_ctxt_baton(&c, opt_state, pool));
   SVN_ERR(do_log(c, FALSE, pool));
   return SVN_NO_ERROR;
@@ -2115,6 +2139,10 @@ subcommand_pget(apr_getopt_t *os, void *
         (SVN_ERR_CL_INSUFFICIENT_ARGS, NULL,
          _("Missing propname or repository path argument"));
     }
+  if ((opt_state->revprop && opt_state->arg2 != NULL)
+      || os->ind < os->argc)
+    return svn_error_create(SVN_ERR_CL_ARG_PARSING_ERROR, NULL,
+                            _("Too many arguments given"));
 
   SVN_ERR(get_ctxt_baton(&c, opt_state, pool));
   SVN_ERR(do_pget(c, opt_state->arg1,
@@ -2129,10 +2157,7 @@ subcommand_plist(apr_getopt_t *os, void 
   struct svnlook_opt_state *opt_state = baton;
   svnlook_ctxt_t *c;
 
-  if (!opt_state->revprop && opt_state->arg1 == NULL)
-    return svn_error_create
-      (SVN_ERR_CL_INSUFFICIENT_ARGS, NULL,
-       _("Missing repository path argument"));
+  SVN_ERR(check_number_of_args(opt_state, opt_state->revprop ? 0 : 1));
 
   SVN_ERR(get_ctxt_baton(&c, opt_state, pool));
   SVN_ERR(do_plist(c, opt_state->revprop ? NULL : opt_state->arg1,
@@ -2147,6 +2172,10 @@ subcommand_tree(apr_getopt_t *os, void *
   struct svnlook_opt_state *opt_state = baton;
   svnlook_ctxt_t *c;
 
+  if (opt_state->arg2 != NULL)
+    return svn_error_create(SVN_ERR_CL_ARG_PARSING_ERROR, NULL,
+                            _("Too many arguments given"));
+
   SVN_ERR(get_ctxt_baton(&c, opt_state, pool));
   SVN_ERR(do_tree(c, opt_state->arg1 ? opt_state->arg1 : "",
                   opt_state->show_ids, opt_state->full_paths,
@@ -2161,6 +2190,8 @@ subcommand_youngest(apr_getopt_t *os, vo
   struct svnlook_opt_state *opt_state = baton;
   svnlook_ctxt_t *c;
 
+  SVN_ERR(check_number_of_args(opt_state, 0));
+
   SVN_ERR(get_ctxt_baton(&c, opt_state, pool));
   SVN_ERR(svn_cmdline_printf(pool, "%ld\n", c->rev_id));
   return SVN_NO_ERROR;
@@ -2174,6 +2205,8 @@ subcommand_uuid(apr_getopt_t *os, void *
   svnlook_ctxt_t *c;
   const char *uuid;
 
+  SVN_ERR(check_number_of_args(opt_state, 0));
+
   SVN_ERR(get_ctxt_baton(&c, opt_state, pool));
   SVN_ERR(svn_fs_get_uuid(c->fs, &uuid, pool));
   SVN_ERR(svn_cmdline_printf(pool, "%s\n", uuid));
@@ -2228,7 +2261,7 @@ main(int argc, const char *argv[])
 
   if (argc <= 1)
     {
-      subcommand_help(NULL, NULL, pool);
+      SVN_INT_ERR(subcommand_help(NULL, NULL, pool));
       svn_pool_destroy(pool);
       return EXIT_FAILURE;
     }
@@ -2253,7 +2286,7 @@ main(int argc, const char *argv[])
         break;
       else if (apr_err)
         {
-          subcommand_help(NULL, NULL, pool);
+          SVN_INT_ERR(subcommand_help(NULL, NULL, pool));
           svn_pool_destroy(pool);
           return EXIT_FAILURE;
         }
@@ -2353,7 +2386,7 @@ main(int argc, const char *argv[])
           break;
 
         default:
-          subcommand_help(NULL, NULL, pool);
+          SVN_INT_ERR(subcommand_help(NULL, NULL, pool));
           svn_pool_destroy(pool);
           return EXIT_FAILURE;
 
@@ -2395,7 +2428,7 @@ main(int argc, const char *argv[])
               svn_error_clear
                 (svn_cmdline_fprintf(stderr, pool,
                                      _("Subcommand argument required\n")));
-              subcommand_help(NULL, NULL, pool);
+              SVN_INT_ERR(subcommand_help(NULL, NULL, pool));
               svn_pool_destroy(pool);
               return EXIT_FAILURE;
             }
@@ -2415,7 +2448,7 @@ main(int argc, const char *argv[])
                 (svn_cmdline_fprintf(stderr, pool,
                                      _("Unknown command: '%s'\n"),
                                      first_arg_utf8));
-              subcommand_help(NULL, NULL, pool);
+              SVN_INT_ERR(subcommand_help(NULL, NULL, pool));
               svn_pool_destroy(pool);
               return EXIT_FAILURE;
             }
@@ -2447,7 +2480,7 @@ main(int argc, const char *argv[])
           svn_error_clear
             (svn_cmdline_fprintf(stderr, pool,
                                  _("Repository argument required\n")));
-          subcommand_help(NULL, NULL, pool);
+          SVN_INT_ERR(subcommand_help(NULL, NULL, pool));
           svn_pool_destroy(pool);
           return EXIT_FAILURE;
         }
@@ -2502,7 +2535,7 @@ main(int argc, const char *argv[])
                                           pool);
           svn_opt_format_option(&optstr, badopt, FALSE, pool);
           if (subcommand->name[0] == '-')
-            subcommand_help(NULL, NULL, pool);
+            SVN_INT_ERR(subcommand_help(NULL, NULL, pool));
           else
             svn_error_clear
               (svn_cmdline_fprintf

Modified: subversion/branches/ignore-mergeinfo/subversion/svnrdump/dump_editor.c
URL: http://svn.apache.org/viewvc/subversion/branches/ignore-mergeinfo/subversion/svnrdump/dump_editor.c?rev=1044548&r1=1044547&r2=1044548&view=diff
==============================================================================
--- subversion/branches/ignore-mergeinfo/subversion/svnrdump/dump_editor.c (original)
+++ subversion/branches/ignore-mergeinfo/subversion/svnrdump/dump_editor.c Sat Dec 11 00:15:55 2010
@@ -34,7 +34,7 @@
 
 #define ARE_VALID_COPY_ARGS(p,r) ((p) && SVN_IS_VALID_REVNUM(r))
 
-#ifdef SVN_DEBUG
+#if 0
 #define LDR_DBG(x) SVN_DBG(x)
 #else
 #define LDR_DBG(x) while(0)
@@ -45,7 +45,7 @@ struct dump_edit_baton {
   /* The output stream we write the dumpfile to */
   svn_stream_t *stream;
 
-  /* Pool for per-edit-session allocations */
+  /* Pool for per-revision allocations */
   apr_pool_t *pool;
 
   /* Properties which were modified during change_file_prop
@@ -59,9 +59,12 @@ struct dump_edit_baton {
   /* Temporary buffer to write property hashes to in human-readable
    * form. ### Is this really needed? */
   svn_stringbuf_t *propstring;
-   
-  /* Temporary file to write delta to along with its checksum. */
-  char *delta_abspath;
+
+  /* Temporary file used for textdelta application along with its
+     absolute path; these two variables should be allocated in the
+     per-edit-session pool */
+  const char *delta_abspath;
+  apr_file_t *delta_file;
 
   /* The checksum of the file the delta is being applied to */
   const char *base_checksum;
@@ -102,8 +105,8 @@ normalize_props(apr_hash_t *props,
   return SVN_NO_ERROR;
 }
 
-/* Make a directory baton to represent the directory at path (relative
- * to the edit_baton).
+/* Make a directory baton to represent the directory at PATH (relative
+ * to the EDIT_BATON).
  *
  * COPYFROM_PATH/COPYFROM_REV are the path/revision against which this
  * directory should be compared for changes. If the copyfrom
@@ -130,9 +133,12 @@ make_dir_baton(const char *path,
 
   /* Construct the full path of this node. */
   if (pb)
-    abspath = svn_uri_join("/", path, pool);
+    {
+      if (path[0] != '/')
+        abspath = apr_pstrcat(pool, "/", path, (char *)NULL);
+    }
   else
-    abspath = apr_pstrdup(pool, "/");
+    abspath = "/";
 
   /* Strip leading slash from copyfrom_path so that the path is
      canonical and svn_relpath_join can be used */
@@ -143,12 +149,11 @@ make_dir_baton(const char *path,
   new_db->eb = eb;
   new_db->parent_dir_baton = pb;
   new_db->abspath = abspath;
-  new_db->copyfrom_path = copyfrom_path ?
-    apr_pstrdup(pool, copyfrom_path) : NULL;
+  new_db->copyfrom_path = copyfrom_path;
   new_db->copyfrom_rev = copyfrom_rev;
   new_db->added = added;
   new_db->written_out = FALSE;
-  new_db->deleted_entries = apr_hash_make(eb->pool);
+  new_db->deleted_entries = apr_hash_make(pool);
 
   return new_db;
 }
@@ -168,13 +173,13 @@ dump_props(struct dump_edit_baton *eb,
   if (trigger_var && !*trigger_var)
     return SVN_NO_ERROR;
 
-  SVN_ERR(normalize_props(eb->props, pool));
+  SVN_ERR(normalize_props(eb->props, eb->pool));
   svn_stringbuf_setempty(eb->propstring);
   propstream = svn_stream_from_stringbuf(eb->propstring, eb->pool);
   SVN_ERR(svn_hash_write_incremental(eb->props, eb->deleted_props,
                                      propstream, "PROPS-END", pool));
   SVN_ERR(svn_stream_close(propstream));
-  
+
   /* Prop-delta: true */
   SVN_ERR(svn_stream_printf(eb->stream, pool,
                             SVN_REPOS_DUMPFILE_PROP_DELTA
@@ -202,8 +207,8 @@ dump_props(struct dump_edit_baton *eb,
       SVN_ERR(svn_stream_printf(eb->stream, pool, "\n\n"));
 
       /* Cleanup so that data is never dumped twice. */
-      svn_hash__clear(eb->props, pool);
-      svn_hash__clear(eb->deleted_props, pool);
+      SVN_ERR(svn_hash__clear(eb->props, eb->pool));
+      SVN_ERR(svn_hash__clear(eb->deleted_props, eb->pool));
       if (trigger_var)
         *trigger_var = FALSE;
     }
@@ -248,7 +253,7 @@ dump_node(struct dump_edit_baton *eb,
   /* Remove leading slashes from path and copyfrom_path */
   if (path)
     path = ((*path == '/') ? path + 1 : path);
-  
+
   if (copyfrom_path)
     copyfrom_path = ((*copyfrom_path == '/') ?
                      copyfrom_path + 1 : copyfrom_path);
@@ -287,7 +292,7 @@ dump_node(struct dump_edit_baton *eb,
                                     ": replace\n"));
 
           /* Wait for a change_*_prop to be called before dumping
-             anything */          
+             anything */
           eb->dump_props = TRUE;
           break;
         }
@@ -314,7 +319,7 @@ dump_node(struct dump_edit_baton *eb,
 
       /* We can leave this routine quietly now. Nothing more to do-
          print a couple of newlines because we're not dumping props or
-         text. */      
+         text. */
       SVN_ERR(svn_stream_printf(eb->stream, pool, "\n\n"));
       break;
 
@@ -333,7 +338,7 @@ dump_node(struct dump_edit_baton *eb,
              add_file, open_file. change_dir_prop is a special case. */
 
           /* Wait for a change_*_prop to be called before dumping
-             anything */          
+             anything */
           eb->dump_props = TRUE;
           break;
         }
@@ -351,7 +356,7 @@ dump_node(struct dump_edit_baton *eb,
          (along with the necessary PROPS-END\n\n and we're good. So
          set a dump_newlines here to print the newlines unless
          change_dir_prop is called next otherwise the `svnadmin load`
-         parser will fail.  */ 
+         parser will fail.  */
       if (kind == svn_node_dir)
         eb->dump_newlines = TRUE;
 
@@ -367,16 +372,16 @@ open_root(void *edit_baton,
           void **root_baton)
 {
   struct dump_edit_baton *eb = edit_baton;
-  /* Allocate a special pool for the edit_baton to avoid pool
-     lifetime issues */
 
-  eb->pool = svn_pool_create(pool);
+  /* Clear the per-revision pool after each revision */
+  svn_pool_clear(eb->pool);
+
   eb->props = apr_hash_make(eb->pool);
   eb->deleted_props = apr_hash_make(eb->pool);
   eb->propstring = svn_stringbuf_create("", eb->pool);
 
   *root_baton = make_dir_baton(NULL, NULL, SVN_INVALID_REVNUM,
-                               edit_baton, NULL, FALSE, pool);
+                               edit_baton, NULL, FALSE, eb->pool);
   LDR_DBG(("open_root %p\n", *root_baton));
 
   return SVN_NO_ERROR;
@@ -416,12 +421,14 @@ add_directory(const char *path,
 {
   struct dir_baton *pb = parent_baton;
   void *val;
-  struct dir_baton *new_db
-    = make_dir_baton(path, copyfrom_path, copyfrom_rev, pb->eb, pb, TRUE, pool);
+  struct dir_baton *new_db;
   svn_boolean_t is_copy;
 
   LDR_DBG(("add_directory %s\n", path));
 
+  new_db = make_dir_baton(path, copyfrom_path, copyfrom_rev, pb->eb,
+                          pb, TRUE, pb->eb->pool);
+
   /* Some pending properties to dump? */
   SVN_ERR(dump_props(pb->eb, &(pb->eb->dump_props), TRUE, pool));
 
@@ -478,13 +485,13 @@ open_directory(const char *path,
   if (pb && ARE_VALID_COPY_ARGS(pb->copyfrom_path, pb->copyfrom_rev))
     {
       copyfrom_path = svn_uri_join(pb->copyfrom_path,
-                                   svn_relpath_basename(path, pool),
-                                   pool);
+                                   svn_relpath_basename(path, NULL),
+                                   pb->eb->pool);
       copyfrom_rev = pb->copyfrom_rev;
     }
 
   new_db = make_dir_baton(path, copyfrom_path, copyfrom_rev, pb->eb, pb,
-                          FALSE, pool);
+                          FALSE, pb->eb->pool);
   *child_baton = new_db;
   return SVN_NO_ERROR;
 }
@@ -495,7 +502,6 @@ close_directory(void *dir_baton,
 {
   struct dir_baton *db = dir_baton;
   struct dump_edit_baton *eb = db->eb;
-  apr_pool_t *iterpool;
   apr_hash_index_t *hi;
 
   LDR_DBG(("close_directory %p\n", dir_baton));
@@ -506,11 +512,8 @@ close_directory(void *dir_baton,
   /* Some pending newlines to dump? */
   SVN_ERR(dump_newlines(eb, &(eb->dump_newlines), pool));
 
-  /* Create a pool just for iterations to allocate a loop variable */
-  iterpool = svn_pool_create(pool);
-
   /* Dump the deleted directory entries */
-  for (hi = apr_hash_first(iterpool, db->deleted_entries); hi;
+  for (hi = apr_hash_first(pool, db->deleted_entries); hi;
        hi = apr_hash_next(hi))
     {
       const void *key;
@@ -522,8 +525,7 @@ close_directory(void *dir_baton,
                         FALSE, NULL, SVN_INVALID_REVNUM, pool));
     }
 
-  svn_hash__clear(db->deleted_entries, pool);
-  svn_pool_destroy(iterpool);
+  SVN_ERR(svn_hash__clear(db->deleted_entries, pool));
   return SVN_NO_ERROR;
 }
 
@@ -597,7 +599,8 @@ open_file(const char *path,
   if (pb && ARE_VALID_COPY_ARGS(pb->copyfrom_path, pb->copyfrom_rev))
     {
       copyfrom_path = svn_relpath_join(pb->copyfrom_path,
-                                       svn_relpath_basename(path, pool), pool);
+                                       svn_relpath_basename(path, NULL),
+                                       pb->eb->pool);
       copyfrom_rev = pb->copyfrom_rev;
     }
 
@@ -625,10 +628,10 @@ change_dir_prop(void *parent_baton,
     return SVN_NO_ERROR;
 
   if (value)
-    apr_hash_set(db->eb->props, apr_pstrdup(pool, name),
-                 APR_HASH_KEY_STRING, svn_string_dup(value, pool));
+    apr_hash_set(db->eb->props, apr_pstrdup(db->eb->pool, name),
+                 APR_HASH_KEY_STRING, svn_string_dup(value, db->eb->pool));
   else
-    apr_hash_set(db->eb->deleted_props, apr_pstrdup(pool, name),
+    apr_hash_set(db->eb->deleted_props, apr_pstrdup(db->eb->pool, name),
                  APR_HASH_KEY_STRING, "");
 
   if (! db->written_out)
@@ -667,10 +670,10 @@ change_file_prop(void *file_baton,
     return SVN_NO_ERROR;
 
   if (value)
-    apr_hash_set(eb->props, apr_pstrdup(pool, name),
-                 APR_HASH_KEY_STRING, svn_string_dup(value, pool));
+    apr_hash_set(eb->props, apr_pstrdup(eb->pool, name),
+                 APR_HASH_KEY_STRING, svn_string_dup(value, eb->pool));
   else
-    apr_hash_set(eb->deleted_props, apr_pstrdup(pool, name),
+    apr_hash_set(eb->deleted_props, apr_pstrdup(eb->pool, name),
                  APR_HASH_KEY_STRING, "");
 
   /* Dump the property headers and wait; close_file might need
@@ -685,7 +688,6 @@ static svn_error_t *
 window_handler(svn_txdelta_window_t *window, void *baton)
 {
   struct handler_baton *hb = baton;
-  struct dump_edit_baton *eb = hb->eb;
   static svn_error_t *err;
 
   err = hb->apply_handler(window, hb->apply_baton);
@@ -695,11 +697,6 @@ window_handler(svn_txdelta_window_t *win
   if (err)
     SVN_ERR(err);
 
-  /* Write information about the filepath to hb->eb */
-  eb->delta_abspath = apr_pstrdup(eb->pool, hb->delta_abspath);
-
-  /* Cleanup */
-  svn_pool_destroy(hb->pool);
   return SVN_NO_ERROR;
 }
 
@@ -712,23 +709,23 @@ apply_textdelta(void *file_baton, const 
   struct dump_edit_baton *eb = file_baton;
 
   /* Custom handler_baton allocated in a separate pool */
-  apr_pool_t *handler_pool = svn_pool_create(pool);
-  struct handler_baton *hb = apr_pcalloc(handler_pool, sizeof(*hb));
-  hb->pool = handler_pool;
-  hb->eb = eb;
+  struct handler_baton *hb;
+  svn_stream_t *delta_filestream;
+
+  hb = apr_pcalloc(eb->pool, sizeof(*hb));
 
   LDR_DBG(("apply_textdelta %p\n", file_baton));
 
   /* Use a temporary file to measure the text-content-length */
-  SVN_ERR(svn_stream_open_unique(&(hb->delta_filestream), &hb->delta_abspath,
-                                 NULL, svn_io_file_del_none, hb->pool,
-                                 hb->pool));
+  delta_filestream = svn_stream_from_aprfile2(eb->delta_file, TRUE, pool);
 
-  /* Prepare to write the delta to the temporary file. */
+  /* Prepare to write the delta to the delta_filestream */
   svn_txdelta_to_svndiff2(&(hb->apply_handler), &(hb->apply_baton),
-                          hb->delta_filestream, 0, hb->pool);
+                          delta_filestream, 0, pool);
+
   eb->dump_text = TRUE;
-  eb->base_checksum = apr_pstrdup(pool, base_checksum);
+  eb->base_checksum = apr_pstrdup(eb->pool, base_checksum);
+  SVN_ERR(svn_stream_close(delta_filestream));
 
   /* The actual writing takes place when this function has
      finished. Set handler and handler_baton now so for
@@ -745,9 +742,10 @@ close_file(void *file_baton,
            apr_pool_t *pool)
 {
   struct dump_edit_baton *eb = file_baton;
-  apr_file_t *delta_file;
   svn_stream_t *delta_filestream;
   apr_finfo_t *info = apr_pcalloc(pool, sizeof(apr_finfo_t));
+  apr_off_t offset;
+  apr_status_t err;
 
   LDR_DBG(("close_file %p\n", file_baton));
 
@@ -763,7 +761,9 @@ close_file(void *file_baton,
                                 SVN_REPOS_DUMPFILE_TEXT_DELTA
                                 ": true\n"));
 
-      SVN_ERR(svn_io_stat(info, eb->delta_abspath, APR_FINFO_SIZE, pool));
+      err = apr_file_info_get(info, APR_FINFO_SIZE, eb->delta_file);
+      if (err)
+        SVN_ERR(svn_error_wrap_apr(err, NULL));
 
       if (eb->base_checksum)
         /* Text-delta-base-md5: */
@@ -778,7 +778,7 @@ close_file(void *file_baton,
                                 ": %lu\n",
                                 (unsigned long)info->size));
 
-      /* Text-content-md5: 82705804337e04dcd0e586bfa2389a7f */      
+      /* Text-content-md5: 82705804337e04dcd0e586bfa2389a7f */
       SVN_ERR(svn_stream_printf(eb->stream, pool,
                                 SVN_REPOS_DUMPFILE_TEXT_CONTENT_MD5
                                 ": %s\n",
@@ -806,25 +806,26 @@ close_file(void *file_baton,
 
       /* Cleanup */
       eb->dump_props = FALSE;
-      svn_hash__clear(eb->props, pool);
-      svn_hash__clear(eb->deleted_props, pool);
+      SVN_ERR(svn_hash__clear(eb->props, eb->pool));
+      SVN_ERR(svn_hash__clear(eb->deleted_props, eb->pool));
     }
 
   /* Dump the text */
   if (eb->dump_text)
     {
-      /* Open the temporary file, map it to a stream, copy
-         the stream to eb->stream, close and delete the
-         file */
-      SVN_ERR(svn_io_file_open(&delta_file, eb->delta_abspath, APR_READ,
-                               APR_OS_DEFAULT, pool));
-      delta_filestream = svn_stream_from_aprfile2(delta_file, TRUE, pool);
+      /* Seek to the beginning of the delta file, map it to a stream,
+         and copy the stream to eb->stream. Then close the stream and
+         truncate the file so we can reuse it for the next textdelta
+         application. Note that the file isn't created, opened or
+         closed here */
+      offset = 0;
+      SVN_ERR(svn_io_file_seek(eb->delta_file, APR_SET, &offset, pool));
+      delta_filestream = svn_stream_from_aprfile2(eb->delta_file, TRUE, pool);
       SVN_ERR(svn_stream_copy3(delta_filestream, eb->stream, NULL, NULL, pool));
 
       /* Cleanup */
-      SVN_ERR(svn_io_file_close(delta_file, pool));
       SVN_ERR(svn_stream_close(delta_filestream));
-      SVN_ERR(svn_io_remove_file2(eb->delta_abspath, TRUE, pool));
+      SVN_ERR(svn_io_file_trunc(eb->delta_file, 0, pool));
       eb->dump_text = FALSE;
     }
 
@@ -838,10 +839,6 @@ close_file(void *file_baton,
 static svn_error_t *
 close_edit(void *edit_baton, apr_pool_t *pool)
 {
-  struct dump_edit_baton *eb = edit_baton;
-  LDR_DBG(("close_edit\n"));
-  svn_pool_destroy(eb->pool);
-
   return SVN_NO_ERROR;
 }
 
@@ -849,6 +846,8 @@ svn_error_t *
 get_dump_editor(const svn_delta_editor_t **editor,
                 void **edit_baton,
                 svn_stream_t *stream,
+                svn_cancel_func_t cancel_func,
+                void *cancel_baton,
                 apr_pool_t *pool)
 {
   struct dump_edit_baton *eb;
@@ -857,6 +856,15 @@ get_dump_editor(const svn_delta_editor_t
   eb = apr_pcalloc(pool, sizeof(struct dump_edit_baton));
   eb->stream = stream;
 
+  /* Create a special per-revision pool */
+  eb->pool = svn_pool_create(pool);
+
+  /* Open a unique temporary file for all textdelta applications in
+     this edit session. The file is automatically closed and cleaned
+     up when the edit session is done. */
+  SVN_ERR(svn_io_open_unique_file3(&(eb->delta_file), &(eb->delta_abspath),
+                                   NULL, svn_io_file_del_on_close, pool, pool));
+
   de = svn_delta_default_editor(pool);
   de->open_root = open_root;
   de->delete_entry = delete_entry;
@@ -875,5 +883,7 @@ get_dump_editor(const svn_delta_editor_t
   *edit_baton = eb;
   *editor = de;
 
-  return SVN_NO_ERROR;
+  /* Wrap this editor in a cancellation editor. */
+  return svn_delta_get_cancellation_editor(cancel_func, cancel_baton,
+                                           de, eb, editor, edit_baton, pool);
 }

Modified: subversion/branches/ignore-mergeinfo/subversion/svnrdump/dump_editor.h
URL: http://svn.apache.org/viewvc/subversion/branches/ignore-mergeinfo/subversion/svnrdump/dump_editor.h?rev=1044548&r1=1044547&r2=1044548&view=diff
==============================================================================
--- subversion/branches/ignore-mergeinfo/subversion/svnrdump/dump_editor.h (original)
+++ subversion/branches/ignore-mergeinfo/subversion/svnrdump/dump_editor.h Sat Dec 11 00:15:55 2010
@@ -64,27 +64,20 @@ struct handler_baton
 {
   svn_txdelta_window_handler_t apply_handler;
   void *apply_baton;
-
-  /* Pool used for temporary allocations during delta application in
-     window_handler() */
-  apr_pool_t *pool;
-
-  /* Information about the path of the temporary file used */
-  const char *delta_abspath;
-  svn_stream_t *delta_filestream;
-
-  /* Global edit baton */
-  struct dump_edit_baton *eb;
 };
 
 /**
  * Get a dump editor @a editor along with a @a edit_baton allocated in
- * @a pool. The editor will write output to @a stream.
+ * @a pool.  The editor will write output to @a stream.  Use @a
+ * cancel_func and @a cancel_baton to check for user cancellation of
+ * the operation (for timely-but-safe termination).
  */
 svn_error_t *
 get_dump_editor(const svn_delta_editor_t **editor,
                 void **edit_baton,
                 svn_stream_t *stream,
+                svn_cancel_func_t cancel_func,
+                void *cancel_baton,
                 apr_pool_t *pool);
 
 /**



Mime
View raw message