[Svnmerge] Encoding problem in svnmerge commit message file

Thomas Heller theller at ctypes.org
Wed Dec 5 12:26:10 PST 2007


Romulo A. Ceccon schrieb:
> Hi.
> 
> (Sorry for the duplicate. I'm afraid the other message with
> attachments inlined cannot be read correctly by everybody. Now I hope
> mailman accepts attachments...)
> 
> os: Windows XP SP 2
> svn client: version 1.4.5 (r25188)
> svnmerge: trunk revison 28275
> 
> I write log messages for my Subversion repository in Portuguese, so
> the character encoding matters. The SVN client seems to assume a
> sensible encoding based on whether the message comes from a file
> (CP1252) or from the command line (CP850). SVN output is also
> consistent (CP850). svnmerge, however, does not take those issues
> into account when generating the log message. The message is taken
> from the SVN client output (CP850) and written directly to
> svnmerge-commit-message.txt. When I use the command "svn commit -F
> svnmerge-commit-message.txt" SVN thinks the encoding is CP1252 and
> ends up writing a misencoded log message to the repository. To
> workaround the problem I must remember to use the "--encoding IBM850"
> option.
> 
> Before filing a bug report I'd like to confirm here that there's
> really a problem with svnmerge.

While I support the use of ctypes sa much as possible ;-), would
not this approach be better?  It might even work on linuxes...

Thomas

Index: svnmerge.py
===================================================================
--- svnmerge.py	(revision 28283)
+++ svnmerge.py	(working copy)
@@ -208,6 +208,10 @@
     assert lines[-1] == "\n"
     return prefix + lines[:-1].replace("\n", "\n"+prefix) + "\n"
 
+def convert_oem(s):
+    u = s.decode(sys.stdout.encoding)
+    return u.encode(sys.getfilesystemencoding())
+
 class LaunchError(Exception):
     """Signal a failure in execution of an external command. Parameters are the
     exit code of the process, the original command line, and the output of the
@@ -933,7 +937,7 @@
     """Return the log message for a specific integer revision
     number."""
     out = launchsvn("log --incremental -r%d %s" % (revnum, url))
-    return "".join(out[1:])
+    return convert_oem("".join(out[1:]))
 
 def construct_merged_log_message(url, revnums):
     """Return a commit log message containing all the commit messages




More information about the Svnmerge mailing list