comparison mercurial/util.py @ 31368:6e59397b08d8

util: teach url object about __bytes__ __str__ tries to do something reasonable, but someone else more familiar with encoding bugs should check my work.
author Augie Fackler <augie@google.com>
date Sun, 12 Mar 2017 03:33:22 -0400
parents a9a28ca17615
children 8b6927eb7efd
comparison
equal deleted inserted replaced
31367:ef50b491c17d 31368:6e59397b08d8
2649 >>> print url(r'bundle:foo\bar') 2649 >>> print url(r'bundle:foo\bar')
2650 bundle:foo\bar 2650 bundle:foo\bar
2651 >>> print url(r'file:///D:\data\hg') 2651 >>> print url(r'file:///D:\data\hg')
2652 file:///D:\data\hg 2652 file:///D:\data\hg
2653 """ 2653 """
2654 if pycompat.ispy3:
2655 return encoding.fromlocal(self.__bytes__()).decode('utf-8')
2656 return self.__bytes__()
2657
2658 def __bytes__(self):
2654 if self._localpath: 2659 if self._localpath:
2655 s = self.path 2660 s = self.path
2656 if self.scheme == 'bundle': 2661 if self.scheme == 'bundle':
2657 s = 'bundle:' + s 2662 s = 'bundle:' + s
2658 if self.fragment: 2663 if self.fragment: