Mercurial > public > mercurial-scm > hg-stable
comparison mercurial/util.py @ 31456:067add650129
encoding: factor out unicode variants of from/tolocal()
Unfortunately, these functions will be commonly used on Python 3.
author | Yuya Nishihara <yuya@tcha.org> |
---|---|
date | Mon, 13 Mar 2017 09:11:08 -0700 |
parents | 807387581d89 |
children | 6419cd243017 |
comparison
equal
deleted
inserted
replaced
31455:9a94239e4f12 | 31456:067add650129 |
---|---|
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 if pycompat.ispy3: |
2657 return encoding.fromlocal(self.__bytes__()).decode('utf-8') | 2657 return encoding.unifromlocal(self.__bytes__()) |
2658 return self.__bytes__() | 2658 return self.__bytes__() |
2659 | 2659 |
2660 def __bytes__(self): | 2660 def __bytes__(self): |
2661 if self._localpath: | 2661 if self._localpath: |
2662 s = self.path | 2662 s = self.path |