comparison hgext/largefiles/localstore.py @ 18998:d035c3902111

largefiles: refactoring - create destination dir in lfutil.link
author Mads Kiilerich <madski@unity3d.com>
date Mon, 15 Apr 2013 23:32:33 +0200
parents a49b7c9fc246
children eaf146e811a4
comparison
equal deleted inserted replaced
18997:4cf09a1bf5b2 18998:d035c3902111
6 # This software may be used and distributed according to the terms of the 6 # This software may be used and distributed according to the terms of the
7 # GNU General Public License version 2 or any later version. 7 # GNU General Public License version 2 or any later version.
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
17 import basestore 14 import basestore
18 15
24 def __init__(self, ui, repo, remote): 21 def __init__(self, ui, repo, remote):
25 self.remote = remote.local() 22 self.remote = remote.local()
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),
33 lfutil.storepath(self.remote, hash)) 29 lfutil.storepath(self.remote, hash))
34 30