Brodie Rao avatar Brodie Rao committed 7e87205

Refreshing queue

Comments (0)

Files changed (2)

 diff --git a/mercurial/url.py b/mercurial/url.py
 --- a/mercurial/url.py
 +++ b/mercurial/url.py
-@@ -23,6 +23,194 @@ def _urlunparse(scheme, netloc, path, pa
+@@ -23,6 +23,198 @@ def _urlunparse(scheme, netloc, path, pa
          result = scheme + '://' + result[len(scheme + ':'):]
      return result
  
 +    <url scheme: 'http', host: 'host', path: 'a?b#c'>
 +    """
 +
++    _safechars = "!~*'()+"
++    _safepchars = "/!~*'()+"
++
 +    def __init__(self, path, parse_query=True, parse_fragment=True):
 +        # We slowly chomp away at path until we have only the path left
 +        self.scheme = self.user = self.passwd = self.host = None
 +        self.port = self.path = self.query = self.fragment = None
 +        self._localpath = True
 +
-+        if not path.startswith('//') and ':' in path:
++        if not path.startswith('/') and ':' in path:
 +            parts = path.split(':', 1)
 +            if parts[0]:
 +                self.scheme, path = parts
 +        if not path:
 +            path = None
 +            if self._localpath:
++                self.path = ''
 +                return
 +        else:
 +            if parse_fragment and '#' in path:
 +        'path'
 +        """
 +        if self._localpath:
-+            s = self.path or ''
++            s = self.path
 +            if self.fragment:
 +                s += '#' + self.fragment
 +            return s
 +            self.scheme and not self.path):
 +            s += '//'
 +        if self.user:
-+            s += urllib.quote(self.user)
++            s += urllib.quote(self.user, safe=self._safechars)
 +        if self.passwd:
-+            s += ':' + urllib.quote(self.passwd)
++            s += ':' + urllib.quote(self.passwd, safe=self._safechars)
 +        if self.user or self.passwd:
 +            s += '@'
 +        if self.host:
 +            (self.host and self.query or self.fragment)):
 +            s += '/'
 +        if self.path:
-+            s += urllib.quote(self.path)
++            s += urllib.quote(self.path, safe=self._safepchars)
 +        if self.query:
-+            s += '?' + urllib.quote(self.query)
++            s += '?' + urllib.quote(self.query, safe=self._safepchars)
 +        if self.fragment is not None:
-+            s += '#' + urllib.quote(self.fragment)
++            s += '#' + urllib.quote(self.fragment, safe=self._safepchars)
 +        return s
 +
 +    def authinfo(self):
 +
 +    >>> u = url('')
 +    >>> u
-+    <url >
++    <url path: ''>
 +    >>> str(u)
 +    ''
 +
 # HG changeset patch
-# Parent 84c92bd94ee98a84a2b524d56edb75d4a81e6b99
+# Parent 642a4e72ac683af674fc63f9d7312128b94c0ef8
 url: use url.URL in url.open()
 
 diff --git a/mercurial/url.py b/mercurial/url.py
  import __builtin__
  from i18n import _
  import keepalive, util
-@@ -841,17 +841,14 @@ def opener(ui, authinfo=None):
+@@ -864,17 +864,13 @@ def opener(ui, authinfo=None):
      opener.addheaders.append(('Accept', 'application/mercurial-0.1'))
      return opener
  
 +    u = url(url_)
 +    if u.scheme:
 +        u.scheme = u.scheme.lower()
-+        url_ = str(u)
-+        authinfo = u.authinfo()
++        url_, authinfo = u.authinfo()
 +    else:
 +        path = util.normpath(os.path.abspath(url_))
 +        url_ = 'file://' + urllib.pathname2url(path)
Tip: Filter by directory path e.g. /media app.js to search for public/media/app.js.
Tip: Use camelCasing e.g. ProjME to search for ProjectModifiedEvent.java.
Tip: Filter by extension type e.g. /repo .js to search for all .js files in the /repo directory.
Tip: Separate your search with spaces e.g. /ssh pom.xml to search for src/ssh/pom.xml.
Tip: Use ↑ and ↓ arrow keys to navigate and return to view the file.
Tip: You can also navigate files with Ctrl+j (next) and Ctrl+k (previous) and view the file with Ctrl+o.
Tip: You can also navigate files with Alt+j (next) and Alt+k (previous) and view the file with Alt+o.