Patchwork [2,of,6] hg: use vfs functions in destination repository with share

login
register
mail settings
Submitter Chinmay Joshi
Date June 16, 2014, 4:39 p.m.
Message ID <b230c9509c488d0d2ef0.1402936782@genesis>
Download mbox | patch
Permalink /patch/5006/
State Superseded
Commit 219af1521a6a44c2fb6fbd508f3b161644aac446
Headers show

Comments

Chinmay Joshi - June 16, 2014, 4:39 p.m.
# HG changeset patch
# User Chinmay Joshi <c@chinmayjoshi.com>
# Date 1402931477 -19800
#      Mon Jun 16 20:41:17 2014 +0530
# Node ID b230c9509c488d0d2ef0bf9e3375b2ad376153fd
# Parent  986e8fb82923f864c10bfb5a97d0594e83722b9c
hg: use vfs functions in destination repository with share

In this patch, dstvfs is added to use vfs functions in working directory of
destination shared repository. Existing filesystem operations are updated
to use vfs functions through dstvfs.
Katsunori FUJIWARA - June 19, 2014, 5:25 p.m.
At Mon, 16 Jun 2014 22:09:42 +0530,
Chinmay Joshi wrote:
> 
> # HG changeset patch
> # User Chinmay Joshi <c@chinmayjoshi.com>
> # Date 1402931477 -19800
> #      Mon Jun 16 20:41:17 2014 +0530
> # Node ID b230c9509c488d0d2ef0bf9e3375b2ad376153fd
> # Parent  986e8fb82923f864c10bfb5a97d0594e83722b9c
> hg: use vfs functions in destination repository with share
> 
> In this patch, dstvfs is added to use vfs functions in working directory of
> destination shared repository. Existing filesystem operations are updated
> to use vfs functions through dstvfs.
> 
> diff --git a/mercurial/hg.py b/mercurial/hg.py
> --- a/mercurial/hg.py
> +++ b/mercurial/hg.py
> @@ -172,14 +172,14 @@
>  
>      sharedpath = srcrepo.sharedpath # if our source is already sharing
>  
> -    root = os.path.realpath(dest)
> +    dstvfs = scmutil.vfs(dest, expandpath=True, realpath=True)
>      roothg = os.path.join(root, '.hg')

- "root" shouldn't be removed in this patch, because it is still
  referred from others (not only just below !) until next patch

- is additional "expandpath=True" passing needed ?

- "destvfs" seems to be better than "dstvfs" to indicate relation with
  "dest"

>      if os.path.exists(roothg):
>          raise util.Abort(_('destination already exists'))
>  
> -    if not os.path.isdir(root):
> -        os.mkdir(root)
> +    if not dstvfs.isdir():
> +        dstvfs.mkdir()
>      util.makedir(roothg, notindexed=True)
>  
>      requirements = ''
> _______________________________________________
> Mercurial-devel mailing list
> Mercurial-devel@selenic.com
> http://selenic.com/mailman/listinfo/mercurial-devel
> 

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

Patch

diff --git a/mercurial/hg.py b/mercurial/hg.py
--- a/mercurial/hg.py
+++ b/mercurial/hg.py
@@ -172,14 +172,14 @@ 
 
     sharedpath = srcrepo.sharedpath # if our source is already sharing
 
-    root = os.path.realpath(dest)
+    dstvfs = scmutil.vfs(dest, expandpath=True, realpath=True)
     roothg = os.path.join(root, '.hg')
 
     if os.path.exists(roothg):
         raise util.Abort(_('destination already exists'))
 
-    if not os.path.isdir(root):
-        os.mkdir(root)
+    if not dstvfs.isdir():
+        dstvfs.mkdir()
     util.makedir(roothg, notindexed=True)
 
     requirements = ''