Mercurial > hg
comparison hgext/largefiles/lfutil.py @ 17878:d1d0140287b8 stable
largefiles: don't copy largefiles from working dir to the store while converting
Previously, if one or more largefiles for a repo being converted were not in the
usercache, the convert would abort with a reference to the largefile being
missing (as opposed to the previous patch, where the standin was referenced as
missing). This is because commitctx() tries to copy all largefiles to the
local store, first from the user cache, and if the file isn't found there, from
the working directory. No files will exist in the working directory during a
convert, however. It is not sufficient to force the source repo to be local
before proceeding, because clone and pull do not download largefiles by default.
This is slightly less than ideal because while the conversion will now complete,
it won't be possible to update to revs with missing largefiles unless the user
intervenes manually, because there is no default path pointing back to the
source repo. Ideally these files would be cached during the conversion.
This check could have been done in reposetup.commitctx() instead, but this
ensures the local store directory is created, which is necessary to enable the
standin matcher.
The rm -> 'rm -f' change in the test is to temporarily suppress an error
clearing the cache- as noted, the cache is is not repopulated during convert.
When that is fixed, this can be changed back and the verification errors will
disappear too.
author | Matt Harbison <matt_harbison@yahoo.com> |
---|---|
date | Tue, 23 Oct 2012 21:32:19 -0400 |
parents | 92bbb21d4b13 |
children | 242d2f4ec01c |
comparison
equal
deleted
inserted
replaced
17877:92bbb21d4b13 | 17878:d1d0140287b8 |
---|---|
232 | 232 |
233 def copytostoreabsolute(repo, file, hash): | 233 def copytostoreabsolute(repo, file, hash): |
234 util.makedirs(os.path.dirname(storepath(repo, hash))) | 234 util.makedirs(os.path.dirname(storepath(repo, hash))) |
235 if inusercache(repo.ui, hash): | 235 if inusercache(repo.ui, hash): |
236 link(usercachepath(repo.ui, hash), storepath(repo, hash)) | 236 link(usercachepath(repo.ui, hash), storepath(repo, hash)) |
237 else: | 237 elif not getattr(repo, "_isconverting", False): |
238 dst = util.atomictempfile(storepath(repo, hash), | 238 dst = util.atomictempfile(storepath(repo, hash), |
239 createmode=repo.store.createmode) | 239 createmode=repo.store.createmode) |
240 for chunk in util.filechunkiter(open(file, 'rb')): | 240 for chunk in util.filechunkiter(open(file, 'rb')): |
241 dst.write(chunk) | 241 dst.write(chunk) |
242 dst.close() | 242 dst.close() |