hgext/largefiles/lfutil.py
branchstable
changeset 16153 05197f9fd1f3
parent 16103 3e1efb458e8b
child 16155 1b2b42e866be
equal deleted inserted replaced
16145:616c2e278f18 16153:05197f9fd1f3
   235 def copytostoreabsolute(repo, file, hash):
   235 def copytostoreabsolute(repo, file, hash):
   236     util.makedirs(os.path.dirname(storepath(repo, hash)))
   236     util.makedirs(os.path.dirname(storepath(repo, hash)))
   237     if inusercache(repo.ui, hash):
   237     if inusercache(repo.ui, hash):
   238         link(usercachepath(repo.ui, hash), storepath(repo, hash))
   238         link(usercachepath(repo.ui, hash), storepath(repo, hash))
   239     else:
   239     else:
   240         dst = util.atomictempfile(storepath(repo, hash))
   240         dst = util.atomictempfile(storepath(repo, hash),
       
   241                                   createmode=repo.store.createmode)
   241         for chunk in util.filechunkiter(open(file, 'rb')):
   242         for chunk in util.filechunkiter(open(file, 'rb')):
   242             dst.write(chunk)
   243             dst.write(chunk)
   243         dst.close()
   244         dst.close()
   244         util.copymode(file, storepath(repo, hash))
       
   245         linktousercache(repo, hash)
   245         linktousercache(repo, hash)
   246 
   246 
   247 def linktousercache(repo, hash):
   247 def linktousercache(repo, hash):
   248     path = usercachepath(repo.ui, hash)
   248     path = usercachepath(repo.ui, hash)
   249     if path:
   249     if path: