url: deal with drive letters
authorMatt Mackall <mpm@selenic.com>
Wed, 30 Mar 2011 13:34:39 -0500
changeset 13807 974490c1768f
parent 13806 8ba08a16e4e0
child 13808 58b86b9149f1
url: deal with drive letters
mercurial/url.py
--- a/mercurial/url.py	Mon Mar 14 23:50:28 2011 +0100
+++ b/mercurial/url.py	Wed Mar 30 13:34:39 2011 -0500
@@ -39,6 +39,8 @@
     <url scheme: 'file', path: '/home/joe/repo'>
     >>> url('bundle:foo')
     <url scheme: 'bundle', path: 'foo'>
+    >>> url('c:\\\\foo\\\\bar')
+    <url path: 'c:\\\\foo\\\\bar'>
 
     Authentication credentials:
 
@@ -64,6 +66,11 @@
         self.port = self.path = self.query = self.fragment = None
         self._localpath = True
 
+        # special case for Windows drive letters
+        if path[1:2] == ':' and path[0:1].isalpha():
+            self.path = path
+            return
+
         if not path.startswith('/') and ':' in path:
             parts = path.split(':', 1)
             if parts[0]: