hgext/win32mbcs.py
branchstable
changeset 49366 288de6f5d724
parent 48934 06de08b36c82
child 50742 48d9af6bd043
equal deleted inserted replaced
49364:e8ea403b1c46 49366:288de6f5d724
    42  [win32mbcs]
    42  [win32mbcs]
    43  encoding = sjis
    43  encoding = sjis
    44 
    44 
    45 It is useful for the users who want to commit with UTF-8 log message.
    45 It is useful for the users who want to commit with UTF-8 log message.
    46 '''
    46 '''
    47 from __future__ import absolute_import
       
    48 
    47 
    49 import os
    48 import os
    50 import sys
    49 import sys
    51 
    50 
    52 from mercurial.i18n import _
    51 from mercurial.i18n import _
    93             arg[k] = decode(v)
    92             arg[k] = decode(v)
    94     return arg
    93     return arg
    95 
    94 
    96 
    95 
    97 def encode(arg):
    96 def encode(arg):
    98     if isinstance(arg, pycompat.unicode):
    97     if isinstance(arg, str):
    99         return arg.encode(_encoding)
    98         return arg.encode(_encoding)
   100     elif isinstance(arg, tuple):
    99     elif isinstance(arg, tuple):
   101         return tuple(map(encode, arg))
   100         return tuple(map(encode, arg))
   102     elif isinstance(arg, list):
   101     elif isinstance(arg, list):
   103         return map(encode, arg)
   102         return map(encode, arg)
   134             % _encoding
   133             % _encoding
   135         )
   134         )
   136 
   135 
   137 
   136 
   138 def wrapper(func, args, kwds):
   137 def wrapper(func, args, kwds):
   139     return basewrapper(func, pycompat.unicode, encode, decode, args, kwds)
   138     return basewrapper(func, str, encode, decode, args, kwds)
   140 
   139 
   141 
   140 
   142 def reversewrapper(func, args, kwds):
   141 def reversewrapper(func, args, kwds):
   143     return basewrapper(func, str, decode, encode, args, kwds)
   142     return basewrapper(func, str, decode, encode, args, kwds)
   144 
   143