[Svnmerge] Patch for international support of SVN
Daniel Rall
dlr at collab.net
Tue Jan 30 14:33:49 PST 2007
On Tue, 30 Jan 2007, Thomas Heller wrote:
> Giovanni Bajo schrieb:
> > On 1/30/2007 4:23 PM, book at cpan.org wrote:
> >
> >> I just tried svnmerge for the first time (yeah, they removed the .py on
> >> Debian), but it wasn't very successful:
> >>
> >> $ svnmerge init -v -v
> >> svn propget --strict "svnmerge-integrated" "."
> >> svnmerge: calculate head path for the branch
> >> svn info "."
> >> Traceback (most recent call last):
> >> File "/usr/bin/svnmerge", line 1946, in ?
> >> main(sys.argv[1:])
> >> File "/usr/bin/svnmerge", line 1886, in main
> >> cf_head, cf_rev =3D get_copyfrom(branch_dir)
> >> File "/usr/bin/svnmerge", line 764, in get_copyfrom
> >> repos_path =3D target_to_repos_relative_path(dir)
> >> File "/usr/bin/svnmerge", line 754, in target_to_repos_relative_path
> >> root =3D get_repo_root(target)
> >> File "/usr/bin/svnmerge", line 726, in get_repo_root
> >> url =3D target_to_url(dir)
> >> File "/usr/bin/svnmerge", line 714, in target_to_url
> >> return info["URL"]
> >> KeyError: 'URL'
> >>
> >> Apparently, svnmerge hates me because I'm French:
> >>
> >> $ printenv LC_ALL
> >> fr_FR.UTF-8
> >> $ LC_ALL=C svnmerge init
> >> property 'svnmerge-integrated' set on '.'
> >>
> >> Here's a quick and dirty patch that works for me:
> >>
> >> Index: svnmerge.py
> >> ===================================================================
> >> --- svnmerge.py (revision 23287)
> >> +++ svnmerge.py (working copy)
> >> @@ -206,6 +206,7 @@
> >> optionally split by lines (if split_lines is True). Raise a LaunchError
> >> exception if the exit code of the process is non-zero (failure)."""
> >> if os.name not in ['nt', 'os2']:
> >> + cmd = "LC_ALL=C " + cmd
> >> p = popen2.Popen4(cmd)
> >> p.tochild.close()
> >> if split_lines:
> >>
> >> It was done against the HEAD of
> >> http://svn.collab.net/repos/svn/trunk/contrib/client-side
> >
> > That's weird since svnmerge already contains this code:
> >
> > # We expect non-localized output from SVN
> > os.environ["LC_MESSAGES"] = "C"
> >
> > To the best of my understing SVN/APR uses LC_MESSAGES to decide how to
> > localize messages. Any clue why that does not work for you?
>
> It seems that's not true. Quick test (Win XP):
>
> C:\svn\theller\ctypeslib>set LC_MESSAGES=C
> C:\svn\theller\ctypeslib>set LC_ALL=fr_FR.UTF-8
> C:\svn\theller\ctypeslib>svn --version
> svn, version 1.3.2 (r19776)
> compilé May 26 2006, 13:10:00
>
> Copyright (C) 2000-2006 CollabNet.
> Subversion is open source software, see http://subversion.tigris.org/
> This product includes software developed by CollabNet (http://www.Collab.Net/).
>
> Les modules d'accès à un dépôt (RA) suivants sont disponibles :
>
> * ra_dav : Module for accessing a repository via WebDAV (DeltaV) protocol.
> - handles 'http' scheme
> - handles 'https' scheme
> * ra_svn : Module pour accéder à un dépôt avec le protocole réseau propre de svn
> - handles 'svn' scheme
> * ra_local : Module for accessing a repository on local disk.
> - handles 'file' scheme
Thanks. This has been fixed on Subversion's trunk in r23305 of svnmerge.py.
Subversion's command-line initialization (svn_cmdline_init) doesn't
currently respect LC_MESSAGES:
/* C programs default to the "C" locale. But because svn is supposed
to be i18n-aware, it should inherit the default locale of its
environment. */
if (!setlocale(LC_ALL, "")
&& !setlocale(LC_CTYPE, ""))
{
if (error_stream)
{
const char *env_vars[] = { "LC_ALL", "LC_CTYPE", "LANG", NULL };
const char **env_var = &env_vars[0], *env_val = NULL;
while (*env_var)
{
env_val = getenv(*env_var);
if (env_val && env_val[0])
break;
++env_var;
}
if (!*env_var)
{
/* Unlikely. Can setlocale fail if no env vars are set? */
--env_var;
env_val = "not set";
}
fprintf(error_stream,
"%s: warning: cannot set LC_CTYPE locale\n"
"%s: warning: environment variable %s is %s\n"
"%s: warning: please check that your locale name is correct\n",
progname, progname, *env_var, env_val, progname);
}
}
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 189 bytes
Desc: not available
URL: </pipermail/svnmerge/attachments/20070130/f90ea757/attachment-0002.pgp>
More information about the Svnmerge
mailing list