[PATCH] convert: accept subversion Windows syntax 'file:///c:/svnrepo'

Kevin Bullock kbullock+mercurial at ringworld.org
Tue Jun 26 22:13:21 CDT 2012


On 26 Jun 2012, at 8:09 PM, Mads Kiilerich wrote:

> # HG changeset patch
> # User Mads Kiilerich <mads at kiilerich.com>
> # Date 1340759355 -7200
> # Node ID e5808de25577344a2a4dc96386242438be940597
> # Parent  3dd6da761fff59be7dae61588919e80091d29a39
> convert: accept subversion Windows syntax 'file:///c:/svnrepo'
> 
> This 'file:///' syntax with '///' has to be used on Windows but it did
> apparently not work. urllib.url2pathname were given '/c:/svnrepo' and failed.
> 
> Instead we now use ':///' as separator when parsing protocol and path on
> Windows.
> 
> diff --git a/hgext/convert/subversion.py b/hgext/convert/subversion.py
> --- a/hgext/convert/subversion.py
> +++ b/hgext/convert/subversion.py
> @@ -188,6 +188,8 @@
> def issvnurl(ui, url):
>     try:
>         proto, path = url.split('://', 1)
> +        if os.name == 'nt':
> +            proto, path = url.split(':///', 1)

Why not:

-        proto, path = url.split('://', 1)
+        if os.name == 'nt':
+            proto, path = url.split(':///', 1)
+        else:
+            proto, path = url.split('://', 1)

? I mean, I know we avoid else clauses where they're unnecessary (usually when initializing a variable), but here you're calling url.split() twice for no good reason.

pacem in terris / мир / शान्ति / ‎‫سَلاَم‬ / 平和
Kevin R. Bullock



More information about the Mercurial-devel mailing list