changeset 31377: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 ef50b491c17d
children b6f5af372c0c
files mercurial/util.py
diffstat 1 files changed, 5 insertions(+), 0 deletions(-) [+]
line wrap: on
line diff
--- a/mercurial/util.py	Sun Mar 12 03:31:54 2017 -0400
+++ b/mercurial/util.py	Sun Mar 12 03:33:22 2017 -0400
@@ -2651,6 +2651,11 @@
         >>> print url(r'file:///D:\data\hg')
         file:///D:\data\hg
         """
+        if pycompat.ispy3:
+            return encoding.fromlocal(self.__bytes__()).decode('utf-8')
+        return self.__bytes__()
+
+    def __bytes__(self):
         if self._localpath:
             s = self.path
             if self.scheme == 'bundle':