##// END OF EJS Templates
largefiles: refactoring - create destination dir in lfutil.link
Mads Kiilerich -
r18998:d035c390 default
parent child Browse files
Show More
@@ -39,6 +39,7 b' def getminsize(ui, assumelfiles, opt, de'
39 return lfsize
39 return lfsize
40
40
41 def link(src, dest):
41 def link(src, dest):
42 util.makedirs(os.path.dirname(dest))
42 try:
43 try:
43 util.oslink(src, dest)
44 util.oslink(src, dest)
44 except OSError:
45 except OSError:
@@ -86,7 +87,6 b' def findfile(repo, hash):'
86 elif inusercache(repo.ui, hash):
87 elif inusercache(repo.ui, hash):
87 repo.ui.note(_('found %s in system cache\n') % hash)
88 repo.ui.note(_('found %s in system cache\n') % hash)
88 path = storepath(repo, hash)
89 path = storepath(repo, hash)
89 util.makedirs(os.path.dirname(path))
90 link(usercachepath(repo.ui, hash), path)
90 link(usercachepath(repo.ui, hash), path)
91 return path
91 return path
92 return None
92 return None
@@ -203,10 +203,10 b' def copyalltostore(repo, node):'
203
203
204
204
205 def copytostoreabsolute(repo, file, hash):
205 def copytostoreabsolute(repo, file, hash):
206 util.makedirs(os.path.dirname(storepath(repo, hash)))
207 if inusercache(repo.ui, hash):
206 if inusercache(repo.ui, hash):
208 link(usercachepath(repo.ui, hash), storepath(repo, hash))
207 link(usercachepath(repo.ui, hash), storepath(repo, hash))
209 elif not getattr(repo, "_isconverting", False):
208 elif not getattr(repo, "_isconverting", False):
209 util.makedirs(os.path.dirname(storepath(repo, hash)))
210 dst = util.atomictempfile(storepath(repo, hash),
210 dst = util.atomictempfile(storepath(repo, hash),
211 createmode=repo.store.createmode)
211 createmode=repo.store.createmode)
212 for chunk in util.filechunkiter(open(file, 'rb')):
212 for chunk in util.filechunkiter(open(file, 'rb')):
@@ -217,7 +217,6 b' def copytostoreabsolute(repo, file, hash'
217 def linktousercache(repo, hash):
217 def linktousercache(repo, hash):
218 path = usercachepath(repo.ui, hash)
218 path = usercachepath(repo.ui, hash)
219 if path:
219 if path:
220 util.makedirs(os.path.dirname(path))
221 link(storepath(repo, hash), path)
220 link(storepath(repo, hash), path)
222
221
223 def getstandinmatcher(repo, pats=[], opts={}):
222 def getstandinmatcher(repo, pats=[], opts={}):
@@ -8,9 +8,6 b''
8
8
9 '''store class for local filesystem'''
9 '''store class for local filesystem'''
10
10
11 import os
12
13 from mercurial import util
14 from mercurial.i18n import _
11 from mercurial.i18n import _
15
12
16 import lfutil
13 import lfutil
@@ -26,7 +23,6 b' class localstore(basestore.basestore):'
26 super(localstore, self).__init__(ui, repo, self.remote.url())
23 super(localstore, self).__init__(ui, repo, self.remote.url())
27
24
28 def put(self, source, hash):
25 def put(self, source, hash):
29 util.makedirs(os.path.dirname(lfutil.storepath(self.remote, hash)))
30 if lfutil.instore(self.remote, hash):
26 if lfutil.instore(self.remote, hash):
31 return
27 return
32 lfutil.link(lfutil.storepath(self.repo, hash),
28 lfutil.link(lfutil.storepath(self.repo, hash),
General Comments 0
You need to be logged in to leave comments. Login now