1. Wez Furlong
  2. SvnToHg

Commits

Wez Furlong  committed 8377b92

defeated by an apparent forcing of encoding to ascii in the mercurial
guts; force our commit messages to be ascii too :-/

  • Participants
  • Parent commits 7fc97ca
  • Branches default

Comments (0)

Files changed (1)

File svn2hg/SvnImporter.py

View file
 # vim:ts=2:sw=2:et:
+# -*- coding: utf-8 -*-
 # Author: Wez Furlong
 # Copyright (c) 2010-2011, Message Systems, Inc.
 # See LICENSE.md for usage and distribution terms
-
 from mercurial import encoding, cmdutil, util, commands, hg, context, scmutil
 from mercurial import bookmarks
 from mercurial.node import bin, hex, nullid
 svn_node_dir = 2
 svn_node_unknown = 3
 
+encoding.encoding = 'UTF-8'
+
 """Helper for accessing properties"""
 def getprop(props, name):
   if not props:
   if name in props:
     v = props[name]
     if isinstance(v, unicode):
-      return v.encode("utf-8")
-    return v.decode("utf-8").encode("utf-8")
+      return v.encode("ascii", "replace")
+    return v.decode("utf-8").encode("ascii", "replace")
 #    return v
   return None
 
       while plist:
         p1 = p2
         p2 = plist.pop(0)
-        ctx = context.memctx(self.repo, (p1, p2), log, files.keys(),
+        ctx = context.memctx(self.repo, (p1, p2), encoding.tolocal(log),
+            files.keys(),
             getfilectx, srev.author, srev.date, extra)
         res = self.repo.commitctx(ctx)
         p2 = hex(res)