Mercurial > hg
comparison hgext/largefiles/lfutil.py @ 16153:05197f9fd1f3 stable
largefiles: use repo.store.createmode for new files in .hg/largefiles
Before, the mode was copied from the file in the working copy. This is
inconsistent with how Mercurial normally creates files inside the .hg
folder. This can lead to a situation where you can read the files
under .hg/store but not under .hg/largefiles and so a clone will fail
if it needs to access a largefile.
author | Martin Geisler <mg@aragost.com> |
---|---|
date | Thu, 23 Feb 2012 13:22:55 +0100 |
parents | 3e1efb458e8b |
children | 1b2b42e866be |
comparison
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: |