[svn.haxx.se] · SVN Dev · SVN Users · SVN Org · TSVN Dev · TSVN Users · Subclipse Dev · Subclipse Users · this month's index

Re: [PATCH] Avoid treating urls as paths

From: D.J. Heap <dj_at_shadyvale.net>
Date: 2004-03-21 23:08:25 CET

D.J. Heap wrote:
> This passes all ra_local tests and manual testing. If it passes the
> other test suites and there's no objections, I'll commit it in a day or
> two.
>
> Log:
> Avoid calling svn_cmdline_path_local_style_from_utf8 on urls
> which turns forward slashes into backslashes on Windows.
>
> * subversion/clients/cmdline/propget-cmd.c
> (svn_cl__propget): Call svn_utf_cstring_from_utf8 if it's a url.
> * subversion/clients/cmdline/proplist-cmd.c
> (svn_cl__proplist): Call svn_utf_cstring_from_utf8 if it's a url.

After getting ready to commit this, I decided it must not be quite right
-- other areas of the commandline client use
svn_cmdline_cstring_from_utf8 rather than svn_utf_cstring_from_utf8 to
ensure proper handling of language encodings when outputting to the
console...such as the author and date in the log callback. I've tweaked
the log message callback with this patch also, but I can break that into
a separate patch if that's more desirable.

I think it's correct now, but it'd be nice if someone with more
encoding-fu could review it (Brane or ?).

Log:
Avoid calling svn_cmdline_path_local_style_from_utf8 on urls
which turns forward slashes into backslashes on Windows and
make sure log output is translated correctly.

* subversion/clients/cmdline/propget-cmd.c
  (svn_cl__propget): Call svn_cmdline_cstring_from_utf8 if it's a url.
* subversion/clients/cmdline/proplist-cmd.c
  (svn_cl__proplist): Call svn_cmdline_cstring_from_utf8 if it's a url.
* subversion/clients/cmdline/log-cmd.c
  (log_message_receiver): Use svn_cmdline_cstring_from_utf8 on the
   changed paths to ensure correct translation.

Index: subversion/clients/cmdline/propget-cmd.c
===================================================================
--- subversion/clients/cmdline/propget-cmd.c (revision 9172)
+++ subversion/clients/cmdline/propget-cmd.c (working copy)
@@ -31,6 +31,7 @@
 #include "svn_error.h"
 #include "svn_utf.h"
 #include "svn_subst.h"
+#include "svn_path.h"
 #include "cl.h"
 
 
@@ -141,6 +142,7 @@
           apr_hash_t *props;
           apr_hash_index_t *hi;
           svn_boolean_t print_filenames = FALSE;
+ svn_boolean_t is_url = svn_path_is_url (target);
 
           svn_pool_clear (subpool);
           SVN_ERR (svn_cl__check_cancel (ctx->cancel_baton));
@@ -176,8 +178,12 @@
               if (print_filenames)
                 {
                   const char *filename_stdout;
- SVN_ERR (svn_cmdline_path_local_style_from_utf8
- (&filename_stdout, filename, subpool));
+ if (! is_url)
+ SVN_ERR (svn_cmdline_path_local_style_from_utf8
+ (&filename_stdout, filename, subpool));
+ else
+ SVN_ERR (svn_cmdline_cstring_from_utf8
+ (&filename_stdout, filename, subpool));
                   SVN_ERR (stream_write (out, filename_stdout,
                                          strlen (filename_stdout)));
                   SVN_ERR (stream_write (out, " - ", 3));
Index: subversion/clients/cmdline/log-cmd.c
===================================================================
--- subversion/clients/cmdline/log-cmd.c (revision 9172)
+++ subversion/clients/cmdline/log-cmd.c (working copy)
@@ -279,7 +279,7 @@
           if (log_item->copyfrom_path
               && SVN_IS_VALID_REVNUM (log_item->copyfrom_rev))
             {
- SVN_ERR (svn_utf_cstring_from_utf8
+ SVN_ERR (svn_cmdline_cstring_from_utf8
                        (&path_stdout, log_item->copyfrom_path, pool));
               copy_data
                 = apr_psprintf (pool,
@@ -287,7 +287,7 @@
                                 path_stdout,
                                 log_item->copyfrom_rev);
             }
- SVN_ERR (svn_utf_cstring_from_utf8 (&path_stdout, path, pool));
+ SVN_ERR (svn_cmdline_cstring_from_utf8 (&path_stdout, path, pool));
           SVN_ERR (svn_stream_printf (lb->out, pool, " %c %s%s" APR_EOL_STR,
                                       log_item->action, path_stdout,
                                       copy_data));
Index: subversion/clients/cmdline/proplist-cmd.c
===================================================================
--- subversion/clients/cmdline/proplist-cmd.c (revision 9172)
+++ subversion/clients/cmdline/proplist-cmd.c (working copy)
@@ -29,6 +29,7 @@
 #include "svn_string.h"
 #include "svn_delta.h"
 #include "svn_error.h"
+#include "svn_path.h"
 #include "cl.h"
 
 
@@ -100,6 +101,7 @@
           apr_array_header_t *props;
           int j;
           svn_error_t *err;
+ svn_boolean_t is_url = svn_path_is_url (target);
 
           svn_pool_clear (subpool);
           SVN_ERR (svn_cl__check_cancel (ctx->cancel_baton));
@@ -126,8 +128,12 @@
               svn_client_proplist_item_t *item
                 = ((svn_client_proplist_item_t **)props->elts)[j];
               const char *node_name_stdout;
- SVN_ERR (svn_cmdline_path_local_style_from_utf8
- (&node_name_stdout, item->node_name->data, subpool));
+ if (! is_url)
+ SVN_ERR (svn_cmdline_path_local_style_from_utf8
+ (&node_name_stdout, item->node_name->data, subpool));
+ else
+ SVN_ERR (svn_cmdline_cstring_from_utf8
+ (&node_name_stdout, item->node_name->data, subpool));
               printf("Properties on '%s':\n", node_name_stdout);
               SVN_ERR (svn_cl__print_prop_hash
                        (item->prop_hash, (! opt_state->verbose), subpool));

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@subversion.tigris.org
For additional commands, e-mail: dev-help@subversion.tigris.org
Received on Sun Mar 21 23:08:44 2004

This is an archived mail posted to the Subversion Dev mailing list.

This site is subject to the Apache Privacy Policy and the Apache Public Forum Archive Policy.