largefiles: don't let update leave wrong largefiles in wd if fetch fails

Situations where a largefile for some reason wasn't available sometimes caused
wrong largefile content and state. It has mostly been seen when interrupting
download of largefiles ... and when introducing programming errors.

Instead we now make sure to delete the old and wrong largefile. A missing file
is a well-known error condition and much more reasonable way to handle the
situation.
This commit is contained in:
Mads Kiilerich 2013-02-28 13:45:18 +01:00
parent 68d046f103
commit 1d9aca9cb3

View File

@ -501,6 +501,8 @@ def _updatelfile(repo, lfdirstate, lfile):
# use normallookup() to allocate entry in largefiles dirstate,
# because lack of it misleads lfilesrepo.status() into
# recognition that such cache missing files are REMOVED.
if lfile not in repo[None]: # not switched to normal file
util.unlinkpath(abslfile, ignoremissing=True)
lfdirstate.normallookup(lfile)
return None # don't try to set the mode
else: