mirror of
https://github.com/facebook/sapling.git
synced 2024-10-07 15:27:13 +03:00
largefiles: refactoring - create destination dir in lfutil.link
This commit is contained in:
parent
b29ea06623
commit
092b44d44d
@ -39,6 +39,7 @@ def getminsize(ui, assumelfiles, opt, default=10):
|
||||
return lfsize
|
||||
|
||||
def link(src, dest):
|
||||
util.makedirs(os.path.dirname(dest))
|
||||
try:
|
||||
util.oslink(src, dest)
|
||||
except OSError:
|
||||
@ -86,7 +87,6 @@ def findfile(repo, hash):
|
||||
elif inusercache(repo.ui, hash):
|
||||
repo.ui.note(_('found %s in system cache\n') % hash)
|
||||
path = storepath(repo, hash)
|
||||
util.makedirs(os.path.dirname(path))
|
||||
link(usercachepath(repo.ui, hash), path)
|
||||
return path
|
||||
return None
|
||||
@ -203,10 +203,10 @@ def copyalltostore(repo, node):
|
||||
|
||||
|
||||
def copytostoreabsolute(repo, file, hash):
|
||||
util.makedirs(os.path.dirname(storepath(repo, hash)))
|
||||
if inusercache(repo.ui, hash):
|
||||
link(usercachepath(repo.ui, hash), storepath(repo, hash))
|
||||
elif not getattr(repo, "_isconverting", False):
|
||||
util.makedirs(os.path.dirname(storepath(repo, hash)))
|
||||
dst = util.atomictempfile(storepath(repo, hash),
|
||||
createmode=repo.store.createmode)
|
||||
for chunk in util.filechunkiter(open(file, 'rb')):
|
||||
@ -217,7 +217,6 @@ def copytostoreabsolute(repo, file, hash):
|
||||
def linktousercache(repo, hash):
|
||||
path = usercachepath(repo.ui, hash)
|
||||
if path:
|
||||
util.makedirs(os.path.dirname(path))
|
||||
link(storepath(repo, hash), path)
|
||||
|
||||
def getstandinmatcher(repo, pats=[], opts={}):
|
||||
|
@ -8,9 +8,6 @@
|
||||
|
||||
'''store class for local filesystem'''
|
||||
|
||||
import os
|
||||
|
||||
from mercurial import util
|
||||
from mercurial.i18n import _
|
||||
|
||||
import lfutil
|
||||
@ -26,7 +23,6 @@ class localstore(basestore.basestore):
|
||||
super(localstore, self).__init__(ui, repo, self.remote.url())
|
||||
|
||||
def put(self, source, hash):
|
||||
util.makedirs(os.path.dirname(lfutil.storepath(self.remote, hash)))
|
||||
if lfutil.instore(self.remote, hash):
|
||||
return
|
||||
lfutil.link(lfutil.storepath(self.repo, hash),
|
||||
|
Loading…
Reference in New Issue
Block a user