convert: accept Subversion 'file:///c%3A/svnrepo' syntax on Windows
authorMads Kiilerich <mads@kiilerich.com>
Thu, 28 Jun 2012 03:41:37 +0200
changeset 17052 1bd18c415eec
parent 17051 c5ed575f3137
child 17053 0e4171fdb9d4
convert: accept Subversion 'file:///c%3A/svnrepo' syntax on Windows Subversion can handle ':' quoted as '%3A' but urllib.url2pathname can't and Mercurial thus rejected some valid subversions URLs. This particular case will now be handled by some preprocessing before handing it over to urllib.url2pathname. This is tested by 0413f68da85c when test-convert-svn-source.t and test-convert-svn-move.t can be run on Windows.
hgext/convert/subversion.py
--- a/hgext/convert/subversion.py	Mon Jun 25 19:26:29 2012 +0200
+++ b/hgext/convert/subversion.py	Thu Jun 28 03:41:37 2012 +0200
@@ -189,6 +189,9 @@
     try:
         proto, path = url.split('://', 1)
         if proto == 'file':
+            if (os.name == 'nt' and path[:1] == '/' and path[1:2].isalpha()
+                and path[2:6].lower() == '%3a/'):
+                path = path[:2] + ':/' + path[6:]
             path = urllib.url2pathname(path)
     except ValueError:
         proto = 'file'