##// END OF EJS Templates
hg: rewrite "copystore()" with vfs...
FUJIWARA Katsunori -
r20089:2d0ab571 default
parent child Browse files
Show More
@@ -202,19 +202,20 b' def copystore(ui, srcrepo, destpath):'
202 hardlink = None
202 hardlink = None
203 num = 0
203 num = 0
204 srcpublishing = srcrepo.ui.configbool('phases', 'publish', True)
204 srcpublishing = srcrepo.ui.configbool('phases', 'publish', True)
205 srcvfs = scmutil.vfs(srcrepo.sharedpath)
206 dstvfs = scmutil.vfs(destpath)
205 for f in srcrepo.store.copylist():
207 for f in srcrepo.store.copylist():
206 if srcpublishing and f.endswith('phaseroots'):
208 if srcpublishing and f.endswith('phaseroots'):
207 continue
209 continue
208 src = os.path.join(srcrepo.sharedpath, f)
210 dstbase = os.path.dirname(f)
209 dst = os.path.join(destpath, f)
211 if dstbase and not dstvfs.exists(dstbase):
210 dstbase = os.path.dirname(dst)
212 dstvfs.mkdir(dstbase)
211 if dstbase and not os.path.exists(dstbase):
213 if srcvfs.exists(f):
212 os.mkdir(dstbase)
214 if f.endswith('data'):
213 if os.path.exists(src):
214 if dst.endswith('data'):
215 # lock to avoid premature writing to the target
215 # lock to avoid premature writing to the target
216 destlock = lock.lock(os.path.join(dstbase, "lock"))
216 destlock = lock.lock(dstvfs.join(dstbase + "/lock"))
217 hardlink, n = util.copyfiles(src, dst, hardlink)
217 hardlink, n = util.copyfiles(srcvfs.join(f), dstvfs.join(f),
218 hardlink)
218 num += n
219 num += n
219 if hardlink:
220 if hardlink:
220 ui.debug("linked %d files\n" % num)
221 ui.debug("linked %d files\n" % num)
General Comments 0
You need to be logged in to leave comments. Login now