[PATCH 5 of 6] hg: use vfs functions in clone

FUJIWARA Katsunori foozy at lares.dti.ne.jp
Thu Jun 19 12:27:00 CDT 2014


At Mon, 16 Jun 2014 22:09:45 +0530,
Chinmay Joshi wrote:
> 
> # HG changeset patch
> # User Chinmay Joshi <c at chinmayjoshi.com>
> # Date 1402933362 -19800
> #      Mon Jun 16 21:12:42 2014 +0530
> # Node ID 9dc6f43b60b2ce035846ca2fbe2f579418d2128d
> # Parent  b5da6438d602ea375b4cce2d677ec8cb5ad4c2a2
> hg: use vfs functions in clone
> 
> This change applies vfs functions in clone. os.path.exists will invoke
> os.path.lexists via lexists of vfs to check for broken symbolic links.
> 
> diff --git a/mercurial/hg.py b/mercurial/hg.py
> --- a/mercurial/hg.py
> +++ b/mercurial/hg.py
> @@ -308,11 +308,12 @@
>  
>      dest = util.urllocalpath(dest)
>      source = util.urllocalpath(source)
> +    dstvfs = scmutil.vfs(dest, expandpath=True)

Is additional "expandpath=True" passing needed ?

>      if not dest:
>          raise util.Abort(_("empty destination path is not valid"))

"dstvfs" should be created after "not dest" confirmation, because
creation of "dstvfs" itself becomes meaningless if "dest" is empty,

> -    if os.path.exists(dest):
> -        if not os.path.isdir(dest):
> +    if dstvfs.lexists():
> +        if not dstvfs.isdir():
>              raise util.Abort(_("destination '%s' already exists") % dest)
>          elif os.listdir(dest):
>              raise util.Abort(_("destination '%s' is not empty") % dest)
> _______________________________________________
> Mercurial-devel mailing list
> Mercurial-devel at selenic.com
> http://selenic.com/mailman/listinfo/mercurial-devel
> 

----------------------------------------------------------------------
[FUJIWARA Katsunori]                             foozy at lares.dti.ne.jp


More information about the Mercurial-devel mailing list