comparison mercurial/hg.py @ 23877:7cc77030c557

localrepo: remove all external users of localrepo.opener This change touches every module in which repository.opener was being used, and changes it for the equivalent repository.vfs. This is meant to make it easier to split the repository.vfs into several separate vfs. It should now be possible to remove localrepo.opener.
author Angel Ezquerra <angel.ezquerra@gmail.com>
date Thu, 15 Jan 2015 23:17:12 +0100
parents cd79fb4d75fd
children 7e71898a7cdc
comparison
equal deleted inserted replaced
23876:48fd1dfb99aa 23877:7cc77030c557
191 destwvfs.mkdir() 191 destwvfs.mkdir()
192 destvfs.makedir() 192 destvfs.makedir()
193 193
194 requirements = '' 194 requirements = ''
195 try: 195 try:
196 requirements = srcrepo.opener.read('requires') 196 requirements = srcrepo.vfs.read('requires')
197 except IOError, inst: 197 except IOError, inst:
198 if inst.errno != errno.ENOENT: 198 if inst.errno != errno.ENOENT:
199 raise 199 raise
200 200
201 requirements += 'shared\n' 201 requirements += 'shared\n'
204 204
205 r = repository(ui, destwvfs.base) 205 r = repository(ui, destwvfs.base)
206 206
207 default = srcrepo.ui.config('paths', 'default') 207 default = srcrepo.ui.config('paths', 'default')
208 if default: 208 if default:
209 fp = r.opener("hgrc", "w", text=True) 209 fp = r.vfs("hgrc", "w", text=True)
210 fp.write("[paths]\n") 210 fp.write("[paths]\n")
211 fp.write("default = %s\n" % default) 211 fp.write("default = %s\n" % default)
212 fp.close() 212 fp.close()
213 213
214 if update: 214 if update:
224 except error.RepoLookupError: 224 except error.RepoLookupError:
225 continue 225 continue
226 _update(r, uprev) 226 _update(r, uprev)
227 227
228 if bookmarks: 228 if bookmarks:
229 r.opener('bookmarks.shared', 'w').close() 229 r.vfs('bookmarks.shared', 'w').close()
230 230
231 def copystore(ui, srcrepo, destpath): 231 def copystore(ui, srcrepo, destpath):
232 '''copy files from store of srcrepo in destpath 232 '''copy files from store of srcrepo in destpath
233 233
234 returns destlock 234 returns destlock
439 cleandir = None 439 cleandir = None
440 440
441 destrepo = destpeer.local() 441 destrepo = destpeer.local()
442 if destrepo: 442 if destrepo:
443 template = uimod.samplehgrcs['cloned'] 443 template = uimod.samplehgrcs['cloned']
444 fp = destrepo.opener("hgrc", "w", text=True) 444 fp = destrepo.vfs("hgrc", "w", text=True)
445 u = util.url(abspath) 445 u = util.url(abspath)
446 u.passwd = None 446 u.passwd = None
447 defaulturl = str(u) 447 defaulturl = str(u)
448 fp.write(template % defaulturl) 448 fp.write(template % defaulturl)
449 fp.close() 449 fp.close()