mercurial/util.py
branchstable
changeset 9996 2770d03ae49f
parent 9732 092bcf431562
child 10197 29e3c4a7699b
child 10263 25e572394f5c
--- a/mercurial/util.py	Thu Dec 03 11:06:44 2009 +0100
+++ b/mercurial/util.py	Thu Dec 03 11:06:55 2009 +0100
@@ -1197,7 +1197,19 @@
     if path.startswith(sc):
         path = path[len(sc):]
         if path.startswith('//'):
-            path = path[2:]
+            if scheme == 'file':
+                i = path.find('/', 2)
+                if i == -1:
+                    return ''
+                # On Windows, absolute paths are rooted at the current drive
+                # root. On POSIX they are rooted at the file system root.
+                if os.name == 'nt':
+                    droot = os.path.splitdrive(os.getcwd())[0] + '/'
+                    path = os.path.join(droot, path[i+1:])
+                else:
+                    path = path[i:]
+            else:
+                path = path[2:]
     return path
 
 def uirepr(s):