[PATCH] Fix issue on Windows with file merge on repo with extended char in path

Rémy Roy remyroy at remyroy.com
Wed Jul 30 11:56:05 CDT 2008


# HG changeset patch
# User Remy Roy <remyroy at remyroy.com>
# Date 1217436000 14400
# Node ID d8fcda0fe5b64aa6ba02dab8584cad11f33b0cf2
# Parent  cbdfd08eabc96116d801d0e2e7d1856adfdde911
Fix issue on Windows with file merge on repo with extended char in path

On Windows, if you try a file merge on a repository that contains an 
extended
character (out of ascii range), you will get an UnicodeDecodeError exception
because of an unexpected implicit unicode convertion. This patch catch the
exception and fix the charset convertion to make it work on Windows.

This patch is a fix for issue 1126.

diff -r cbdfd08eabc9 -r d8fcda0fe5b6 mercurial/filemerge.py
--- a/mercurial/filemerge.py    Tue Jul 22 13:03:31 2008 -0500
+++ b/mercurial/filemerge.py    Wed Jul 30 12:40:00 2008 -0400
@@ -192,7 +192,13 @@
         replace = dict(local=a, base=b, other=c, output=out)
         args = re.sub("\$(local|base|other|output)",
                       lambda x: '"%s"' % replace[x.group()[1:]], args)
-        r = util.system(toolpath + ' ' + args, cwd=repo.root, environ=env)
+        try:
+            cmd = toolpath + ' ' + args
+        except UnicodeDecodeError:
+            cmd = util.tolocal(toolpath.encode('UTF-8') +
+                               ' '.encode('UTF-8') +
+                               util.fromlocal(args))
+        r = util.system(cmd, cwd=repo.root, environ=env)
 
     if not r and _toolbool(ui, tool, "checkconflicts"):
         if re.match("^(<<<<<<< .*|=======|>>>>>>> .*)$", fcd.data()):



More information about the Mercurial-devel mailing list