comparison mercurial/util.py @ 31448:6419cd243017

encoding: add converter between native str and byte string This kind of encoding conversion is unavoidable on Python 3.
author Yuya Nishihara <yuya@tcha.org>
date Mon, 13 Mar 2017 09:12:56 -0700
parents 067add650129
children 756175623f2e
comparison
equal deleted inserted replaced
31447:067add650129 31448:6419cd243017
2651 >>> print url(r'bundle:foo\bar') 2651 >>> print url(r'bundle:foo\bar')
2652 bundle:foo\bar 2652 bundle:foo\bar
2653 >>> print url(r'file:///D:\data\hg') 2653 >>> print url(r'file:///D:\data\hg')
2654 file:///D:\data\hg 2654 file:///D:\data\hg
2655 """ 2655 """
2656 if pycompat.ispy3: 2656 return encoding.strfromlocal(self.__bytes__())
2657 return encoding.unifromlocal(self.__bytes__())
2658 return self.__bytes__()
2659 2657
2660 def __bytes__(self): 2658 def __bytes__(self):
2661 if self._localpath: 2659 if self._localpath:
2662 s = self.path 2660 s = self.path
2663 if self.scheme == 'bundle': 2661 if self.scheme == 'bundle':