comparison mercurial/hg.py @ 21800:219af1521a6a

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.
author Chinmay Joshi <c@chinmayjoshi.com>
date Sat, 21 Jun 2014 14:29:20 +0530
parents 1ab30e9ba0fc
children 2ccd71bbd0f7
comparison
equal deleted inserted replaced
21799:dfacdd6a111e 21800:219af1521a6a
172 172
173 sharedpath = srcrepo.sharedpath # if our source is already sharing 173 sharedpath = srcrepo.sharedpath # if our source is already sharing
174 174
175 root = os.path.realpath(dest) 175 root = os.path.realpath(dest)
176 roothg = os.path.join(root, '.hg') 176 roothg = os.path.join(root, '.hg')
177 destwvfs = scmutil.vfs(dest, realpath=True)
177 178
178 if os.path.exists(roothg): 179 if os.path.exists(roothg):
179 raise util.Abort(_('destination already exists')) 180 raise util.Abort(_('destination already exists'))
180 181
181 if not os.path.isdir(root): 182 if not destwvfs.isdir():
182 os.mkdir(root) 183 destwvfs.mkdir()
183 util.makedir(roothg, notindexed=True) 184 util.makedir(roothg, notindexed=True)
184 185
185 requirements = '' 186 requirements = ''
186 try: 187 try:
187 requirements = srcrepo.opener.read('requires') 188 requirements = srcrepo.opener.read('requires')
191 192
192 requirements += 'shared\n' 193 requirements += 'shared\n'
193 util.writefile(os.path.join(roothg, 'requires'), requirements) 194 util.writefile(os.path.join(roothg, 'requires'), requirements)
194 util.writefile(os.path.join(roothg, 'sharedpath'), sharedpath) 195 util.writefile(os.path.join(roothg, 'sharedpath'), sharedpath)
195 196
196 r = repository(ui, root) 197 r = repository(ui, destwvfs.base)
197 198
198 default = srcrepo.ui.config('paths', 'default') 199 default = srcrepo.ui.config('paths', 'default')
199 if default: 200 if default:
200 fp = r.opener("hgrc", "w", text=True) 201 fp = r.opener("hgrc", "w", text=True)
201 fp.write("[paths]\n") 202 fp.write("[paths]\n")