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

login
register
mail settings
Submitter Chinmay Joshi
Date June 21, 2014, 10:27 a.m.
Message ID <700a9738926672b55f9d.1403346469@genesis>
Download mbox | patch
Permalink /patch/5027/
State Accepted
Commit 219af1521a6a44c2fb6fbd508f3b161644aac446
Headers show

Comments

Chinmay Joshi - June 21, 2014, 10:27 a.m.
# HG changeset patch
# User Chinmay Joshi <c@chinmayjoshi.com>
# Date 1403341160 -19800
#      Sat Jun 21 14:29:20 2014 +0530
# Node ID 700a9738926672b55f9d9dcb4dd175f9a0edeb2b
# Parent  9d359cb139d158b7af079fa62d629c64f8c27a2a
hg: use vfs functions in destination repository with share

In this patch, dstwvfs is added to use vfs functions in working directory of
destination shared repository. Existing filesystem operations are updated
to use vfs functions through dstwvfs.

Patch

diff --git a/mercurial/hg.py b/mercurial/hg.py
--- a/mercurial/hg.py
+++ b/mercurial/hg.py
@@ -174,12 +174,13 @@ 
 
     root = os.path.realpath(dest)
     roothg = os.path.join(root, '.hg')
+    destwvfs = scmutil.vfs(dest, realpath=True)
 
     if os.path.exists(roothg):
         raise util.Abort(_('destination already exists'))
 
-    if not os.path.isdir(root):
-        os.mkdir(root)
+    if not destwvfs.isdir():
+        destwvfs.mkdir()
     util.makedir(roothg, notindexed=True)
 
     requirements = ''
@@ -193,7 +194,7 @@ 
     util.writefile(os.path.join(roothg, 'requires'), requirements)
     util.writefile(os.path.join(roothg, 'sharedpath'), sharedpath)
 
-    r = repository(ui, root)
+    r = repository(ui, destwvfs.base)
 
     default = srcrepo.ui.config('paths', 'default')
     if default: