Patchwork [5,of,6,V2] hg: use vfs functions in clone

login
register
mail settings
Submitter Chinmay Joshi
Date June 21, 2014, 10:27 a.m.
Message ID <b7ac0fd7c56b1e160469.1403346472@genesis>
Download mbox | patch
Permalink /patch/5030/
State Accepted
Commit 62cc4055c6c81ca6ecd4ea6d288e6eca2626699e
Headers show

Comments

Chinmay Joshi - June 21, 2014, 10:27 a.m.
# HG changeset patch
# User Chinmay Joshi <c@chinmayjoshi.com>
# Date 1403342049 -19800
#      Sat Jun 21 14:44:09 2014 +0530
# Node ID b7ac0fd7c56b1e16046960482ed7871a4799fc4a
# Parent  73889d047a12f25e906a4e3b4d69e81f786ec310
hg: use vfs functions in clone

This change applies vfs functions in clone. destvfs.exists will invoke
os.path.lexists via lexists of vfs to check for broken symbolic links.

Patch

diff --git a/mercurial/hg.py b/mercurial/hg.py
--- a/mercurial/hg.py
+++ b/mercurial/hg.py
@@ -311,8 +311,10 @@ 
 
     if not dest:
         raise util.Abort(_("empty destination path is not valid"))
-    if os.path.exists(dest):
-        if not os.path.isdir(dest):
+
+    destvfs = scmutil.vfs(dest, expandpath=True)
+    if destvfs.lexists():
+        if not destvfs.isdir():
             raise util.Abort(_("destination '%s' already exists") % dest)
         elif os.listdir(dest):
             raise util.Abort(_("destination '%s' is not empty") % dest)