comparison hgext/largefiles/lfcommands.py @ 18727:4846f2115927 stable

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.
author Mads Kiilerich <madski@unity3d.com>
date Thu, 28 Feb 2013 13:45:18 +0100
parents f0aa8bbffe60
children 1e636f7b1cfe
comparison
equal deleted inserted replaced
18726:431b246cfb12 18727:4846f2115927
499 expecthash != lfutil.hashfile(abslfile))): 499 expecthash != lfutil.hashfile(abslfile))):
500 if not lfutil.copyfromcache(repo, expecthash, lfile): 500 if not lfutil.copyfromcache(repo, expecthash, lfile):
501 # use normallookup() to allocate entry in largefiles dirstate, 501 # use normallookup() to allocate entry in largefiles dirstate,
502 # because lack of it misleads lfilesrepo.status() into 502 # because lack of it misleads lfilesrepo.status() into
503 # recognition that such cache missing files are REMOVED. 503 # recognition that such cache missing files are REMOVED.
504 if lfile not in repo[None]: # not switched to normal file
505 util.unlinkpath(abslfile, ignoremissing=True)
504 lfdirstate.normallookup(lfile) 506 lfdirstate.normallookup(lfile)
505 return None # don't try to set the mode 507 return None # don't try to set the mode
506 else: 508 else:
507 # Synchronize largefile dirstate to the last modified time of 509 # Synchronize largefile dirstate to the last modified time of
508 # the file 510 # the file