Patchwork [4,of,6,V2] hg: update util.writefile method to use write with vfs in share

login
register
mail settings
Submitter Chinmay Joshi
Date June 21, 2014, 10:27 a.m.
Message ID <73889d047a12f25e906a.1403346471@genesis>
Download mbox | patch
Permalink /patch/5029/
State Accepted
Commit ff27fad408c4ea341cc73353b2e9821b38101cad
Headers show

Comments

Chinmay Joshi - June 21, 2014, 10:27 a.m.
# HG changeset patch
# User Chinmay Joshi <c@chinmayjoshi.com>
# Date 1403341829 -19800
#      Sat Jun 21 14:40:29 2014 +0530
# Node ID 73889d047a12f25e906a4e3b4d69e81f786ec310
# Parent  88dcd32c93da90ec779e94db41fc98c44ec21a23
hg: update util.writefile method to use write with vfs in share

This patch replaces util.writefile() to use destvfs.write().

Patch

diff --git a/mercurial/hg.py b/mercurial/hg.py
--- a/mercurial/hg.py
+++ b/mercurial/hg.py
@@ -172,8 +172,6 @@ 
 
     sharedpath = srcrepo.sharedpath # if our source is already sharing
 
-    root = os.path.realpath(dest)
-    roothg = os.path.join(root, '.hg')
     destwvfs = scmutil.vfs(dest, realpath=True)
     destvfs = scmutil.vfs(os.path.join(destwvfs.base, '.hg'), realpath=True)
 
@@ -192,8 +190,8 @@ 
             raise
 
     requirements += 'shared\n'
-    util.writefile(os.path.join(roothg, 'requires'), requirements)
-    util.writefile(os.path.join(roothg, 'sharedpath'), sharedpath)
+    destvfs.write('requires', requirements)
+    destvfs.write('sharedpath', sharedpath)
 
     r = repository(ui, destwvfs.base)