mercurial/util.py
changeset 33022 ce96efec8112
parent 32886 19b0fd4b5570
child 33094 4c5af472a599
--- a/mercurial/util.py	Sat Jun 24 13:20:30 2017 +0900
+++ b/mercurial/util.py	Sat Jun 24 13:48:04 2017 +0900
@@ -2740,7 +2740,7 @@
                 attrs.append('%s: %r' % (a, v))
         return '<url %s>' % ', '.join(attrs)
 
-    def __str__(self):
+    def __bytes__(self):
         r"""Join the URL's components back into a URL string.
 
         Examples:
@@ -2774,9 +2774,6 @@
         >>> print url(r'file:///D:\data\hg')
         file:///D:\data\hg
         """
-        return encoding.strfromlocal(self.__bytes__())
-
-    def __bytes__(self):
         if self._localpath:
             s = self.path
             if self.scheme == 'bundle':
@@ -2820,6 +2817,8 @@
             s += '#' + urlreq.quote(self.fragment, safe=self._safepchars)
         return s
 
+    __str__ = encoding.strmethod(__bytes__)
+
     def authinfo(self):
         user, passwd = self.user, self.passwd
         try: