changeset 13807:974490c1768f

url: deal with drive letters
author Matt Mackall <mpm@selenic.com>
date Wed, 30 Mar 2011 13:34:39 -0500
parents 8ba08a16e4e0
children 58b86b9149f1
files mercurial/url.py
diffstat 1 files changed, 7 insertions(+), 0 deletions(-) [+]
line wrap: on
line diff
--- 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]: