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

Re: svn commit: r18204 - trunk/contrib/hook-scripts

From: Philip Martin <philip_at_codematters.co.uk>
Date: 2006-01-25 18:21:15 CET

martinto@tigris.org writes:

> Author: martinto
> Date: Tue Jan 24 10:16:30 2006
> New Revision: 18204
>
> Modified:
> trunk/contrib/hook-scripts/README
> trunk/contrib/hook-scripts/case-insensitive.py
>
> Log:
> * contrib/hook-scripts/case-insensitive.py:
> Output the 'clash' text as utf-8, previously ascii was used and
> non-ascii characters in files names caused the error message at the
> subversion client to read 'svn: General svn error from server'.
> Non ascii names such as Àbc.txt and àbc.txt are now displayed at
> the client when they clash.

> --- trunk/contrib/hook-scripts/case-insensitive.py (original)
> +++ trunk/contrib/hook-scripts/case-insensitive.py Tue Jan 24 10:16:30 2006
> @@ -85,11 +85,12 @@
> clashes[canonical_path][join_path(dir, name_pair[1])] = True
>
> if (clashes):
> + utfeight='utf-8'
> for canonical_path in clashes.iterkeys():
> - sys.stderr.write(u'Clash:'.encode(native))
> + sys.stderr.write(u'Clash:'.encode(utfeight))
> for path in clashes[canonical_path].iterkeys():
> - sys.stderr.write(u' \''.encode(native) +
> - str(path).decode('utf-8').encode(native, 'replace') +
> - u'\''.encode(native))
> - sys.stderr.write(u'\n'.encode(native))
> + sys.stderr.write(u' \''.encode(utfeight) +
> + str(path).decode('utf-8').encode(utfeight, 'replace') +
> + u'\''.encode(utfeight))
> + sys.stderr.write(u'\n'.encode(utfeight))
> sys.exit(1)

Forcing the hook script to output UTF-8 is not correct, hook scripts
are supposed to output in the native encoding[1]. The first thing that
libsvn_repos does with the hook output is convert from the native
encoding to UTF-8, it makes no sense for the hook to output UTF-8
unless the native encoding is also UTF-8. I believe the original code
was correct.

[1] httpd might be an exception since it doesn't set up the locales,
    in that case hook scripts probably need to restrict their output
    to plain ascii.

-- 
Philip Martin
---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@subversion.tigris.org
For additional commands, e-mail: dev-help@subversion.tigris.org
Received on Wed Jan 25 18:48:11 2006

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.